* [NTG-context] Problems with line numbered program listings
@ 2023-10-04 17:29 Bruce Horrocks
0 siblings, 0 replies; only message in thread
From: Bruce Horrocks @ 2023-10-04 17:29 UTC (permalink / raw)
To: ntg-context mailing list
[-- Attachment #1: Type: text/plain, Size: 1767 bytes --]
I'm trying to typeset some program listings with annotations alongside. I've tried both columns and tabulate but both have (different) issues:
1) Plain \typefile won't allow the line numbers to be in the text - they stay in the margin whch I don't want.
2) \typefile using a \definedtyping name does work and works in \columns as well. This is great until my listing is too long to fit on a page and then I'd rather have the column continue onto the next page but \columns balances of course.
3) \tabulate allows a single cell to continue down over the page exactly as I'd like, but the line numbers disappear altogether. (And it has to be a single cell because the program listings are in source files that I want to include using \typefile rather than re-enter to avoid typos.)
You can see each of these effects with the following MWE which first needs a file called "three_lines.txt" to be created in the local directory containing the lines:
one
two
three
%%%% begin
\setuplinenumbering[location=text,style=\small\tt]
\starttext
Location=text not working in main body
\typefile[numbering=line]{three_lines.txt}
But it does work if a custom typing environment is created.
\definetyping[MyTyping][style=\tt]
\typefile[MyTyping][numbering=line]{three_lines.txt}
Still works if used in a column
\startcolumns
\typefile[MyTyping][numbering=line]{three_lines.txt}
\column
:-)
\stopcolumns
\blank
But doesn't work if used in tabulate
\starttabulate[|p|p|]
\NC
\typefile[MyTyping][numbering=line]{three_lines.txt}
\NC
No line numbers at all :-(
\NR
\stoptabulate
\stoptext
%%%% end
What I'd most like is for tabulate to allow \typefile with line numbers if at all possible.
—
Bruce Horrocks
Hampshire, UK
[-- Attachment #2: zz.pdf --]
[-- Type: application/pdf, Size: 11235 bytes --]
[-- Attachment #3: Type: text/plain, Size: 495 bytes --]
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!
maillist : {listname} / https://mailman.ntg.nl/mailman3/lists/{list_id}
webpage : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2023-10-04 17:33 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-10-04 17:29 [NTG-context] Problems with line numbered program listings Bruce Horrocks
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).