Blog powered by Typepad

Search Site


« A new direction | Main | My travels »

March 12, 2008

TrackBack

TrackBack URL for this entry:
http://www.typepad.com/services/trackback/6a00d83456701f69e200e550f9c1498833

Listed below are links to weblogs that reference LaTeX table column alignment:

Comments

Ian Taylor

Thank you, this was very helpful!

Patch

Glad to have helped! Thanks for the comment.

Russell Pate

Thank you! Your method made the tables in my thesis much better.

piccolo

Hello and Thanks you very much for this small and really effective tutorial.

However I have a small question, what is if i want a border line on the left/right of the table?

I tried changing the header to
\begin{tabular}{|l p{.5cm} p{4cm} p{.5cm} l|},
but I got some blank on the borders,
any idea how to fix it?

I would appreciate.

thanks once more

Piccolo

Piccolo, the gaps that you see in the vertical borders are by products of the \smallskip element and the double \\ delimiters, which add a blank line. What I would recommend doing is removing those and adding a horizontal line instead.

piccolo

Thanks,
It helps.
Regards

Mica

There is a much cleaner method of doing this, and it took me forever to find this too: you can call ragged right in the column deceleration:

\begin{tabular}{| >{\raggedright}p{.5cm} | >{raggedright}p{4cm} | >{\centering}p{.5cm} | }

This will work with a variety of commands, in this example the left two columns will typeset with ragged right, and the right column will center. This is for every column in the table. Then you can ditch the parbox.

Eric

wow. many thanks, you just saved me the exact same headache...

Tom Castle

Thanks, this was very helpful.

To extend on Mica's comment, that works nicely too although you'll have to load the array package and replace any \\ with \tabularnewline.

Stefan

Thanks for posting this. Mica's comment helped me out greatly. (although tabularx in my document for some reason didn't accept the \raggedright in the last column)

The comments to this entry are closed.