I have a table with two columns. The first column contains text, the second a image. Short example:
\documentclass{article}
\begin{document}
\begin{table}[htbp]
\centering
\caption{My caption}
\label{tab:mytab}
\begin{tabular}{|p{1.0cm}|c|}
\hline
\textbf{Number} & \textbf{Images} \\ \hline
Nr. 1 & \raisebox{.5\totalheight}{\includegraphics[width=0.8\textwidth]{foo}} \\ \hline
Nr. 2 & \raisebox{.5\totalheight}{\includegraphics[width=0.8\textwidth]{foo}} \\ \hline
\end{tabular}
\end{table}
\end{document}
I want to center the text and image vertically and horizontally. Does anyone know how to do this?
Best Answer
With help of package
adjustbox
you can obtain:In the first row the margin above and below picture is added, in the second row the image is without added margins. The code:
Addendum: If you like to have horizontally centered contents also in the first table's column, than the following changes are necessary:
\usepackage{array}
p{...}
should be replaced by>{\centering}p{...}