[NTG-context] Subject: Leading spaces verbatim

Kalouguine Andre andre.kalouguine at ens-lyon.fr
Sat Jan 28 14:31:45 CET 2023

Hi Pablo,

> \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.

That's actually something I had never thought of, using PDF comments,
It's a really nice approach, though weirdly it doesn't work on Okular
for me, even though attachments worked fine. I'll try and see why that

What I had in mind was rather the following: 

def foo(x):
    y = bar(x) 
    if y: 
        return x 
    return y 

but with ordinary char32 spaces rather than \textcontrolspace

Best regards,
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ntg.nl/pipermail/ntg-context/attachments/20230128/9af95954/attachment.htm>

More information about the ntg-context mailing list