tags:

views:

802

answers:

3

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

Best regards and thank you for your help!

+2  A: 

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

Mica
Sorry for the downvote, but my question is about line breaks, not page breaks
BastiBechtold
in which case you can say:`begin{longtable}{l >{\raggedright}p{0.75\textwidth} }`and your lines will break automatically at the table edge )
Mica
Oh, I wasn't aware of that! Thank you!
BastiBechtold
you bet. you can define the width of table cells using p{width}, then the >{\raggedright} before that makes all the text in that column sit ragged right.
Mica
haha how do i get a correct answer with a -1 vote?
Mica
because I can't withdraw my downvote, but longtable handles line breaks *and* page breaks whereas tabularx (see below) only handles line breaks. So, yours is the best answer! And if you edit your response to include the details you wrote in the comments, I will even upvote it!
BastiBechtold
Lol. Oh well. Good luck with your thesis! I hope it's typeset beautifully... Make sure you switch to a font other than CMR :P
Mica
A: 

Insert after each \\ (or \cr) the following:

\noalign{\penalty -100 }

Example:

\def\penlt{\noalign{\penalty-100 }}

\halign{&\hfil\ (#)\ \hfil\cr
1&2&3\cr \penlt
1&2&3\cr \penlt
1&2&3\cr \penlt
1&2&3\cr \penlt
1&2&3\cr \penlt
1&2&3\cr \penlt
1&2&3\cr \penlt
1&2&3\cr \penlt
1&2&3\cr \penlt
1&2&3\cr \penlt
1&2&3\cr \penlt
}

If you want to use the rule after each line then write

\def\penlt{\noalign{\hrule \penalty-100 \hrule height -.4pt \hrule}}
Alexey Malistov
+6  A: 

Why are you using a table for your glossary? Are you aware of the glossary 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}
Manuel Ceron
You are my hero!
BastiBechtold
+1 seems like the simplest solution
PiPeep