LaTeX/Rules and Struts

Rules

The \rule command in normal use produces a simple black box:

\rule[depth]{width}{height}

The depth, width and height parameters are explained in the Boxes chapter.

Here is an example:

\rule{3mm}{.1pt}%
\rule[-1mm]{5mm}{1cm}%
\rule{3mm}{.1pt}%
\rule[1mm]{1cm}{5mm}%
\rule{3mm}{.1pt}

Latex example rule.png

This is useful for drawing vertical and horizontal lines.

↑Jump back a section

Struts

A special case is a rule with no width but a certain height. In professional typesetting, this is called a strut. It is used to guarantee that an element on a page has a certain minimal height. You could use it in a tabular environment or in boxes to make sure a row has a certain minimum height.

In LaTeX a strut is defined as

\rule[-.3\baselineskip]{0pt}{\baselineskip}

↑Jump back a section

Stretched rules

LaTeX provides the \hrulefill command, which work like a stretched horizontal space. See the Lengths chapter.


Previous: Boxes Index Next: Mathematics
↑Jump back a section
Last modified on 2 March 2013, at 21:24