Next: \hfill, Previous: \enspace & \quad & \qquad, Up: Spaces [Contents][Index]
\hspaceSynopsis, one of:
\hspace{length}
\hspace*{length}
Insert the horizontal space length. The length can be
positive, negative, or zero; adding negative space is like backspacing.
It is a rubber length, that is, it may contain a plus or
minus component, or both (see Lengths). Because the space is
stretchable and shrinkable, it is sometimes called glue.
This makes a line with ‘Name:’ an inch from the right margin.
\noindent\makebox[\linewidth][r]{Name:\hspace{1in}}
The *-version inserts horizontal space that non-discardable.
More precisely, when TeX breaks a paragraph into lines any white
space—glues and kerns—that come at a line break are discarded. The
*-version avoids that (technically, it adds a non-discardable
invisible item in front of the space).
In this example
\parbox{0.8\linewidth}{%
Fill in each blank: Four \hspace*{1in} and seven years ago our
fathers brought forth on this continent, a new \hspace*{1in},
conceived in \hspace*{1in}, and dedicated to the proposition
that all men are created \hspace*{1in}.}
the 1 inch blank following ‘conceived in’ falls at the start
of a line. If you erase the * then LaTeX discards the blank.
Here, the \hspace separates the three graphics.
\begin{center}
\includegraphics{lion.png}% comment keeps out extra space
\hspace{1cm minus 0.25cm}\includegraphics{tiger.png}%
\hspace{1cm minus 0.25cm}\includegraphics{bear.png}
\end{center}
Because the argument to each \hspace has minus 0.25cm,
each can shrink a little if the three figures are too wide. But each
space won’t shrink more than 0.25cm (see Lengths).