* [NTG-context] Text runs out of Verbatim Frame
@ 2023-09-08 11:09 Jeroen
2023-09-08 11:30 ` [NTG-context] " Wolfgang Schuster
0 siblings, 1 reply; 2+ messages in thread
From: Jeroen @ 2023-09-08 11:09 UTC (permalink / raw)
To: mailing list for ConTeXt users
[-- Attachment #1.1: Type: text/plain, Size: 1279 bytes --]
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
[-- Attachment #1.2: Type: text/html, Size: 1538 bytes --]
[-- Attachment #2: Type: text/plain, Size: 495 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] 2+ messages in thread
* [NTG-context] Re: Text runs out of Verbatim Frame
2023-09-08 11:09 [NTG-context] Text runs out of Verbatim Frame Jeroen
@ 2023-09-08 11:30 ` Wolfgang Schuster
0 siblings, 0 replies; 2+ messages in thread
From: Wolfgang Schuster @ 2023-09-08 11:30 UTC (permalink / raw)
To: mailing list for ConTeXt users, Jeroen
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
___________________________________________________________________________________
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] 2+ messages in thread
end of thread, other threads:[~2023-09-08 11:31 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-08 11:09 [NTG-context] Text runs out of Verbatim Frame Jeroen
2023-09-08 11:30 ` [NTG-context] " Wolfgang Schuster
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox