Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

automated line breaks in LaTeX tables

Tags:

latex

In my dissertation, I have a glossary that explains some abbreviations I use. I put this in a table to make it look nicer. However, LaTeX does not break lines at the end of the page.

I know that I could force a line break at any point in the table, but it is a long table (much work!) and manual line breaks make the text look jagged and ugly. Is there a nice way to either have a nice-looking glossary or make LaTeX break lines automatically in a table?

...if LaTeX wouldn't do these things every so often I would really love it. The way it is, I constantly switch between affection and anger...

like image 464
bastibe Avatar asked Dec 16 '09 22:12

bastibe


People also ask

How do you break a line in a table in LaTeX?

\newline works to break a line within a cell in tabularx environment.

How do I insert multiple line breaks in LaTeX?

There are three commands here that work the same in the example: \\ (two backslashes) \newline. \hfill \break.

How do you break a line in a table?

The line break code allows data to be split into multiple lines. Place the line break code <BR> within the text at the point(s) you want the line to break.

How do you add a caption to a table in LaTeX?

Add the \caption macro before or after the tabular environment to place the caption above or below the table. To reference the table in the text, use \label . To get the correct reference number, the label has to be placed either right after the caption or into the caption macro. \caption {Caption above table.}


2 Answers

Why are you using a table for your glossary? Are you aware of the glossaries package? It lets you create beautiful glossaries with a minimum effort.

If you still want to use a table, I suggest you to use the tabularx, it defines the X column type which creates columns of adjustable width with word wrapping.

For example:

\usepackage{tabularx}  ...  \begin{tabularx}{\textwidth}{ |l|X| }   \hline   word1 & long definition... \\   \hline    word2  & long definition...  \\   \hline \end{tabularx} 
like image 123
Manuel Ceron Avatar answered Oct 13 '22 13:10

Manuel Ceron


look at the longtable package. it handles pages breaks automatically. http://ctan.org/tex-archive/macros/latex/required/tools/longtable.pdf

like image 23
Mica Avatar answered Oct 13 '22 11:10

Mica