This question may look like a duplicate but, none of the answers given to the possible duplicates contain the answer to this specific case.

I have a tabular, say \begin{tabular}{ccc}. While adding a new line to a cell, I want both resulting lines to be horizontally centered. Is there an elegant solution to this? If not is there a solution to this?


How about using \shortstack inside a cell?


    one & two & three \\
    one & two & \shortstack{a \\ bb \\ c}\\
  • Well, this worked like a charm, why didn't I see anyone mentioning this before? Simple, straightforward solution. – nimcap Dec 20 '11 at 15:55
  • 1
    +1 for \shortstack. – Philipp Dec 20 '11 at 16:11
  • 26
    +1 And to align the content, use \shortstack[r]{...} (r = right align, l = left align, c = center align). – Rob W May 14 '12 at 10:52
  • 10
    How to vertically align the content using \shortstack? – hengxin Oct 26 '13 at 6:28
  • @hengxin wrap the shortstack in a \multirow and then adjust like you would a multirow – Sanzio Angeli Dec 5 '20 at 22:56

This is an old thread, but there is a new solution.

%% tablestart
\makecell{line 1 \\ line2}
%% tableend

If you want the cells to be centered horizontally as well as vertically I suggest the following solution:



a & \bigcell{c}{this schould be a longer line \\ this is a shorter one} & c \\ 
 0,9892 & 0,9892 & 0,9892  \\

  • All answers given work, but I prefer this one as it gives adequate spacing at the top of a table cell (instead of touching the cells top line). – Christopher Bull Jul 13 '14 at 11:11

Another way I discovered is to use matrix. Not as simple as Christian's answer but provides vertical alignment along columns.


    one & two & three \\
    one & two & $\begin{matrix} \text{a} \\ \text{bb} \\ text{c} \end{matrix}$ \\

You can also use \parbox like this:

\parbox[c][][c]{width}{\centering very long \\ line}

This has an advantage over \shortstack when also using \rowcolors to color table rows with alternating colors. \parbox results in a cell that has a single consistent color, and the next table row will have the alternative color. However, using \shortstack leads to two consecutive rows with the same color.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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