From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/116931 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Kalouguine Andre via ntg-context Newsgroups: gmane.comp.tex.context Subject: Subject: Leading spaces verbatim Date: Sat, 28 Jan 2023 03:01:24 +0100 Message-ID: <1fab8ba4d867e3968ce761a02dd1ea74@ens-lyon.fr> Reply-To: mailing list for ConTeXt users Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============8652110751678723598==" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="4829"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Roundcube Webmail/1.2.7 Cc: Kalouguine Andre To: ntg-context@ntg.nl Original-X-From: ntg-context-bounces@ntg.nl Sat Jan 28 03:01:56 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 1pLaXT-00014y-Ci for gctc-ntg-context-518@m.gmane-mx.org; Sat, 28 Jan 2023 03:01:55 +0100 Original-Received: from localhost (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id 8BA313807C8; Sat, 28 Jan 2023 03:01:30 +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 oE8i3-jY6JIS; Sat, 28 Jan 2023 03:01:28 +0100 (CET) Original-Received: from zapf.ntg.nl (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id 4E47F380806; Sat, 28 Jan 2023 03:01:28 +0100 (CET) Original-Received: from localhost (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id B89D8380797 for ; Sat, 28 Jan 2023 03:01:26 +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 xw7B4XAxfCme for ; Sat, 28 Jan 2023 03:01:25 +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 7C69010BE for ; Sat, 28 Jan 2023 03:01:25 +0100 (CET) Original-Received: from localhost (localhost [127.0.0.1]) by lxc-smtp2.ens-lyon.fr (Postfix) with ESMTP id E417AE34A1 for ; Sat, 28 Jan 2023 03:01:24 +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 kuD_SIcxvkMx for ; Sat, 28 Jan 2023 03:01:24 +0100 (CET) Original-Received: from webmail.ens-lyon.fr (lxc-m2-webmail2.ens-lyon.fr [140.77.167.53]) (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 D7EA3E34A0 for ; Sat, 28 Jan 2023 03:01:24 +0100 (CET) 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:116931 Archived-At: --===============8652110751678723598== Content-Type: multipart/alternative; boundary="=_5ef3bd9bdfbe62471a1c7623e52eda22" --=_5ef3bd9bdfbe62471a1c7623e52eda22 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII 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. I believe the question has been asked before (though I confess I can't find the right search terms to find the answer again). I get that PDFs are not the optimal way to give code to students (which is why for longer snippets, I just give them the files or I attach them into the PDF), but for short snippets it would be so much simpler... I recently stumbled onto this article: https://www.overleaf.com/latex/examples/using-luatex-to-convert-interword-glue-to-spaces-and-kerns/sfdkdkybrvkv wherein the author replaces the TeX glue with spaces and kerning. I was wondering whether the same idea could be applied within the typing environment but making a primitive verbatim environment using \obeylines and \obeyspaces did not result in copiable spaces. Unfortunately, whilst I have some concepts of how luatex works on the input file, the step wherein a pdf is formed is fairly misterious to me, meaning I can't really understand the Lua code from said article (https://gist.github.com/Semptum/076cca71bc251ebe19ff96c5effca3cb). Hence, my three questions: - Is it even realistic to make such a typing environment? - What would be the best path to do so? - Can someone recommend some reading material specifically about this kind of typographical adjustments using LuaTex? Stuff like adjusting the glyphs's position, replacing characters with combined characters etc... Sorry if that's a bit vague, as you can see from the rest of the message, I never really went too deep into the later stages of the TeX pipeline. Best regards, Andre --=_5ef3bd9bdfbe62471a1c7623e52eda22 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=UTF-8

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. I b= elieve the question has been asked before (though I confess I can't find th= e right search terms to find the answer again). I get that PDFs are not the= optimal way to give code to students (which is why for longer snippets, I = just give them the files or I attach them into the PDF), but for short snip= pets it would be so much simpler...

I recently stumbled onto this article: https://www.overle= af.com/latex/examples/using-luatex-to-convert-interword-glue-to-spaces-and-= kerns/sfdkdkybrvkv wherein the author replaces the TeX glue with spaces= and kerning. I was wondering whether the same idea could be applied within= the typing environment but making a primitive verbatim environment using \= obeylines and \obeyspaces did not result in copiable spaces.

Unfortunately, whilst I have some concepts of how luatex works on the in= put file, the step wherein a pdf is formed is fairly misterious to me, mean= ing I can't really understand the Lua code from said article (https://gist.github.com/Semptum/076cca71bc251ebe1= 9ff96c5effca3cb).

Hence, my three questions:

 - Is it even realistic to make such a typing environment?
&nb= sp;- What would be the best path to do so?
 - Can someone recomme= nd some reading material specifically about this kind of typographical adju= stments using LuaTex? Stuff like adjusting the glyphs's position, replacing= characters with combined characters etc... Sorry if that's a bit vague, as= you can see from the rest of the message, I never really went too deep int= o the later stages of the TeX pipeline.

Best regards,
Andre

--=_5ef3bd9bdfbe62471a1c7623e52eda22-- --===============8652110751678723598== 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== --===============8652110751678723598==--