ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Kalouguine Andre via ntg-context <ntg-context@ntg.nl>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Cc: Kalouguine Andre <andre.kalouguine@ens-lyon.fr>
Subject: Re: Subject: Leading spaces verbatim
Date: Sat, 28 Jan 2023 14:31:45 +0100	[thread overview]
Message-ID: <fef9d739d18d33e1d15efab234753bc1@ens-lyon.fr> (raw)
In-Reply-To: <9a67ccd9-9075-6dde-1b0d-7ed42aeaa165@gmx.es>


[-- Attachment #1.1: Type: text/plain, Size: 1020 bytes --]

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,
thanks!. 
It's a really nice approach, though weirdly it doesn't work on Okular
(Linux+KDE) 
for me, even though attachments worked fine. I'll try and see why that
is. 

What I had in mind was rather the following: 

\starttext 
\starttyping[space=on] 
def foo(x):
    y = bar(x) 
    if y: 
        return x 
    return y 
foo(1) 
\stoptyping 
\stoptext

but with ordinary char32 spaces rather than \textcontrolspace
characters. 

Best regards,

[-- Attachment #1.2: Type: text/html, Size: 3358 bytes --]

[-- Attachment #2: Type: text/plain, Size: 496 bytes --]

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : https://contextgarden.net
___________________________________________________________________________________

  reply	other threads:[~2023-01-28 13:31 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-28  2:01 Kalouguine Andre via ntg-context
2023-01-28 12:55 ` Pablo Rodriguez via ntg-context
2023-01-28 13:31   ` Kalouguine Andre via ntg-context [this message]
2023-01-28 16:37     ` Pablo Rodriguez via ntg-context
2023-01-28 20:26       ` Kalouguine Andre via ntg-context
2023-01-28 21:54         ` Hans Hagen via ntg-context
2023-01-29 16:58           ` Kalouguine Andre via ntg-context
2023-01-30 10:54             ` Pablo Rodriguez via ntg-context
2023-01-30 16:30 ` Ulrike Fischer via ntg-context

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=fef9d739d18d33e1d15efab234753bc1@ens-lyon.fr \
    --to=ntg-context@ntg.nl \
    --cc=andre.kalouguine@ens-lyon.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).