[NTG-context] Subject: Leading spaces verbatim

Pablo Rodriguez oinos at gmx.es
Sat Jan 28 13:55:49 CET 2023


On 1/28/23 03:01, Kalouguine Andre via ntg-context wrote:
> Good day to everyone,
> 
> I'm trying to make a verbatim block of text with copiable leading spaces
> so that students can just copy my Python code snippets into their IDE.

Hi André,

I wonder whether I’m getting your point with the following sample:

  \showframe
  \setupinteraction[state=start]
  \starttext
  \startbuffer[abc]
  def foo(x):
  if x == 0:
      bar()
  else:
      baz(x)
  foo(x - 1)
  \stopbuffer
  \comment[location=leftmargin,
    space=yes,
    buffer=abc,
    title={Python code}]
    {}\typebuffer[abc]
  \stoptext

This might solve what you need. At least, this is the approach that I
use to provide text that can be directly copied.

I’m on Linux and last time I tested on Windows there were extra lines in
the comments.

Just in case it might help,

Pablo


More information about the ntg-context mailing list