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

### 19.3 \hfill

Synopsis:

\hfill


Produce a rubber length which has no natural space but that can stretch horizontally as far as needed (see Lengths).

This creates a one-line paragraph with ‘Name:’ on the left side of the page and ‘Quiz One’ on the right.

\noindent Name:\hfill Quiz One


The \hfill command is equivalent to \hspace{\fill} and so the space can be discarded at line breaks. To avoid that instead use \hspace*{\fill} (see \hspace).

Here the graphs are evenly spaced in the middle of the figure.

\newcommand*{\vcenteredhbox}[1]{\begin{tabular}{@{}c@{}}#1\end{tabular}}
...
\begin{figure}
\hspace*{\fill}%
\vcenteredhbox{\includegraphics{graph0.png}}%
\hfill\vcenteredhbox{\includegraphics{graph1.png}}%
\hspace*{\fill}%
\caption{Comparison of two graphs} \label{fig:twographs}
\end{figure}


Note the \hspace*’s where the space could otherwise be dropped.