From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/116937 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Kalouguine Andre via ntg-context Newsgroups: gmane.comp.tex.context Subject: Re: Subject: Leading spaces verbatim Date: Sat, 28 Jan 2023 14:31:45 +0100 Message-ID: References: <1fab8ba4d867e3968ce761a02dd1ea74@ens-lyon.fr> <9a67ccd9-9075-6dde-1b0d-7ed42aeaa165@gmx.es> Reply-To: mailing list for ConTeXt users Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============5551927513001459207==" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="25273"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Roundcube Webmail/1.2.7 Cc: Kalouguine Andre To: mailing list for ConTeXt users Original-X-From: ntg-context-bounces@ntg.nl Sat Jan 28 14:32:17 2023 Return-path: Envelope-to: gctc-ntg-context-518@m.gmane-mx.org Original-Received: from zapf.boekplan.nl ([5.39.185.232] helo=zapf.ntg.nl) by ciao.gmane.io with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pLlJY-0006KN-AK for gctc-ntg-context-518@m.gmane-mx.org; Sat, 28 Jan 2023 14:32:16 +0100 Original-Received: from localhost (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id 0986E38080B; Sat, 28 Jan 2023 14:31:50 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at zapf.boekplan.nl Original-Received: from zapf.ntg.nl ([127.0.0.1]) by localhost (zapf.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id jIdN5eYU_uVC; Sat, 28 Jan 2023 14:31:48 +0100 (CET) Original-Received: from zapf.ntg.nl (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id 61673380814; Sat, 28 Jan 2023 14:31:48 +0100 (CET) Original-Received: from localhost (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id 00A8F380814 for ; Sat, 28 Jan 2023 14:31:47 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at zapf.boekplan.nl Original-Received: from zapf.ntg.nl ([127.0.0.1]) by localhost (zapf.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id ReE_PCLmI3CF for ; Sat, 28 Jan 2023 14:31:46 +0100 (CET) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=140.77.167.81; helo=lxc-smtp2.ens-lyon.fr; envelope-from=andre.kalouguine@ens-lyon.fr; receiver= Original-Received: from lxc-smtp2.ens-lyon.fr (lxc-smtp2.ens-lyon.fr [140.77.167.81]) by zapf.ntg.nl (Postfix) with ESMTP id 2A48D38080B for ; Sat, 28 Jan 2023 14:31:46 +0100 (CET) Original-Received: from localhost (localhost [127.0.0.1]) by lxc-smtp2.ens-lyon.fr (Postfix) with ESMTP id BD1BDE2D51 for ; Sat, 28 Jan 2023 14:31:45 +0100 (CET) X-Virus-Scanned: by amavisd-new-2.11.0 (20160426) (Debian) at ens-lyon.fr Original-Received: from lxc-smtp2.ens-lyon.fr ([127.0.0.1]) by localhost (lxc-smtp2.ens-lyon.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 6E-s84FyJRys for ; Sat, 28 Jan 2023 14:31:45 +0100 (CET) Original-Received: from webmail.ens-lyon.fr (lxc-m2-webmail1.ens-lyon.fr [140.77.167.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by lxc-smtp2.ens-lyon.fr (Postfix) with ESMTPSA id B2DD2E2CF8 for ; Sat, 28 Jan 2023 14:31:45 +0100 (CET) In-Reply-To: <9a67ccd9-9075-6dde-1b0d-7ed42aeaa165@gmx.es> X-Sender: andre.kalouguine@ens-lyon.fr X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.26 Precedence: list List-Id: mailing list for ConTeXt users List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ntg-context-bounces@ntg.nl Original-Sender: "ntg-context" Xref: news.gmane.io gmane.comp.tex.context:116937 Archived-At: --===============5551927513001459207== Content-Type: multipart/alternative; boundary="=_2bc08f80e57586a1a904d1f88104148a" --=_2bc08f80e57586a1a904d1f88104148a Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII 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, --=_2bc08f80e57586a1a904d1f88104148a Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=UTF-8

Hi Pablo,

=   \showframe
  \setupinteraction[state=3Dstart]
=   \starttext
  \startbuffer[abc]
 &nbs= p;def foo(x):
  if x =3D=3D 0:
   &nbs= p;  bar()
  else:
    &= nbsp; baz(x)
  foo(x - 1)
  \stopbuffe= r
  \comment[location=3Dleftmargin,
   = ; space=3Dyes,
    buffer=3Dabc,
 = ;   title=3D{Python code}]
    {}\= typebuffer[abc]
  \stoptext

This might solve wh= at you need. At least, this is the approach that I
use to provide tex= t that can be directly copied.

I'm on Linux and last time I tes= ted on Windows there were extra lines in
the comments.
=  
= That's actually something I had never thought of, using PDF comments, thank= s!.
= It's a really nice approach, though weirdly it doesn't work on Okular (Linu= x+KDE)
= for me, even though attachments worked fine. I'll try and see why that is= =2E
=  
= What I had in mind was rather the following:
=  
= \st= arttext
\starttyping[space=3Do= n]
def foo(x):
   y =3D bar(x)

<= span style=3D"color: #000000;">    if y:
       return= x
   return y=
foo(1)
\stoptyping
\stoptext

= but with ordinary char32 space= s rather than \textcontrolspace characters.
=  
= Best regards,
--=_2bc08f80e57586a1a904d1f88104148a-- --===============5551927513001459207== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19f X19fX19fX19fX19fX19fX19fX19fX19fX18KSWYgeW91ciBxdWVzdGlvbiBpcyBvZiBpbnRlcmVz dCB0byBvdGhlcnMgYXMgd2VsbCwgcGxlYXNlIGFkZCBhbiBlbnRyeSB0byB0aGUgV2lraSEKCm1h aWxsaXN0IDogbnRnLWNvbnRleHRAbnRnLm5sIC8gaHR0cHM6Ly93d3cubnRnLm5sL21haWxtYW4v bGlzdGluZm8vbnRnLWNvbnRleHQKd2VicGFnZSAgOiBodHRwczovL3d3dy5wcmFnbWEtYWRlLm5s IC8gaHR0cDovL2NvbnRleHQuYWFuaGV0Lm5ldAphcmNoaXZlICA6IGh0dHBzOi8vYml0YnVja2V0 Lm9yZy9waGcvY29udGV4dC1taXJyb3IvY29tbWl0cy8Kd2lraSAgICAgOiBodHRwczovL2NvbnRl eHRnYXJkZW4ubmV0Cl9fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19f X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fCg== --===============5551927513001459207==--