How to center vertically in a LaTeX table?
April 18, 2007 11:06 AM
Subscribe
How do I center text (or, really, images) up-and-down within a tabular cell in LaTeX?
I have a table, created in LaTeX, using the tabular environment. I would like the contents of the cells to be centered within each cell vertically, as well as horizontally. (That is, if the cell is a box, I want there to be white space above and below the text, if there is some other cell with more text.)
(For the purposes of full disclosure, I use the tabular environment within a figure environment to easily make multi-part figures; the issue is I have a big image and a small image side-by-side, and I'd like the small image to appear centered vertically with the big image, aligned with the baseline of the big image! If you can tell me how I really should be doing this, that would be an acceptable answer too.)
posted by leahwrenn to computers & internet (5 comments total)
\begin{tabular}{|m{1in}|m{1in}|}
cell 1
&
cell 2
\end{tabular}
will give you a two-column table, each column 1 inch wide, with vertical bars before and after each, and with content centered in each. The 'm' is the magic flag for vertical centering.
I'll have to think more about your big-image/little-image problem.
posted by gleuschk at 11:25 AM on April 18, 2007