ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Subject: Leading spaces verbatim
@ 2023-01-28  2:01 Kalouguine Andre via ntg-context
  2023-01-28 12:55 ` Pablo Rodriguez via ntg-context
  2023-01-30 16:30 ` Ulrike Fischer via ntg-context
  0 siblings, 2 replies; 9+ messages in thread
From: Kalouguine Andre via ntg-context @ 2023-01-28  2:01 UTC (permalink / raw)
  To: ntg-context; +Cc: Kalouguine Andre


[-- 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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2023-01-30 16:30 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-28  2:01 Subject: Leading spaces verbatim 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
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

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