Graphics, Figures & TablesAlignment in tables

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
theo moore
Posts: 72
Joined: Thu Jan 15, 2009 3:16 pm

Alignment in tables

Post by theo moore »

I have tables in which, certain cells have pictures (say, created using pgf/tikz, but I suppose this would also apply to \includegraphics commands). Unfortunately, it seems I can't get the vertical alignment to work out. For example, in the following:

Code: Select all

\begin{tabular}{cc}
 column 1 & column 2 \\ \hline
 
 See how this is not vertically centered? & 
     \begin{tikzpicture}
        \draw (0,0) rectangle (5cm, 1cm);
        \draw[] (2cm,0.5cm) node {Neither is this rectangle};
     \end{tikzpicture}
  \\ \hline
  Moo & Boo
\end{tabular}
We have a 2x2 table with a figure in the (1,2) cell. Unfortunately, everything in the first row (text and picture) are bottom-aligned. How do you fix that?

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

theo moore
Posts: 72
Joined: Thu Jan 15, 2009 3:16 pm

Re: Alignment in tables

Post by theo moore »

I tried the pgflist as well, but nobody had an answer.

Bump! Any ideas?
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Alignment in tables

Post by localghost »

Perhaps the array package is already sufficient. If not, try the makecell package. Read the manuals and make a first approach on your own.


Best regards
Thorsten
theo moore
Posts: 72
Joined: Thu Jan 15, 2009 3:16 pm

Alignment in tables

Post by theo moore »

localghost wrote:Perhaps the array package is already sufficient. If not, try the makecell package. Read the manuals and make a first approach on your own.


Best regards
Thorsten
You're right, and I ended up not using the array package, but rather the tabularx package. In searching for the solution, I stumbled across this article, which is nice tutorial on modifying tables in latex.

In my case, the important thing was to use columns with vertically centered entries.
Post Reply