2

I am trying to put together a table with both images and text, but I keep having problems to get the vertical alignment right. Ideally I would like to have both the text and images in the centre of the cells.

My original code is:

\begin{table}[t]
\begin{center}
\begin{tabular}{| c | c | c | c | c |}
\hline   
    \textbf{Approach} & \textbf{Pure translation} & \textbf{120\degree bend} & \textbf{135\degree twist} & \textbf{70\degree bend} \\
\hline 
Original & \includegraphics[scale=0.1] {figure1.jpg} & \includegraphics[scale=0.1] {figure1.jpg} & & \\
\hline
\end{tabular}
\end{center}
\caption{Hello}
\end{table}

Which gives me this result:

enter image description here

I have tried using \raisebox like this:

\begin{table}[t]
\begin{center}
\begin{tabular}{| c | c | c | c | c |}
\hline   
    \textbf{Approach} & \textbf{Pure translation} & \textbf{120\degree bend} & \textbf{135\degree twist} & \textbf{70\degree bend} \\
\hline 
Original & \raisebox{-\totalheight}{\includegraphics[scale=0.1] {figure1.jpg}} & \raisebox{-\totalheight}{\includegraphics[scale=0.1] {figure2.jpg}} & & \\
\hline
\end{tabular}
\end{center}
\caption{Hello}
\end{table}

But the result is still not satisfactory:

enter image description here

Using a \parbox for the text column doesn't do the trick either...

3

You raised by \totalheight but you want center so use .5\totalheight actually you may want a bit less as that puts the baseline in the centre and then the text will sit on that baseline so might nook a bit high, but you can lower the text with \raisebox around Original with a value around 0.5\baselineskip or whatever looks right, fine tuning requires visual perception of the shape of the image and of the letters...

3

One solution

\documentclass[]{article}%
\usepackage{graphicx}
\usepackage{array,booktabs,calc}
\begin{document}

\begin{center}
\begin{tabular}{| m{.3\textwidth} | m{.3\textwidth} | m{.3\textwidth} |}
\hline   
    \textbf{Approach} & \textbf{Pure translation} & \textbf{120 bend} \\
\hline 
Original & \includegraphics[scale=1] {figure1.jpg} & \includegraphics[scale=1] {figure1.jpg}\\
\hline
\end{tabular}
\end{center}
\end{document}

enter image description here

and another is to use the \raisebox see How to vertically center text with an image in the same row of a table

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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