2

I'm trying to generate a pdf using LaTeX. My problem is with tables that have very long texts in it. For example: enter image description here

This example was made using tabularx. But I also tried using longtable.

Is there any way I can display this text in a table?

lindelof
  • 1,087
  • It might help a little to make it sideways, using the sidewaystable environment from the rotating package, particularly if the table is enormous. It gives you more room horizontally, so the long entry doesn't take as many lines. – Benjamin McKay Feb 03 '15 at 08:53
  • 1
    You need to be specific in your request, which currently it is not. Do you want the table to wrap across the page boundary or what? – Werner Feb 03 '15 at 08:58
  • I want the table or more specific the cell to continue on the next page. – Simon Balling Feb 03 '15 at 09:06
  • It is really hard to break tables mid row (in general it's not possible, imagine if there are overlapping images in different cells there may not be a horizontal line that has a break point in every column). What you can do is split your long text putting paragraphs in separate rows and adjusting the material in other columns accordingly. If the material is really as shown in the example with one column of long text and two columns with one line annotations then it is almost always better to use a list rather than a table, then it automatically breaks as needed. – David Carlisle Feb 03 '15 at 09:38

2 Answers2

4

Use a list not a table:

enter image description here

\documentclass{article}
\usepackage{lipsum}
\usepackage[latin]{babel}
\newenvironment{zzz}
{\list{}%
  {\def\makelabel##1{\hss\llap{##1}}%
  \leftmargin3cm
  \rightmargin3cm }
}
{\endlist}

\newcommand\zzzitem[3]{\item[#1\rlap{\kern\linewidth\quad$#3$}]#2}

\begin{document}



\begin{zzz}

\zzzitem{X}{\lipsum[2-4]}{Jkj^{-1}K^{-1}}

\zzzitem{X}{\lipsum[1]}{Jkj^{-1}K^{-1}}

\zzzitem{Y}{description}{JKj^{-1}K^{-1}}

\zzzitem{Z}{\lipsum[3-5]}{JKj^{-3}K^{2}}

\zzzitem{Y}{description}{JKj^{-1}K^{-1}}

\zzzitem{Y}{description}{JKj^{-1}K^{-1}}

\end{zzz}

\end{document}
David Carlisle
  • 757,742
4

It is a very bad habitude to put these type of informations in tables: You have one column which is overfull and two nearly empty ones. Also all this table headers are unnecessary: Your readers should be able to figure this out, and if you don't trust their intelligence a simple sentence at the start should be enough.

\documentclass[]{scrartcl}
\usepackage[english]{babel}  
\usepackage[utf8]{inputenc}  
\usepackage[T1]{fontenc}     
\usepackage{enumitem,siunitx,lipsum}
\begin{document}
\section{Symbols}
The list shows the symbol, the unit and some descriptions. 
\begin{description}[font=\sffamily\bfseries, leftmargin=3cm,
style=multiline]
\item[$X$\\
 \si{\joule\per\kilo\gram\per\kelvin}] \lipsum[1]
\end{description} 
\end{document}
Ulrike Fischer
  • 327,261