TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have seen the command \shortstack in some nodes in TikZ (for example, the accepted answer here).

What is used for? I couldn't find its definition in the TikZ manual.

share|improve this question
up vote 12 down vote accepted

\shortstack is not part of tikz. It is used to stack items over each other. Note that the MWE does not use any packages.

enter image description here


\shortstack[alignment]{line 1 \\ line 2 \\ line 3 etc. }

where the valid alignement are:

r - right aligned
l - left aligned
c - centered (default)



share|improve this answer

\shortstack is not a tikz-specific command. It is part of the standard LaTeX distribution and is defined in latex.ltx with the following format:


Here is the original definition(s):

    \baselineskip-\p@\lineskip 3\p@
    \expandafter\let\csname mb@#1\endcsname\relax
\gdef\@ishortstack#1{\ialign{\mb@l {##}\unskip\mb@r\cr #1\crcr}\egroup}

It is meant to stack things on top of one another like in a tabular. However, it has a shorter \baselineskip, causing a shorter vertical stacking of elements.

Here is a minimal example showing some of the difference between tabular and \shortstack:

enter image description here

  \verb|\shortstack|: & \shortstack{Predefined\\Process} \hspace{1cm}
    \shortstack[r]{Predefined\\Process} \hspace{1cm}
    \shortstack[l]{Predefined\\Process} \\ \hline
  \verb|tabular|: & \begin{tabular}{@{}c@{}}Predefined\\Process\end{tabular} \hspace{1cm}
    \begin{tabular}{@{}r@{}}Predefined\\Process\end{tabular} \hspace{1cm}

Note the reduced baseline skip in \shortstack. Also, \shortstack necessarily has a zero-width horizontal padding. Finally, the default alignment for \shortstack is along the baseline, while tabular allows for top, center (default), or baseline.

share|improve this answer

\shortstack is defined in the basic latex.ltx file. its purpose is to set text in multiple lines within a confined area.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.