Text runs out of Verbatim Frame
I am using the following to print some verbatim text in a frame. At the right side, it keeps running out of the frame, is there a way to prevent this with the MWE? This verbatim frame always is textwidth, is there a way for a single frame just for if the situation asks for it to have it only have a frame half pagewidth, like a width=0.5\textwidth Thanks Jeroen \unprotect \startuseMPgraphic{mpos:par:myexample} path p; for i = 1 upto nofmultipars : p := multipars[1] topenlarged 4pt bottomenlarged 4pt cornered 2mm ; fill p withcolor 0.95white ; draw p withcolor black withpen pencircle scaled \MPvar{linewidth}; endfor; \stopuseMPgraphic \definetextbackground [listingbackground] [state=start, mp=mpos:par:myexample, location=paragraph, topoffset=0.4em, leftoffset=0em, rulethickness=0.7pt] \definetyping[Listing] [option=commands] \setuptyping [Listing] [bodyfont=10pt, margin=1em, before=% {\blank[3*medium] \setupinterlinespace[line=2.4ex] \starttextbackground[listingbackground]}, after=% {\stoptextbackground \blank[4*medium]}] \protect \starttext \startListing test test test test test test test test test test test test test test test test test test test test test test test \stopListing \stoptext
Jeroen schrieb am 08.09.2023 um 13:09:
I am using the following to print some verbatim text in a frame. At the right side, it keeps running out of the frame, is there a way to prevent this with the MWE? This verbatim frame always is textwidth, is there a way for a single frame just for if the situation asks for it to have it only have a frame half pagewidth, like a width=0.5\textwidth
Thanks Jeroen
\unprotect
\startuseMPgraphic{mpos:par:myexample} path p; for i = 1 upto nofmultipars : p := multipars[1] topenlarged 4pt bottomenlarged 4pt cornered 2mm ; fill p withcolor 0.95white ; draw p withcolor black withpen pencircle scaled \MPvar{linewidth}; endfor; \stopuseMPgraphic
\definetextbackground [listingbackground] [state=start, mp=mpos:par:myexample, location=paragraph, topoffset=0.4em, leftoffset=0em, rulethickness=0.7pt]
\definetyping[Listing] [option=commands]
Change the alignment value for your Listing's.
\setuptyping [Listing] [bodyfont=10pt, margin=1em,
align={flushleft,verytolerant},
before=% {\blank[3*medium] \setupinterlinespace[line=2.4ex] \starttextbackground[listingbackground]}, after=% {\stoptextbackground \blank[4*medium]}]
There is also no need to put \unprotect ... \protect around your setups. Wolfgang
participants (2)
-
Jeroen
-
Wolfgang Schuster