Difference between revisions of "Command/ bar"
< Command
Jump to navigation
Jump to search
(explain more instances) |
|||
Line 1: | Line 1: | ||
− | |||
− | |||
<cd:commandgroup generated="yes" name="bar" xmlns:cd="http://wiki.contextgarden.net/commanddoc/20200807"> | <cd:commandgroup generated="yes" name="bar" xmlns:cd="http://wiki.contextgarden.net/commanddoc/20200807"> | ||
− | <cd:shortdesc> | + | <cd:shortdesc>There are several variants of underlining predefined.</cd:shortdesc> |
− | |||
− | |||
− | </cd:shortdesc> | ||
<cd:sequence> | <cd:sequence> | ||
<cd:instance value="bar"></cd:instance> | <cd:instance value="bar"></cd:instance> | ||
Line 13: | Line 8: | ||
<cd:constant value="underbar">for a continuous rule below every line. Not be confused with <code>\underbar</code>in math mode {{gen|mathundertextextensible}}</cd:constant> | <cd:constant value="underbar">for a continuous rule below every line. Not be confused with <code>\underbar</code>in math mode {{gen|mathundertextextensible}}</cd:constant> | ||
<cd:constant value="overstrike">for a continuous rule through every line.</cd:constant> | <cd:constant value="overstrike">for a continuous rule through every line.</cd:constant> | ||
− | <cd:constant value="understrike"></cd:constant> | + | <cd:constant value="understrike">background color behind the line, like with a marker pen</cd:constant> |
<cd:constant value="overbars">for a rule above every word.</cd:constant> | <cd:constant value="overbars">for a rule above every word.</cd:constant> | ||
<cd:constant value="underbars">for a rule under every word.</cd:constant> | <cd:constant value="underbars">for a rule under every word.</cd:constant> | ||
<cd:constant value="overstrikes">for a continuous rule through every word.</cd:constant> | <cd:constant value="overstrikes">for a continuous rule through every word.</cd:constant> | ||
− | <cd:constant value="understrikes"></cd:constant> | + | <cd:constant value="understrikes">background color for every word.</cd:constant> |
− | <cd:constant value="underrandom"></cd:constant> | + | <cd:constant value="underrandom">irregular (randomized) underlining.</cd:constant> |
− | <cd:constant value="underrandoms"></cd:constant> | + | <cd:constant value="underrandoms">irregular underlining for every word.</cd:constant> |
− | <cd:constant value="underdash"></cd:constant> | + | <cd:constant value="underdash">dashed underlining.</cd:constant> |
− | <cd:constant value="underdashes"></cd:constant> | + | <cd:constant value="underdashes">dashed underlining for every word.</cd:constant> |
− | <cd:constant value="underdot"></cd:constant> | + | <cd:constant value="underdot">dotted underlining.</cd:constant> |
− | <cd:constant value="underdots"></cd:constant> | + | <cd:constant value="underdots">dotted underlining for every word.</cd:constant> |
<cd:constant value="nobar"></cd:constant> | <cd:constant value="nobar"></cd:constant> | ||
<cd:constant value="hiddenbar"></cd:constant> | <cd:constant value="hiddenbar"></cd:constant> | ||
Line 34: | Line 29: | ||
</cd:command> | </cd:command> | ||
</cd:variants> | </cd:variants> | ||
− | <cd:description> | + | <cd:description>In MkIV only those of the same kind are nestable (stacking), in LMTX also mixed.</cd:description> |
− | + | <cd:examples><cd:example title="Default style and math"><context source="yes" text="Gives:"> | |
− | </cd:description> | ||
− | <cd:examples> | ||
− | <cd:example title="Default style and math"> | ||
− | <context source="yes" text="Gives:"> | ||
\underbar{This is an example. $c = \sqrt{a^2 + b^2}$} | \underbar{This is an example. $c = \sqrt{a^2 + b^2}$} | ||
\underbar{\input ward} | \underbar{\input ward} | ||
</context> | </context> | ||
− | </cd:example> | + | </cd:example><cd:example title="Nested bars"><context source="yes" text="Gives:"> |
− | |||
− | <cd:example title=" | ||
− | <context source="yes" text="Gives:"> | ||
\setupbar[color=red] | \setupbar[color=red] | ||
\underbar{A \underbar{B \underbar{Cc} b} a} | \underbar{A \underbar{B \underbar{Cc} b} a} | ||
+ | \blank | ||
+ | \underbar{A \underdot{B \underdash{Cc} b} a} | ||
+ | \blank | ||
+ | \underrandoms{A \overbar{B \underrandoms{Cc} b} a} | ||
\blank | \blank | ||
</context> | </context> | ||
− | </cd:example> | + | </cd:example><cd:example title="Overstrike">Draw a rule through every line of the text. |
− | + | <context source="yes"> | |
− | |||
− | |||
− | |||
− | <context source= | ||
\setuppapersize[A5] | \setuppapersize[A5] | ||
\overstrike{This is an example. $c = \sqrt{a^2 + b^2}$} | \overstrike{This is an example. $c = \sqrt{a^2 + b^2}$} | ||
Line 66: | Line 54: | ||
</context> | </context> | ||
− | If you are using microtypography with <code>\setupalign[hz,hanging]</code>, then with some fonts the rule may end up off-target, above the characters instead of through them. (The problem was experienced with Linux Libertine and mkiv, and not with Latin Modern.) The workarounds are: | + | If you are using microtypography with <code>\setupalign[hz,hanging]</code>, then with some fonts the rule may end up off-target, above the characters instead of through them. (The problem was experienced with Linux Libertine and mkiv, and not with Latin Modern.) The workarounds are: |
* Put the overstriked text in a <code>\inframed[frame=off]{}</code>. Example: | * Put the overstriked text in a <code>\inframed[frame=off]{}</code>. Example: | ||
Line 82: | Line 70: | ||
bla bla bla bla bla | bla bla bla bla bla | ||
</texcode> | </texcode> | ||
− | </cd:example> | + | </cd:example><cd:example title="Various parameters demo"><context source="yes" text="Gives:"> |
− | |||
− | <cd:example title="Various parameters demo"> | ||
− | <context source="yes" text="Gives:"> | ||
\setuppapersize[A5] | \setuppapersize[A5] | ||
Line 109: | Line 94: | ||
\blank | \blank | ||
</context> | </context> | ||
− | </cd:example> | + | </cd:example><cd:example title="Underbar for clozes"><context source="yes" text="Gives:"> |
− | <cd:example title="Underbar for clozes"> | ||
− | <context source="yes" text="Gives:"> | ||
\definebar[ClozeBar][underbar][continue=yes, color=black, offset=-0.5] | \definebar[ClozeBar][underbar][continue=yes, color=black, offset=-0.5] | ||
Line 125: | Line 108: | ||
\stopTEXpage | \stopTEXpage | ||
</context> | </context> | ||
− | </cd:example> | + | </cd:example></cd:examples> |
− | + | <cd:notes></cd:notes> | |
− | </cd:examples> | ||
− | <cd:notes> | ||
− | |||
− | |||
− | |||
− | |||
− | </cd:notes> | ||
<cd:seealso> | <cd:seealso> | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
<cd:commandref name="definebar" originator="system"></cd:commandref> | <cd:commandref name="definebar" originator="system"></cd:commandref> | ||
<cd:commandref name="setupbar" originator="system"></cd:commandref> | <cd:commandref name="setupbar" originator="system"></cd:commandref> | ||
− | <cd:source file="node-rul.mkiv" originator="system"></cd:source> | + | <cd:source file="node-rul.mkiv" originator="system"></cd:source> |
− | <cd:wikipage originator="system" page="Category:Rules"></cd:wikipage> | + | <cd:wikipage originator="system" page="Category:Rules"></cd:wikipage> |
− | </cd:seealso> | + | <cd:manual pdf="rules-mkiv">Everything about rules (lines)</cd:manual></cd:seealso> |
</cd:commandgroup> | </cd:commandgroup> |
Revision as of 19:02, 9 December 2021
Contents
\bar
Summary
There are several variants of underlining predefined.
Instances
\overbar | for a continuous rule above every line. Not be confused with \overbar in math mode mathovertextextensible |
\underbar | for a continuous rule below every line. Not be confused with \underbar in math mode mathundertextextensible |
\overstrike | for a continuous rule through every line. |
\understrike | background color behind the line, like with a marker pen |
\overbars | for a rule above every word. |
\underbars | for a rule under every word. |
\overstrikes | for a continuous rule through every word. |
\understrikes | background color for every word. |
\underrandom | irregular (randomized) underlining. |
\underrandoms | irregular underlining for every word. |
\underdash | dashed underlining. |
\underdashes | dashed underlining for every word. |
\underdot | dotted underlining. |
\underdots | dotted underlining for every word. |
\nobar | |
\hiddenbar |
Settings instance
Description
In MkIV only those of the same kind are nestable (stacking), in LMTX also mixed.
Examples
Default style and math
\underbar{This is an example. $c = \sqrt{a^2 + b^2}$} \underbar{\input ward}
Gives:
internal error: convert failed
Nested bars
\setupbar[color=red] \underbar{A \underbar{B \underbar{Cc} b} a} \blank \underbar{A \underdot{B \underdash{Cc} b} a} \blank \underrandoms{A \overbar{B \underrandoms{Cc} b} a} \blank
Gives:
Overstrike
Draw a rule through every line of the text.
\setuppapersize[A5] \overstrike{This is an example. $c = \sqrt{a^2 + b^2}$} \overstrike{\input ward}internal error: convert failed
If you are using microtypography with \setupalign[hz,hanging]
, then with some fonts the rule may end up off-target, above the characters instead of through them. (The problem was experienced with Linux Libertine and mkiv, and not with Latin Modern.) The workarounds are:
- Put the overstriked text in a
\inframed[frame=off]{}
. Example:
\setupalign[hanging,hz] bla bla bla \inframed[frame=off]{\overstrike{striked}} bla bla
- Turn off microtypography for the paragraph containing the overstrike. Example:
\setupalign[nothanging,nohz] bla bla bla \overstrike{striked} bla bla \setupalign[hanging,hz] bla bla bla bla bla
Various parameters demo
\setuppapersize[A5] \definebar[BarA][color=red,rulethickness=1.4] \BarA{BarA} \blank Hello \startbar[BarA]\input{knuth}\stopbar world! \blank \definebar[BarB][color=green,rulethickness=2.8,order=background] \BarB{BarB} \blank Hello \startbar[BarB]\input{knuth}\stopbar world! \blank \definebar[BarC][color=blue,rulethickness=2.8,order=background,offset=1.5,continue=yes] \BarC{BarC} \blank Hello \startbar[BarC]\input{knuth}\stopbar world! \blank
Gives:
Underbar for clozes
\definebar[ClozeBar][underbar][continue=yes, color=black, offset=-0.5] \starttexdefinition unexpanded Cloze #1 \startbar[ClozeBar] \scratchdimen\widthofstring{#1}\relax \zwj\kern.2\scratchdimen #1 \kern.2\scratchdimen\zwj \stopbar \stoptexdefinition \startTEXpage This is a \Cloze{\color[red]{cloze}} whose underbar is 1.4 times as wide as the text above it. \Cloze{The leading} and trailing spaces are never broken. \stopTEXpage
Gives:
Notes
See also
- \definebar
- \setupbar
- node-rul.mkiv
- rules-mkiv Everything about rules (lines)
Help from ConTeXt-Mailinglist/Forum
All issues with:
- \overbar on the mailing list (all results)
- \overbar on the mailing list (subject only)
- \overbar on stack exchange
- \overbar in ConTeXt's source
- \underbar on the mailing list (all results)
- \underbar on the mailing list (subject only)
- \underbar on stack exchange
- \underbar in ConTeXt's source
- \overstrike on the mailing list (all results)
- \overstrike on the mailing list (subject only)
- \overstrike on stack exchange
- \overstrike in ConTeXt's source
- \understrike on the mailing list (all results)
- \understrike on the mailing list (subject only)
- \understrike on stack exchange
- \understrike in ConTeXt's source
- \overbars on the mailing list (all results)
- \overbars on the mailing list (subject only)
- \overbars on stack exchange
- \overbars in ConTeXt's source
- \underbars on the mailing list (all results)
- \underbars on the mailing list (subject only)
- \underbars on stack exchange
- \underbars in ConTeXt's source
- \overstrikes on the mailing list (all results)
- \overstrikes on the mailing list (subject only)
- \overstrikes on stack exchange
- \overstrikes in ConTeXt's source
- \understrikes on the mailing list (all results)
- \understrikes on the mailing list (subject only)
- \understrikes on stack exchange
- \understrikes in ConTeXt's source
- \underrandom on the mailing list (all results)
- \underrandom on the mailing list (subject only)
- \underrandom on stack exchange
- \underrandom in ConTeXt's source
- \underrandoms on the mailing list (all results)
- \underrandoms on the mailing list (subject only)
- \underrandoms on stack exchange
- \underrandoms in ConTeXt's source
- \underdash on the mailing list (all results)
- \underdash on the mailing list (subject only)
- \underdash on stack exchange
- \underdash in ConTeXt's source
- \underdashes on the mailing list (all results)
- \underdashes on the mailing list (subject only)
- \underdashes on stack exchange
- \underdashes in ConTeXt's source
- \underdot on the mailing list (all results)
- \underdot on the mailing list (subject only)
- \underdot on stack exchange
- \underdot in ConTeXt's source
- \underdots on the mailing list (all results)
- \underdots on the mailing list (subject only)
- \underdots on stack exchange
- \underdots in ConTeXt's source