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?

4
  • 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. Feb 3 '15 at 8: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 3 '15 at 8:58
  • I want the table or more specific the cell to continue on the next page. Feb 3 '15 at 9: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. Feb 3 '15 at 9:38
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}
1
  • I like your way of coding, so i will give one vote for this@David Carlisle
    – Biki Teron
    Jul 10 '17 at 8:02
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}
1
  • @DavidCarlisle: One should really clean up a bit more carefully ;-) Feb 3 '15 at 12:00

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.