Next: , Previous: , Up: Spaces   [Contents][Index]


19.10 \hrulefill & \dotfill

Synopsis, one of:

\hrulefill
\dotfill

Produce an infinite horizontal rubber length (see Lengths) that LaTeX fills with a rule (that is, a line) or with dots, instead of white space.

This outputs a line 2 inches long.

Name:~\makebox[2in]{\hrulefill}

This example, when placed between blank lines, creates a paragraph that is left and right justified and where the middle is filled with evenly spaced dots.

\noindent John Aubrey, RN \dotfill{} Melbury Lodge

To make the rule or dots go to the line’s end use \null at the start or end.

To change the rule’s thickness, copy the definition and adjust it, as here

\renewcommand{\hrulefill}{%
  \leavevmode\leaders\hrule height 1pt\hfill\kern\z@}

which changes the default thickness of 0.4pt to 1pt. Similarly, adjust the dot spacing as with

\renewcommand{\dotfill}{%
  \leavevmode\cleaders\hb@xt@1.00em{\hss .\hss }\hfill\kern\z@}

which changes the default length of 0.33em to 1.00em.

This example produces a line for a signature.

\begin{minipage}{4cm}
  \centering
  \hrulefill\\
  Signed
\end{minipage}

The line is 4cm long.


Unofficial LaTeX2e reference manual