Discussion:
line breaks in tabulars
Pascal Schweizer
2008-12-11 02:42:34 UTC
Permalink
Hi,

I have a simular question to one posted by Jeremy about a year ago (http://www.mail-archive.com/lyx-users-UqbJ+GOpo4+***@public.gmane.org/msg56795.html [http://www.mail-archive.com/lyx-users-UqbJ+GOpo4+***@public.gmane.org/msg56795.html]). I do want to use automatic line breaks in LaTex tabulars since I do have cells that contain lots of text. The tabular environments I am using are e.g. xtab, sidewaystable, tabular, supertabular, ...

The suggested solution back then was: set the width of that particular column to a fixed amount

Can anybody help me out how to do that in LaTex (example code)? I am currently still using LaTex, not Lyx...

Best,
Pascal



Psssst! Schon vom neuen WEB.DE MultiMessenger gehört?
Der kann`s mit allen: *http://www.produkte.web.de/messenger/?did=3123* [http://www.produkte.web.de/messenger/?did=3123]
Paul A. Rubin
2008-12-11 15:07:10 UTC
Permalink
Post by Pascal Schweizer
The suggested solution back then was: set the width of that
particular column to a fixed amount
Can anybody help me out how to do that in LaTex (example code)? I am
currently still using LaTex, not Lyx...
\begin{tabular}{p{3cm}c}
... table contents ...
\end{tabular}

creates a two column table and sets the first column's width to 3cm (and
justifies the text). To center the text, change the first line to

\begin{tabular}{>{\centering}p{3cm}c}

(use \raggedleft or \raggedright in lieu of \centering for other
alignments).

Incidentally, an easy way to discover this, assuming you have LyX
installed, is to start a new document in LyX, insert a table, tinker
with it using the LyX table dialogs and then use View -> View Source to
see what it looks like in LaTeX.

/Paul

Loading...