Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

On page 6 in this PDF is there a table with centred pictures in the right column.

enter image description here

Does anyone know how to make such a table?

I am using pdflatex.

share|improve this question
    
    
See also tex.stackexchange.com/questions/8461/… –  morbusg Nov 9 '11 at 16:46

3 Answers 3

up vote 6 down vote accepted

You need to change the baseline of the images. Usually you center it to the height of the lower case characters (1ex). This can be done using the \raisebox macro or using the valign=m key of the adjustbox package.

See also How to align picture top left in a table? and float left figure in titlepage which are similar.

Here my code which also shows some of the other elements like bold math and stacking:

\documentclass{article}

\usepackage{adjustbox}
\usepackage{booktabs}
\usepackage{amsmath}

\providecommand{\textsubscript}[1]{%
    \mbox{$_\text{#1}$}%
}

\newcommand{\mystack}[1]{%
   \mbox{$
    \vcenter{%
        \hbox{\shortstack{#1}}%
    }%
    \mathsurround=0pt
   $}
}


\begin{document}

\begin{tabular}{ccccc}
    \toprule
    \bfseries Scalar mode & 
    \bfseries Vector mode & 
    \bfseries Degeneracy & 
    $\mathbf{n_{\text{\bfseries eff}}}$ & 
    \bfseries Near field ($\mathbf{S_Z}$) \\
    \midrule
    LP\textsubscript{01} &
    HP\textsubscript{11} &
    2 & 1.44398 & \adjustimage{height=2cm,valign=m}{image1} \\
    LP\textsubscript{11} &
    \mystack{%
        HP\textsubscript{11} \\
        TE\textsubscript{01} \\
        TM\textsubscript{01}
    } &
    4 & 1.44381 & \adjustimage{height=2cm,valign=m}{image2} \\
    .. \\
    \midrule
    \multicolumn{5}{c}{\bfseries Originally cladding modes} \\
    \midrule
    .. \\
    \bottomrule
    \multicolumn{5}{l}{%
        *The LP\textsubscript{31} is four-fold ...
    }\\
\end{tabular}

\end{document}

Result

share|improve this answer

There are a range of approaches to vertically-centring material. The LaTeX3 'coffin' concept makes this pretty easy to achieve:

\documentclass{article}
\usepackage[demo]{graphicx}
\usepackage{xcoffins}
\NewCoffin\tablecoffin
\NewDocumentCommand\Vcentre{m}
  {%
    \SetHorizontalCoffin\tablecoffin{#1}%
    \TypesetCoffin\tablecoffin[l,vc]%
  }
\begin{document}
\begin{tabular}{ccc}
 \Vcentre{A} & \Vcentre{B} & 
   \Vcentre{\includegraphics[width = 1 cm, height = 1 cm]{demo}}
\end{tabular}
\end{document}

The idea here is that the 'coffin' is places such that it's vertical centre is in line with the current baseline, while it is horizontally placed at the current insertion point. (I have used the demo option for the graphicx package so that something appears: the black blob. For a real document, this is not needed.)

As Mark has already said, for the rules booktabs is the way to go.

share|improve this answer
    
xcoffins has documentation now! Excellent. I've been waiting for this... –  Seamus Nov 9 '11 at 15:16
    
Wow, didn't know about xcoffins. This always bothered me a bit. Time to do some reading... –  qubyte Nov 9 '11 at 15:34
    
We're still not 100% sure on the best user interface, hence xcoffins being 'l3experimental'. Feedback most welcome :-) –  Joseph Wright Nov 9 '11 at 17:48

You'll get pretty close output for the table itself with the booktabs package. As for the images, a straightforward \includegraphics should do the trick.

\usepackage[demo]{graphicx}
\usepackage{booktabs}
\usepackage{array}

\begin{document}
\begin{tabular}{m{1.5cm}m{1.5cm}m{1.5cm}}
\toprule
Header 1 & Header 2 & Header 3\\
\midrule
One & Two & \includegraphics[width=1cm, height=1cm]{fig1}\\
Three & Four & \includegraphics[width=1cm, height=1cm]{fig2}\\
\bottomrule
\end{tabular}
\end{document}

Produces this:

enter image description here

share|improve this answer
    
Just remember to fix the width or height of each image to make them look consistent. –  qubyte Nov 9 '11 at 14:32

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.