Bar within math (amended)
![](https://secure.gravatar.com/avatar/03f8b557ba35119e56eb9cb381d5ece5.jpg?s=120&d=mm&r=g)
Hello, it seems that bar (even with option 'continue=yes') is not rendered in place of '~' within math. See the sample: ---- \definebar[MyBar][color=green,rulethickness=2.8,order=background,offset=1.5,continue=yes] \starttext 1 + 2 = \startbar[MyBar]3~kN\stopbar % OK $1 + 2 = \startbar[MyBar]3~\text{kN}\stopbar$ % No background behind space $1 + 2 = \inframed[frame=off,background=color,backgroundcolor=green,offset=0pt,]{3~\text{kN}}$ % OK! \stoptext ---- In the sample 'kN' is a unit, which should be separated by space from the result (here: 3); I am used to put the unit into the math environment and enclose it into \text{...}. Is there a way to make the bar be rendered in places of blanks within math, too (like if it was inside $ ... $ - as the first line of the sample)? - Note that I can use \inframed to get background filled fully, but anyway - how about usage of "bar" for this? Best regards, Lukas
![](https://secure.gravatar.com/avatar/74d41c3215dcdd377343cdc47311757c.jpg?s=120&d=mm&r=g)
Lukas/ConTeXt schrieb am 09.06.2020 um 20:28:
Hello,
it seems that bar (even with option 'continue=yes') is not rendered in place of '~' within math. See the sample:
---- \definebar[MyBar][color=green,rulethickness=2.8,order=background,offset=1.5,continue=yes]
\starttext 1 + 2 = \startbar[MyBar]3~kN\stopbar % OK
$1 + 2 = \startbar[MyBar]3~\text{kN}\stopbar$ % No background behind space
$1 + 2 = \inframed[frame=off,background=color,backgroundcolor=green,offset=0pt,]{3~\text{kN}}$ % OK! \stoptext ----
In the sample 'kN' is a unit, which should be separated by space from the result (here: 3); I am used to put the unit into the math environment and enclose it into \text{...}.
Is there a way to make the bar be rendered in places of blanks within math, too (like if it was inside $ ... $ - as the first line of the sample)?
- Note that I can use \inframed to get background filled fully, but anyway - how about usage of "bar" for this?
Use a textbackground to highlight parts of your text. \definetextbackground [Highlight] [frame=off, background=color, backgroundcolor=yellow] \starttext \m{1 + 2 = \unit{3 kilo newton}} \m{1 + 2 = \Highlight{\unit{3 kilo newton}}} \stoptext Wolfgang
![](https://secure.gravatar.com/avatar/880e9a15b17a0bf7159f4e31030a9be2.jpg?s=120&d=mm&r=g)
Am 09.06.2020 um 20:41 schrieb Wolfgang Schuster
: Use a textbackground to highlight parts of your text.
\definetextbackground [Highlight] [frame=off, background=color, backgroundcolor=yellow]
\starttext
\m{1 + 2 = \unit{3 kilo newton}}
\m{1 + 2 = \Highlight{\unit{3 kilo newton}}}
\stoptext
Wolfgang
Is there a way to highlight just the words and leave the space white? Something like \overstrikes? Greetings Axel
![](https://secure.gravatar.com/avatar/e5aa6984b53b8925e405ebbdbc051ad9.jpg?s=120&d=mm&r=g)
Am 11.06.2020 um 13:41 schrieb Axel Kielhorn
: Am 09.06.2020 um 20:41 schrieb Wolfgang Schuster
: Use a textbackground to highlight parts of your text.
\definetextbackground [Highlight] [frame=off, background=color, backgroundcolor=yellow]
\starttext
\m{1 + 2 = \unit{3 kilo newton}}
\m{1 + 2 = \Highlight{\unit{3 kilo newton}}}
\stoptext
Wolfgang
Is there a way to highlight just the words and leave the space white? Something like \overstrikes?
Wolfgang or whoelse, when would you advise to use textbackgrounds and when bars? E.g. if I need a “marker” highlighting. Hraban
participants (4)
-
Axel Kielhorn
-
Henning Hraban Ramm
-
Lukas/ConTeXt
-
Wolfgang Schuster