Difference between revisions of "Command/underbar"

From ConTeXt wiki
Jump to navigationJump to search
m (Text replace - "[[Category:Commands|" to "== ConTeXt-Forum == {{Forum|{{SUBPAGENAME}}}} [[Category:Commands|")
 
(9 intermediate revisions by 4 users not shown)
Line 3: Line 3:
 
|attributes=
 
|attributes=
 
}}
 
}}
 +
 +
== [[Help:Reference|Syntax]] (autogenerated) ==
 +
<syntax>underbar</syntax>
  
 
== [[Help:Reference|Syntax]] ==
 
== [[Help:Reference|Syntax]] ==
Line 15: Line 18:
 
</table>
 
</table>
  
 +
== Description ==
 +
A rule under every line of ''text''.
 +
 +
== Examples ==
 +
=== Default style and math ===
 +
<context source=yes mode=mkiv text="Gives:">
 +
\underbar{This is an example. $c = \sqrt{a^2 + b^2}$}
 +
 +
\underbar{\input ward}
 +
</context>
 +
 +
=== Default style nested ===
 +
<context source=yes mode=mkiv text="Gives:">
 +
\setupbar[color=red]
 +
 +
\underbar{A \underbar{B \underbar{Cc} b} a}
 +
\blank
 +
</context>
 +
 +
=== Various parameters demo ===
 +
<context source=yes mode=mkiv text="Gives:">
 +
\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]
  
== Description ==  
+
\BarB{BarB}
This will underline text
+
\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
 +
</context>
 +
 
 +
=== Underbar for clozes ===
 +
<context source=yes mode=mkiv text="Gives:">
 +
\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
  
== Example ==
+
\starttext
<!-- Please fill in an example if you can -->
+
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.
 +
\stoptext</context>
  
 
== See also ==
 
== See also ==
<!-- something like [[cmd:goto|\goto]] -->
+
* {{cmd|overbar}} for a continuous rule above every line.
 +
* {{cmd|overbars}} for a rule above every word.
 +
* {{cmd|overstrike}} for a continuous rule through every line.
 +
* {{cmd|overstrikes}} for a rule through every word.
 +
* {{cmd|underbar}} for a continuous rule under every line.
 +
* {{cmd|underbars}} for a rule under every word.
  
== ConTeXt-Forum ==
+
== Help from ConTeXt-Mailinglist/Forum ==
 +
All issues with:
 
{{Forum|{{SUBPAGENAME}}}}
 
{{Forum|{{SUBPAGENAME}}}}
  
[[Category:Commands|underbar]]
+
[[Category:Command/Rules|udnerbar]]

Latest revision as of 18:28, 19 November 2019

\underbar

Syntax (autogenerated)

\underbar{...}
instance of \bar


Syntax

\underbar{...}
{...} text

Description

A rule under every line of text.

Examples

Default style and math

\underbar{This is an example. $c = \sqrt{a^2 + b^2}$}

\underbar{\input ward}

Gives:

Default style nested

\setupbar[color=red]

\underbar{A \underbar{B \underbar{Cc} b} a}
\blank

Gives:

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

\starttext
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.
\stoptext

Gives:

See also

Help from ConTeXt-Mailinglist/Forum

All issues with: