# Issue with vertical align image in table cell

I have an issue aligning images within a cell vertically. I played a lot with the parameter, but do not get the result I want. Below is my current approach (I hope the images can be accessed to recreate the minimal example):

\documentclass{scrreprt} %scrreprt
\usepackage{graphicx, booktabs}
\renewcommand{\arraystretch}{1.5}

\begin{document}
\begin{table}[h]
\centering
\begin{tabular}{|c|p{.1\textwidth}|p{.7\textwidth}|} %{.9\textwidth}
\hline
\hline
\includegraphics[scale=1]{security_unlock.png}& Login& Show the login screen, where the user should enter his credentials to log on to the system.\\
\hline
\includegraphics[scale=1]{security_lock.png}& Logoff& Log off the current user. A prompt will be shown where the user has to confirm the log off procedure.\\
\hline
\includegraphics[scale=1]{employees-gear.png}& Manage& Opens a formular where the user can manage the user groups and users.\\
\hline
\end{tabular}
\end{table}
\end{document}


As you can see in the result the images in the first column touch the frame of the cell. Moreover there is an ugly gap between the text and the top frame.

I use the package booktabs cause I found in a thread that this should help. Unfortunately it does not...

The example is compiled with xelatex.

with use of the packages adjustbox and tabularx the code is as follows:

\documentclass{scrreprt}
\usepackage[export, demo]{adjustbox}    % in real document delete option "demo"
% for manipulating boxes, among them here is used "valign"
\usepackage{cellspace,                  % for adding vertical space around cells' contents
tabularx}
\setlength\cellspacetoplimit{4pt}
\setlength\cellspacebottomlimit{4pt}
\renewcommand\tabularxcolumn[1]{m{#1}}  % for vertical centering of X cell contents
\usepackage{ragged2e}

\begin{document}
\begin{table}[htb]
\centering
\setkeys{Gin}{width=11mm,height=11mm}   % with real images should be sufficient defined only image width
%
\begin{tabularx}{\linewidth}{|Sc|l|>{\RaggedRight}X|} % "S" add vertical space in column "c"
\hline
\textbf{Menu item}  & \textbf{Caption}  & \textbf{Description} \\
\hline
\includegraphics[valign=c]{security_unlock.png}% "valing=c" move baseline of the image to its middle
the user should enter his
credentials to log on to the
system.               \\
\hline
\includegraphics[valign=c]{security_lock.png}%
& Logoff            & Log off the current user. A
prompt will be shown where
the user has to confirm the
log off procedure.    \\
\hline
\includegraphics[valign=c]{employees-gear.png}%
& Manage            & Opens a formular where the
user can manage the user
groups and users.     \\
\hline
\end{tabularx}
\end{table}
\end{document}


code with added comments should be self explanatory :-). mwe is tested with xelatex and pdflatex:

As shown with the \lipsum commands I inserted, the following improves the vertical situation:

\documentclass{scrreprt}
\usepackage{graphicx}
\usepackage{array}
\usepackage{lipsum}
\renewcommand{\arraystretch}{1.5}

\begin{document}
\begin{table}[h]
\centering
\newlength{\myLength}%
%
\begin{tabular}{%
|>{\centering}m{\myLength}|m{.15\textwidth}|m{.6\textwidth}|}
\hline
\hline
\raisebox{-0.5\height}{%
\includegraphics[scale=1]{security_unlock.png}%
}
the user should enter his
credentials to log on to the
system.\par
\lipsum[1]\\
\hline
\raisebox{-0.5\height}{%
\includegraphics[scale=1]{security_lock.png}%
}
& Logoff          & Log off the current user. A
prompt will be shown where
the user has to confirm the
log off procedure.\par
\lipsum[1]\\
\hline
\raisebox{-0.5\height}{%
\includegraphics[scale=1]{employees-gear.png}%
}
& Manage          & Opens a formular where the
user can manage the user
groups and users.\\
\hline
\end{tabular}
\end{table}
\end{document}


I used the array package because it offers m-type columns in tabular environments, that act like p-type columns but with vertical centering. I used \raisebox{-0.5\height}{...} to include the images, because from TeX's point of view, they are boxes whose reference point is at the lower-left corner of the image, and the vertical centering in our m-type columns seems to care more about the baseline than about the box height (hopefully, some array expert can explain this more precisely and improve the code further).

The booktabs package doesn't make any difference here: its main use is to allow easy insertion of rules of varying widths in tables, and vertical space between table lines. Since you didn't use any of its special commands, you can remove it. I suggest you to read the beginning of its documentation though, because it is very enlightening about how to design a readable table (in short, vertical line [rules] are almost never desirable, and keeping a small number of horizontal rules with varying widths helps convey information to the reader, such are where the table header terminates, how it is structured when there are several levels, etc.).

Note: the table is a bit large for the layout, maybe you could reduce the third column or use the tabularx package.