Vertical space when surrounding with textbackground
Hi there, in my document(s) I have enumerations (created with \defineenumeration) and "typing"s (created with \definetyping) and I need to give a specific layout to them. In particular, I want to add textbackground (created with \definetextbackground) and sometimes a sidebar (created with \definesidebar) to them. However, when I surround for example my typing with a textbackground like this \starttextbackground[code] \startCpp ... \stopCpp \stoptextbackground or by putting the textbackground commands in "before=" and "after=" of my typing, then there will be an additional empty line at the end of the typing. Same with the enumerations and when I surround it with a sidebar instead of a textbackground. Often there is even an additional line / additional space before the typing/enumeration. How to surround such things properly? I just want a background to these and a sidebar. No addition spacing / empty lines. I would greatly appreciate your help. Thank you, Johann
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 Johann
On Thu, 26 Nov 2020, Johann Birnick wrote:
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
\definetextbackground[code][background=color, backgroundcolor=lightgray, frame=off, location=paragraph] \setuptyping[before={\startbackground[code]}, after={\stopbackground}] \starttext \starttyping This is some code a second line \stoptyping \stoptext Aditya
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
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 happen again. So unfortunately my MWE was too minimal. Actually this works: \definetextbackground[code][background=color, backgroundcolor=lightgray, frame=off, location=paragraph] \setuptyping[before={\startbackground[code]}, after={\stopbackground}] \starttext \starttyping This is some code a second line \stoptyping \stoptext However, I use pretty printing. When you add [option=XML] to \starttext it breaks. Why? Thank you, Johann
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 happen again.
So unfortunately my MWE was too minimal. Actually this works:
\definetextbackground[code][background=color, backgroundcolor=lightgray, frame=off, location=paragraph]
\setuptyping[before={\startbackground[code]}, after={\stopbackground}]
\starttext \starttyping This is some code a second line \stoptyping \stoptext
However, I use pretty printing. When you add [option=XML] to \starttext it breaks.
Why?
Do you have a example. Wolfgang
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: \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.
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
Johann Birnick schrieb am 26.11.2020 um 19:26:
I didn't want to copy paste it :D Just add [option=XML] to \starttext like this:
Why do pass a option for the typing environment to \starttext?
\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. ???
\definetextbackground [Code] [ frame=off, background=color, backgroundcolor=lightgray, location=paragraph] \definetyping [Mytyping] [option=XML] \setuptyping %[Mytyping] [before={\blank\starttextbackground[Code]}, after={\stoptextbackground\blank}] \starttext \startMytyping <empty/> \stopMytyping \starttyping[option=XML] <empty/> \stoptyping \stoptext Wolfgang
On Thu, 2020-11-26 at 19:35 +0100, Wolfgang Schuster wrote:
Johann Birnick schrieb am 26.11.2020 um 19:26:
I didn't want to copy paste it :D Just add [option=XML] to \starttext like this:
Why do pass a option for the typing environment to \starttext?
\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. ???
\definetextbackground [Code] [ frame=off, background=color, backgroundcolor=lightgray, location=paragraph]
\definetyping [Mytyping] [option=XML]
\setuptyping %[Mytyping] [before={\blank\starttextbackground[Code]}, after={\stoptextbackground\blank}]
\starttext
\startMytyping <empty/> \stopMytyping
\starttyping[option=XML] <empty/> \stoptyping
\stoptext
Wolfgang
Sorry for confusing \starttext with \starttyping. @Wolfgang this is exactly what I mean. It doesn't work. There is an extra line at the end. If you remove [option=XML] it works. So what is going wrong? Thank you, Johann
participants (3)
-
Aditya Mahajan
-
Johann Birnick
-
Wolfgang Schuster