[NTG-context] Vertical space when surrounding with textbackground
Aditya Mahajan
adityam at umich.edu
Thu Nov 26 19:33:37 CET 2020
On Thu, 26 Nov 2020, Johann Birnick wrote:
> On Thu, 2020-11-26 at 19:17 +0100, Wolfgang Schuster wrote:
> > Johann Birnick schrieb am 26.11.2020 um 19:10:
> > > On Thu, 2020-11-26 at 17:31 +0100, Wolfgang Schuster wrote:
> > > > Johann Birnick schrieb am 26.11.2020 um 17:00:
> > > > > On Thu, 2020-11-26 at 09:38 -0500, Aditya Mahajan wrote:
> > > > > > On Thu, 26 Nov 2020, Johann Birnick wrote:
> > > > > >
> > > > > > > How to surround such things properly? I just want a background to
> > > > > > > these
> > > > > > > and
> > > > > > > a
> > > > > > > sidebar. No addition spacing / empty lines.
> > > > > > A MWE will help...
> > > > > >
> > > > > > Aditya
> > > > > For example, take:
> > > > >
> > > > > \definetextbackground[code][background=color, backgroundcolor=lightgray,
> > > > > frame=off, location=paragraph]
> > > > >
> > > > > \starttextbackground[code]
> > > > > \starttyping
> > > > > This is some code
> > > > > a second line
> > > > > \stoptyping
> > > > > \stoptextbackground
> > > > You missed the W (working) in MWE.
> > > >
> > > > \definetextbackground
> > > > [Code]
> > > > [ frame=off,
> > > > background=color,
> > > > backgroundcolor=lightgray,
> > > > location=paragraph]
> > > >
> > > > \setuptyping
> > > > [before={\blank\starttextbackground[Code]},
> > > > after={\stoptextbackground\blank}]
> > > >
> > > > \starttext
> > > >
> > > > \starttyping
> > > > This is some code
> > > > a second line
> > > > \stoptyping
> > > >
> > > > \stoptext
> > > >
> > > > Wolfgang
> > > Okay so first sorry that the example missed the \starttext ... \stoptext.
> > > Won't
> > >
>
> I didn't want to copy paste it :D Just add [option=XML] to \starttext like this:
\starttext does not take an `option=XML` argument.
> \definetextbackground[code][background=color, backgroundcolor=lightgray,
> frame=off, location=paragraph]
>
> \setuptyping[before={\startbackground[code]}, after={\stopbackground}]
>
> \starttext[option=XML]
> \starttyping
> This is some code
> a second line
> \stoptyping
> \stoptext
>
> When I use \definetyping[Mytyping][option=XML] and then use \startMytyping ...
> \stopMytyping nothing changes.
Again, a MWE help to understand what is going wrong.
\definetextbackground[code][background=color, backgroundcolor=lightgray,
frame=off, location=paragraph]
\setuptyping[before={\startbackground[code]}, after={\stopbackground}]
\definetyping[XMLtyping]
[
option=XML,
before={\startbackground[code]},
after={\stopbackground},
]
\starttext
\startXMLtyping
This is some code
a second line
\stopXMLtyping
\stoptext
Aditya
More information about the ntg-context
mailing list