Next: \vspace, Previous: \bigbreak & \medbreak & \smallbreak, Up: Spaces [Contents][Index]

`\strut`

Synopsis:

\strut

Ensure that the current line has height at least `0.7\baselineskip`

and depth at least `0.3\baselineskip`

. Essentially, LaTeX
inserts into the line a rectangle having zero width,
`\rule[-0.3\baselineskip]{0pt}{\baselineskip}`

(see \rule).
The `\baselineskip`

changes with the current font and fontsize.

In this example the `\strut`

keeps the box inside the frame from
having zero height.

\setlength{\fboxsep}{0pt}\framebox[2in]{\strut}

This example has four lists. In the first there is a much bigger gap
between items 2 and 3 than there is between items 1 and 2.
The second list fixes that with a `\strut`

at the end of its first
item’s second line.

\setlength{\fboxsep}{0pt} \noindent\begin{minipage}[t]{0.2\linewidth} \begin{enumerate} \item \parbox[t]{15pt}{test \\ test} \item test \item test \end{enumerate} \end{minipage}% \begin{minipage}[t]{0.2\linewidth} \begin{enumerate} \item \parbox[t]{15pt}{test \\ test\strut} \item test \item test \end{enumerate} \end{minipage}% \begin{minipage}[t]{0.2\linewidth} \begin{enumerate} \item \fbox{\parbox[t]{15pt}{test \\ test}} \item \fbox{test} \item \fbox{test} \end{enumerate} \end{minipage}% \begin{minipage}[t]{0.2\linewidth} \begin{enumerate} \item \fbox{\parbox[t]{15pt}{test \\ test\strut}} \item \fbox{test} \item \fbox{test} \end{enumerate} \end{minipage}%

The final two lists use `\fbox`

to show what’s happening. The
third list’s `\parbox`

goes only to the bottom of its second
‘`test`’, which happens not have any characters that descend below
the baseline. The fourth list adds the strut that gives the needed
extra below-baseline space.

The `\strut`

command is often useful in graphics, such as in
`TikZ` or `Asymptote`. For instance, you may have a command
such as `\graphnode{`

that fits a circle around
`node-name`}`node-name`. However, unless you are careful the `node-name`’s
‘`x`’ and ‘`y`’ will produce different-diameter circles because
the characters are different sizes. A careful `\graphnode`

might
insert a `\strut`

, then `node-name`, and then draw the circle.

The general approach of using a zero width `\rule`

is useful in
many circumstances. In this table, the zero-width rule keeps the top of
the first integral from hitting the `\hline`

. Similarly, the
second rule keeps the second integral from hitting the first.

\begin{tabular}{rl} \textsc{Integral} &\textsc{Value} \\ \hline $\int_0^x t\, dt$ &$x^2/2$ \rule{0em}{2.5ex} \\ $\int_0^x t^2\, dt$ &$x^3/3$ \rule{0em}{2.5ex} \end{tabular}

(Although the line-ending double backslash command has an available
optional argument to put in more vertical room, that won’t work here.
Changing the first double backslash to something like `\\[2.5ex]`

will put the room between the header line and the `\hline`

, and the
integral would still hit the line.)