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

8.19.11 \shortstack


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

Produce a vertical stack of objects.

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

   \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}}}

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:


Make objects flush right


Make objects flush left


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