Layout and breaks\rule

\ruleCommand

Used to insert a solid rectangular rule with a specified width and height, optionally shifted vertically via an optional bracket argument.

\rule{2em}{3em}
Available in
base, textmacros
Kind
prefix
Allowed mode
math, text
Frequency
Not measured
Commonality
medium
Renderer support
PackageMathJaxKaTeXXeTeX
baseMathJax: FullKaTeX: PartialXeTeX: Partial
textmacrosMathJax: FullKaTeX: PartialXeTeX: Partial
About the test scope

Syntax#

\ruleo:L[1em]optional dimensionm:L{1em}dimensionm:L{1em}dimension

Argspec o:L m:L m:L — one optional and two mandatory arguments. Same argspec in base and textmacros. Reading argspecs

Examples#

base

\rule[1em]2em3em

textmacros

\text{\rule{1em}{2pt}}

textmacros

\text{\rule[3pt]1em 2pt}

Package variants#

PackageSignatureAllowed modeNotes
baseo:L m:L m:LmathUsed to insert a solid rectangular rule with a specified width and height, optionally shifted vertically via an optional bracket argument.
textmacroso:L m:L m:LtextUsed in text mode to draw a solid rule of specified width and thickness, optionally raised or lowered by an offset.

In TeXForm#

TeXForm parses this entry as prefix syntax; the package determines its argument specification.

Test cases#

base
InputCaseMathJaxKaTeXXeTeX
\rule{1pt}{1pt}Positive · baselinePassPassPass
\rule[1pt]{1pt}{1pt}Positive · vary:o[0]PassPassPass
\rule 1pt{1pt}Positive · bare[1]PassFailFail
\rule{1pt}1ptPositive · bare[2]PassPassFail
\rule[a]{1pt}{1pt}Negative · neg:L[0]PassFailFail
\rule{a}{1pt}Negative · neg:L[1]FailFailFail
\rule{1pt}{a}Negative · neg:L[2]FailFailFail
textmacros
InputCaseMathJaxKaTeXXeTeX
\rule{1pt}{1pt}Positive · baselinePassPassPass
\rule[1pt]{1pt}{1pt}Positive · vary:o[0]PassPassPass
\rule 1pt{1pt}Positive · bare[1]PassFailFail
\rule{1pt}1ptPositive · bare[2]PassPassFail
\rule[a]{1pt}{1pt}Negative · neg:L[0]PassFailFail
\rule{a}{1pt}Negative · neg:L[1]FailFailFail
\rule{1pt}{a}Negative · neg:L[2]FailFailFail
All 24 in Layout and breaks