# Add image and line break within a table

I want to create a rather mysterious table with both a line brake in a single row and an image. You understand that I cannot use a new row without \hline because I want to add an image at the same row. I tried with \newline within the cell but it didn't work.

The code that I using is

\documentclass{article}
\usepackage{graphicx}
\usepackage{multicols}
\begin{document}
\begin{table}[H]
\centering
\begin{tabular}{|l|l|c|}
\hline
\multicolumn{1}{|c|}{\textbf{\eng{NIM}}} & \multicolumn{1}{c|}{\textbf{Χρήσιμα}} &     \textbf{Εικόνα}\\
\multicolumn{1}{|c|}{\textbf{\eng{Module}}} & \multicolumn{1}{c|}    {\textbf{Χαρακτηριστικά}} & {}\\
\hline
PSU \newline CAEN N1470 & $4$ channels \newline Positive/Ouput Polarity &         \includegraphics[height=\columnheight]{N1470.jpg}\\
\hline
\end{tabular}
\caption{}
\label{tab:}
\end{table}
\end{document}


I've only added one row in the MWE just to make it as simple as possible. Note that \newline does nothing actually on that very code and \columnheight is not recognised at all.

Any ideas on that?

-

You can use \parboxes of the required width:

\documentclass{article}
\usepackage{graphicx}

\begin{document}

\begin{table}
\centering
\begin{tabular}{|l|l|c|}
\hline
\parbox{3cm}{PSU \\ CAEN N1470}
& \parbox{3cm}{$4$ channels \\ Positive/Ouput Polarity}
& \raisebox{-0.5\height}{\includegraphics[height=2.5cm]{ctanlion}} \\
\hline
\end{tabular}
\caption{}
\label{tab:}
\end{table}

\end{document}


Regarding \columnheight it is not a standard length, so it won't be recognized.

Using the optional argument for \parbox and the adjustbox package, one can easily comtrol the vertical alignment of the text and the image:

\documentclass{article}
\usepackage{graphicx}

\begin{document}

\begin{table}
\centering
\begin{tabular}{|l|l|c|}
\hline
\parbox[t]{3cm}{PSU \\ CAEN N1470}
& \parbox[t]{3cm}{$4$ channels \\ Positive/Ouput Polarity}
\hline
\parbox{3cm}{PSU \\ CAEN N1470}
& \parbox{3cm}{$4$ channels \\ Positive/Ouput Polarity}
\hline
\parbox[b]{3cm}{PSU \\ CAEN N1470}
& \parbox[b]{3cm}{$4$ channels \\ Positive/Ouput Polarity}
\hline
\end{tabular}
\caption{}
\label{tab:}
\end{table}

\end{document}


CTAN lion drawing by Duane Bibby.

-
Thank you very much for your comment! Youw solution is partially working. I made some changes, like \parbox[][][c]{2.5cm}{PSU \\ CAEN N1470} instead of \parbox{2.5cm}{PSU \\ CAEN N1470} because text was placed on cell's bottom. The trichy thing is the image... If I use your code, it is placed in the bottom of the cell which is not beautiful. I tried to use a parbox again (something like \parbox[][][c]{2.5cm}{\includegraphics[height=1cm]{N1470.jpg}}) but in that case it is placed on the left of the cell, which is again not pretty... –  Thanos Oct 7 '12 at 16:08
@Thanos did you see my updated answer? Using \raisebox for the image you can get the desired alignment. –  Gonzalo Medina Oct 7 '12 at 16:10
I didn't check...Sorry! I tried to inlude the \includegraphics{} within center enviroment. The output is really good but there are those ugly spaces around that \begin{center} adds. I also tried your raisebox which is really good, however the image touches the line below. In addition if I increase image's height, it will be printed in fornt of the upper cell line. –  Thanos Oct 7 '12 at 16:18
@Thanos I updated my answer with anew option. –  Gonzalo Medina Oct 7 '12 at 16:24
@Thanos seems like you have an outdated version of some packages(s) (particularly adjustbox). Try updating the package (or even better, your LaTeX system). –  Gonzalo Medina Oct 7 '12 at 16:48