Command/underbar

From ConTeXt wiki
< Command
Revision as of 11:29, 15 September 2016 by FloMiLe (talk | contribs) (Added section "Underbar for clozes")
Jump to navigationJump to search

\underbar

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: