# Align text and image in table

My table looks like this:

The left column will contain words, like it is now, and in the right column I want to add these small pictures (some are a bit bigger than this one) in every row.

I have two problems however, as can be seen from the image linked:

1. how do I center the text of the first column properly? Tight now it is a bit pushed to the bottom of the field.

2. how do i center the image in the field? Right now it is pushed against the top wall of the table.

My code looks like this:

\begin{table}[h]
\centering
\begin{tabular}{l|l}
\textbf{Verb}   & \textbf{Example}   \\ \hline
goes-to''         & \includegraphics[scale=1]{images/appendix/B/1.png} \\ \hline
walks-to''        &     \\ \hline
says to''         &        \\ \hline
chats to''        &
\end{tabular}
\caption{My caption}
\label{my-label}
\end{table}


Here is a solution with some vertical padding. The cellspace package is done for that: it defines a minimal vertical spacing at the top and the bottom of cells in columns with a specifier prefixed with S. With the makecell package, you can have line breaks in cells, thus allowing for several aimges in a single cell:

\documentclass{article}
\usepackage{cellspace, graphicx, makecell}
\renewcommand\cellspacetoplimit{3pt}
\renewcommand\cellspacebottomlimit{3pt}
\newcommand\rowincludegraphics[2][]{\raisebox{-0.45\height}{\includegraphics[#1]{#2}}}
\begin{document}
\begin{table}[h]
\centering
\begin{tabular}{c|Sl}
\textbf{Verb} & \textbf{Example} \\ \hline
goes-to'' & \rowincludegraphics[scale=0.1]{loupnorstein2} \\ \hline
walks-to'' & \rowincludegraphics[scale=0.1]{loupnorstein2} \\ \hline
says to'' & \rowincludegraphics[scale=0.1]{loupnorstein2} \\ \hline
chats to'' & \makecell{\rowincludegraphics[scale=0.1]{loupnorstein2}\\[3.8ex]\rowincludegraphics[scale=0.1]{loupnorstein2}}
\end{tabular}
\caption{My caption}
\label{my-label}
\end{table}
\end{document}


• I added an example code of two images in a cell, but for some reason, the snpshot I include doesn't display. – Bernard Apr 16 '15 at 21:36

You can use adjustbox package with export option. With this, you will get valin= as a key to \includegraphics. valign=c will do what you want.

\documentclass{article}
\usepackage{array}
\begin{document}
\begin{table}[h]
\centering
\setlength{\extrarowheight}{1em}
\begin{tabular}{c|l}
\textbf{Verb}   & \textbf{Example}   \\ \hline
goes-to''         & \includegraphics[scale=0.1,valign=c]{example-image-a} \\[1em] \hline
walks-to''        & \includegraphics[scale=0.1,valign=c]{example-image-a}    \\[1em] \hline
says to''         &  \includegraphics[scale=0.1,valign=c]{example-image-a}      \\[1em] \hline
chats to''        &\includegraphics[scale=0.1,valign=c]{example-image-a}
\end{tabular}
\caption{My caption}
\label{my-label}
\end{table}
\end{document}


• Thank you. Does exactly what you said. However is there also a possibility to add like a couple of mm on the top and bottom? I don't really want it sticked to the top and bottom, i want a bit of free space. Thank you for your time – Dennis Apr 16 '15 at 16:21