I'm not sure how to combine line numbering with a background in a typing
environment.
Here's what I'm trying to achieve:
Here's a minimal example of what I'm trying:
\starttext
\startbackground[frame=on,background=off]
\startlinenumbering
\starttyping
Phasellus neque orci, porta a, aliquet quis, semper a, massa.
Etiam laoreet quam sed arcu.
In id erat non orci commodo lobortis.
\stoptyping
\stoplinenumbering
\stopbackground
\stoptext
When I compile this, I get typing in a background, but no line numbers:
However, if I remove the background
from the block line numbers appear as expected.
I can get essentially what I want with the framedtext
environment but then I can't break across pages:
\starttext
\startframedtext[frame=on,background=off,width={\hsize},frameoffset=2em]
\startlinenumbering
\starttyping
Phasellus neque orci, porta a, aliquet quis, semper a, massa.
Etiam laoreet quam sed arcu.
In id erat non orci commodo lobortis.
\stoptyping
\stoplinenumbering
\stopframedtext
\stoptext
I can also get line numbers to show up if I wrap the text in a textbackground
, but then I'm not able to get the background to extend around the line numbers:
\starttext
\definetextbackground
[MyBackground]
[framecolor=black,
location=always,
background=off]
\starttextbackground[MyBackground]
\startlinenumbering
\starttyping
Phasellus neque orci, porta a, aliquet quis, semper a, massa.
Etiam laoreet quam sed arcu.
In id erat non orci commodo lobortis.
\stoptyping
\stoplinenumbering
\stoptextbackground
\stoptext
Is there any way to achieve the result in the first image such that the typing can break across pages?
\starttyping .. \stoptyping
? If you want a typewriter font,\tt
should suffice. Typing environments are for verbatim text.vim
module by Aditya Mahajan instead. See an example here: tex.stackexchange.com/questions/537289/…typing
environment because I thought it would have a wider reach.\setuplinenumbering[location=text]
?