From: Kalouguine Andre via ntg-context <ntg-context@ntg.nl>
To: ntg-context@ntg.nl
Cc: Kalouguine Andre <andre.kalouguine@ens-lyon.fr>
Subject: Subject: Leading spaces verbatim
Date: Sat, 28 Jan 2023 03:01:24 +0100 [thread overview]
Message-ID: <1fab8ba4d867e3968ce761a02dd1ea74@ens-lyon.fr> (raw)
[-- Attachment #1.1: Type: text/plain, Size: 1715 bytes --]
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
[-- Attachment #1.2: Type: text/html, Size: 2333 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
___________________________________________________________________________________
next reply other threads:[~2023-01-28 2:01 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-28 2:01 Kalouguine Andre via ntg-context [this message]
2023-01-28 12:55 ` Pablo Rodriguez via ntg-context
2023-01-28 13:31 ` Kalouguine Andre via ntg-context
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=1fab8ba4d867e3968ce761a02dd1ea74@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).