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

What is the easiest way to have 2 lines in some of the cells in a table?

The only way I can think right now is to actually have 2 separate rows (without the line in the middle) and use \multirow on all other cells in this row. Any easier ideas?

share|improve this question
Can you clarify your question? Maybe post a small complete document with a table that shows what you want. If you use the p column type, you can have paragraphs within a table cell. Will that solve the problem? – Alan Munn Jan 9 '12 at 20:29
here is an excellent solution: texblog.org/2012/12/21/… – Antonín Hoskovec May 5 '13 at 18:13
up vote 37 down vote accepted

You could nest a tabular within another tabular:

enter image description here

  One & Two & Three & Four \\
  Een & Twee & Drie & Vier \\
  One & Two & \begin{tabular}{@{}c@{}}Three \\ Drie\end{tabular} & Four

The use of @{}..@{} voids the additional space (horizontal tab separation) inserted by the nested tabular.

Also, the above example inserts the nested tabular vertically centered with respect to the row. If you want it top or bottom aligned, use the optional parameter to tabular: \begin{tabular}[t].. or \begin{tabular}[b]....

Note that this approach also works within math mode for an array.

share|improve this answer
The result is really beautiful. – Wok May 21 '15 at 12:52
this doesnt work. my computer keeps saying "unknown environment 'document' ". Any solution? – Doeser Apr 27 at 0:47
@Doeser: That's unfortunate. Without example code that replicates your problem I'm unable to help though. Are you compiling with pdftex or with pdflatex? – Werner Apr 27 at 0:49
I am not sure what those mean. I am writing a question on physic stack exchange. I guess what work on latex stack may not work on other stacks. – Doeser Apr 27 at 0:58
@Doeser: If you're writing on Stack Exchange, then it uses MathJax which doesn't require the \documentclass{article}\begin{document} ... \end{document} setting. You'll just need whatever is inside the document environment. Note though that it (MathJax) doesn't support the full set of (La)TeX constructions. – Werner Apr 27 at 1:04

When using a p-type column, one can set the width of a column:

By default, if the text in a column is too wide for the page, LaTeX won’t automatically wrap it. Using p{'width'} you can define a special type of column which will wrap-around the text as in a normal paragraph. You can pass the width using any unit supported by LaTeX, such as 'pt' and 'cm'...

The p column does not only allow text to be automatically broken in multiple lines depending on the size of the column as given, it also allows for the use of \newline in the tabular environment:

  foo & bar \newline rlz \\

Which gives:
example of p-type column

share|improve this answer
Welcome to TeX.sx! – texenthusiast Mar 18 '13 at 1:15
It would be good to emphasise this requires a p type column – Andrew Swann Mar 18 '13 at 7:30
\newline works without any issues in tabularx. – Rob W Sep 29 '13 at 17:18

The easiest way is to use \shortstack but it is not very flexible.


    one & two & three \\
    one & two & \shortstack{aa \\ bb}\    

\shortstack takes an option to align content left [l], right [r], or center [c](default). Another idea is to use \parbox[t]{5cm}{aa\\bb} because it provides options to align the lines vertically.

share|improve this answer

here are some cell definitions that i've used to good effect in situations where the content of table cells was essentially text:


the job(s) involved had \usepackage{array} to get the augmented facilities.

of course, the dimensions were specific to the job, and would need to be changed depending on the circumstances; and fine tuning was definitely needed in the actual jobs involved. type was assumed to be 10pt for \lcell and \ccell or 8pt for \slcell; i also \setlength{\extrarowheight}{1pt} to keep the tops of cell content from crashing into lines above, and the \strut assures consistent clearance below.

line breaks in cells were usually manual (though they needn't be), with \break, and if a continuation line should be indented in a left-aligned cell, an \hspace* would be needed. the \par at the end ensures that the specified baseline is observed.

to me, multi-line text content of cells looks much better with "normal" text baseline settings than it does with the usual table row separation.

for table headings, vertical centering of multiple lines doesn't look so good; they look better aligned at the bottom. here's the definition i used for that:


some of these headings ran to four or more lines (complicated headings above narrow columns of numbers). the results were actually quite respectable.

share|improve this answer

Why Not partition your text into two rows just donot put the hline between the rows, something like this:

A & B &C\\
D & E &F\\
G & H & I\\
share|improve this answer
It's more work than a \shortstack for example. In general it will result in a lot of &. – Trilarion Sep 11 '14 at 13:23

You can also put minipages in your cells. Its especially interesting if you have a whole text in a cell and you want it to make linebreaks by its own.

share|improve this answer
Welcome to Tex.SX! Your answer seems good to me, however you could maybe expand it a little or provide an example to make it more efficient. Do not forget to "quote" an already existing answer if you referred to it create yours. – Ludovic C. Nov 7 '13 at 10:14

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.