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


8.19.11 \shortstack

Synopsis:

\shortstack[position]{line 1 \\ ... }

Produce a vertical stack of objects.

This labels the y axis by writing the word ‘y’ above the word ‘axis’.

\setlength{\unitlength}{1cm}
\begin{picture}(5,2.5)(-0.75,0)
   \put(0,0){\vector(1,0){4}}   % x axis
   \put(0,0){\vector(0,1){2}}   % y
   \put(-0.2,2){\makebox(0,0)[r]{\shortstack[r]{$y$\\ axis}}}
\end{picture}

For a short stack, the reference point is the lower left of the stack. In the above example the \makebox (see \mbox & \makebox) puts the stack flush right in a zero width box so in total the short stack sits slightly to the left of the y axis.

The valid positions are:

r

Make objects flush right

l

Make objects flush left

c

Center objects (default)

Separate objects into lines with \\. These stacks are short in that, unlike in a tabular or array environment, here the rows are not spaced out to be of even baseline skips. Thus, in \shortstack{X\\o\\o\\X} the first and last rows are taller than the middle two, and therefore the baseline skip between the two middle rows is smaller than that between the third and last row. You can adjust row heights and depths either by putting in the usual interline spacing with \shortstack{X\\ \strut o\\o\\X} (see \strut), or explicitly, via an zero-width box \shortstack{X \\ \rule{0pt}{12pt} o\\o\\X} or by using \\’s optional argument \shortstack{X\\[2pt] o\\o\\X}.

The \shortstack command is also available outside the picture environment.


Unofficial LaTeX2e reference manual