Graphics, Figures & TablesVeritically centering Figures and Text in Table

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
annkk85
Posts: 6
Joined: Tue Apr 24, 2012 9:48 pm

Veritically centering Figures and Text in Table

Post by annkk85 »

Dear LaTeX community,

I'm trying to make a table including figures (all same size small drawings) as table entries. However, I can't get the text in the adjacent columns to be horizontally centered towards the figure. The text (the text in the columns "entry" and "text") always ends up aligned with the bottom of the figure.

Here's a MWE, but obviously, it doesn't work without the files for the figures, therefore I also attached the eps files.
Any help would be appreciated! I've just started using TeX and the examples I found so far aren't really helping me.

Code: Select all

\documentclass[11pt,a4paper]{article}
\usepackage{tabularx}
\usepackage{graphicx}
\usepackage{booktabs}

\begin{document}

\begin{table}
\begin{center}
			
\newcolumntype{C}[1]{>{\centering\arraybackslash}p{#1}}

  \begin{tabular}{cC{1.5 cm}rcC{1.5 cm}r}
    \toprule
  entry & picture & text & entry & picture & text\\
    \toprule
    1 & \includegraphics[scale=0.4]{1} 	& \multicolumn{1}{r|}{1\%} & 
    3 & \includegraphics[scale=0.4]{3} & 3\% \\
    2 & \includegraphics[scale=0.4]{2} 	& \multicolumn{1}{r|}{2\%} & 
    4 & \includegraphics[scale=0.4]{4} & 4\% \\
     \bottomrule
  \end{tabular}
  \end{center}	
\end{table}


\end{document}
Attachments
4.eps
(18.72 KiB) Downloaded 304 times
3.eps
(18.72 KiB) Downloaded 308 times
2.eps
(18.72 KiB) Downloaded 289 times
1.eps
(18.72 KiB) Downloaded 302 times
Last edited by localghost on Fri Apr 27, 2012 5:39 pm, edited 2 times in total.

Recommended reading 2024:

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

Learn LaTeX easily with newest books:

The LaTeX Beginner's Guide: 2nd edition and perfect for students writing a thesis

The LaTeX Cookbook: 2nd edition full of practical examples for mathematics, physics, chemistry, and more

LaTeX Graphics with TikZ: the first book about TikZ for perfect drawings in your LaTeX thesis

User avatar
Juanjo
Posts: 657
Joined: Sat Jan 27, 2007 12:46 am

Veritically centering Figures and Text in Table

Post by Juanjo »

Modify the definition of the C descriptor as follows:

Code: Select all

\newcolumntype{C}[1]{>{\centering\arraybackslash}m{#1}}
The m descriptor is introduced in the array package, loaded, in turn, by tabularx.
The CTAN lion is an artwork by Duane Bibby. Courtesy of www.ctan.org.
annkk85
Posts: 6
Joined: Tue Apr 24, 2012 9:48 pm

Re: Veritically centering Figures and Text in Table

Post by annkk85 »

Thank you so much! So simple yet so effective - exactly what I was looking for.
Post Reply