# vertically center image in longtable

I have a longtable with \cline borders. Unfortunately, the image in the second column is not vertically centered. I even fail in changing the vertical position any way. I found this similar question: Vertically center image with respect to longtable paragraph

But changing p and m parameter doesn't seem to have an influence.

Here is my minimal working example:

\documentclass[a4paper]{scrreprt}
\usepackage[utf8]{inputenc}
\usepackage[ngerman,english]{babel}
\usepackage[T1]{fontenc}
\usepackage{mwe}
\usepackage{longtable}
\usepackage{array}

\begin{document}

\begin{longtable}{m{0.06\textwidth}p{0.3\textwidth}m{0.05\textwidth}m{0.05\textwidth}m{0.05\textwidth}m{0.05\textwidth}m{0.05\textwidth}m{0.05\textwidth}}
%    \begin{longtable}{p{0.06\textwidth}m{0.3\textwidth}m{0.05\textwidth}m{0.05\textwidth}m{0.05\textwidth}m{0.05\textwidth}m{0.05\textwidth}m{0.05\textwidth}} % doesn't work either
Index & Figure & bla & bla & bla & bla & bla & bla\\
\cline{2-8}
1      & \includegraphics[width=0.2\linewidth]{example-image-a} & bla & bla & bla & bla & bla & bla \\
\cline{2-8}
2      & \includegraphics[width=0.2\linewidth]{example-image-a} &  bla & bla & bla & bla & bla & bla  \\
\cline{2-8}
3  & \includegraphics[width=0.2\linewidth]{example-image-a} & bla & bla & bla & bla & bla & bla \\
\cline{2-8}
\end{longtable}
\end{document}


The output looks like:

It seems that there is a higher bottom margin. How can I center the image vertically (and also the text as it seems that the text is too low)?

I always suggest \cmidrule from booktabs, since it adds a nice amount of vertical spacing. Here the trick is to lower a bit the graphics:

\documentclass[a4paper]{scrreprt}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[ngerman,english]{babel}
\usepackage{longtable}
\usepackage{array}
\usepackage{booktabs}
\usepackage{graphicx}

\newcommand{\lowincludegraphics}[2][]{%
\raisebox{-0.7\dp\strutbox}{\includegraphics[#1]{#2}}%
}

\begin{document}

\begin{longtable}{
c
m{0.3\textwidth}
*{6}{c}
}
Index & Figure & bla & bla & bla & bla & bla & bla\\
\cmidrule{2-8}
1 & \lowincludegraphics[width=0.2\linewidth]{example-image-a} &
bla & bla & bla & bla & bla & bla \\
\cmidrule{2-8}
1 & \lowincludegraphics[width=0.2\linewidth]{example-image-a} &
bla & bla & bla & bla & bla & bla \\
\cmidrule{2-8}
1 & \lowincludegraphics[width=0.2\linewidth]{example-image-a} &
bla & bla & bla & bla & bla & bla \\
\cmidrule{2-8}
\end{longtable}

\end{document}


• Thanks for all three answers/comments @egreg, Bernard, leandriis. I tried all three suggestions. The comment from leandriis is incorporated in the answer from Bernard. Finally, I decided to combine the answers. Now I use ’\cmidrule’ together with the suggestions from Bernard. The suggestions from leandriis' comment alone center the figure but without space and I would prefer some more space as by Bernard's and egreg's solutions. So, thanks again for your help and useful suggestions! Oct 28 '18 at 19:16

Here is a proposition: replace the 2nd column specifier m{0.3\textwidth} with Sc, where S is a pre-column specifier defined by package cellspace which ensures a minimal vertical spacing at the top and bottom of cells in the column, and load adjustbox. If you load siunitx , which already defines an S column type, replace S with C:

\documentclass[a4paper]{scrreprt}
\usepackage[utf8]{inputenc}
\usepackage[ngerman,english]{babel}
\usepackage[T1]{fontenc}
\usepackage{mwe}
\usepackage{longtable}
\usepackage{array}
\usepackage{cellspace, booktabs}
\setlength{\cellspacetoplimit}{3pt}
\setlength{\cellspacebottomlimit}{3pt}

\begin{document}

\begin{longtable}{m{0.06\textwidth}Sc m{0.05\textwidth} *{6}{m{0.05\textwidth}}}
Index & Figure & bla & bla & bla & bla & bla & bla\\
\cline{2-8}
1 & \includegraphics[width=0.2\linewidth, valign = c]{example-image-a} & bla & bla & bla & bla & bla & bla \\
\cline{2-8}
2 & \includegraphics[width=0.2\linewidth, valign = c]{example-image-a} & bla & bla & bla & bla & bla & bla \\
\cline{2-8}
3 & \includegraphics[width=0.2\linewidth, valign = c]{example-image-a} & bla & bla & bla & bla & bla & bla \\
\cline{2-8}
\end{longtable}

\end{document}