Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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.

share|improve this question
add comment

1 Answer

up vote 7 down vote accepted

The cell needs to be of a paragraph style: either via a p{<len>} column specification, or using a \parbox.

enter image description here

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

share|improve this answer
add comment

Your Answer

 
discard

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.