How can I put a new line (line break) within a table cell? I'm at a loss how to do this. I'm not using lyx or anything special, just MacTex and texmaker.
Asked
Active
Viewed 2.1k times
1 Answers
10
The cell needs to be of a paragraph style: either via a p{<len>} column specification, or using a \parbox.

\documentclass{article}
\begin{document}
\begin{tabular}{ll}
Some text & Some more text \\
\parbox[t]{3in}{Here is some lengthy text \par with a break\strut} &
Some more text \\
Some text & Some more text
\end{tabular}
\bigskip
\begin{tabular}{p{3in}l}
Some text & Some more text \\
Here is some lengthy text \par with a break\strut &
Some more text \\
Some text & Some more text
\end{tabular}
\end{document}
Using \\ alone would not help, since this is redefined inside a tabular to define a new line. Of course, depending on the context, it may also be possible to use
\begin{tabular}{ll}
Some text & Some more text \\
Here is some lengthy text & Some more text \\
with a break \\
Some text & Some more text
\end{tabular}
which resembles a newline in one of the cells.
samcarter_is_at_topanswers.xyz
- 158,329
Werner
- 603,163
-
1You can also use \newline. If you want fixed colum widths and different alignments you can use the answer to this question and use \newline within this. – Elise Nov 13 '21 at 21:10