# How to insert images in a table's colum?

I want to display my testing on some images. And i want to display it in the table. so the table has 3 column. first : number 2nd: image 3rd:sentence

  \begin{table}[!h]
\centering
\caption{Properties} \begin{tabular}{|c|c|c|}
\hline
1. & \begin{figure}[!h]
\begin{center}
\includegraphics[width=3.5cm, height=3.5cm]{EPS_Thesis_Farhat/Plat_sukses/B5IB.eps}
\end{center}
\end{figure} & sentence\tabularnewline
\hline
\end{tabular}
\label{Properties in Regionprops}
\end{table}


How to do it??

-
delete \begin{figure}[!h]\begin{center} and \end{center}\end{figure} You can not use (nor do you want) a figure environment inside a tabular or table environment. – David Carlisle Aug 30 '13 at 14:48

• You don't really need a floating object (like figure) here. And it's not allowed to nest floating environments.

• By default, if you use \includegraphics, the baseline is located at the bottom of the image; to get the desired vertical alignment, I used the adjustbox package and its \adjustbox command with the valign=c option.

• I used the booktabs package to have better looking tables; in particular, the use of vertical rules is discouraged (this is, of course, optional).

• The numbering in the first column is automatically produced with the help of a counter.

• If the text in the third column is long, perhaps you'll need a

>{\centering\arraybackslash}p{<length>}


column instead of just a c column.

• Please do not use [!h] as placement specifier for your floating objects; this is so restrictive that it's a recipe for disaster. Use a less restrictive option or, better yet, not option at all.

The code:

\documentclass{article}
\usepackage{array}
\usepackage{booktabs}
\usepackage{graphicx}

\newcounter{myrow}

\begin{document}

\begin{table}
\centering
\caption{Properties}
\label{Properties in Regionprops}
\begin{tabular}{>{\stepcounter{myrow}\themyrow.}ccc}
\toprule
&
&
sentence \\[1.57cm]
\midrule
&
&
sentence \\[1.57cm]
\midrule
&
&
sentence \\[1.57cm]
\bottomrule
\end{tabular}
\end{table}

\end{document}


If, for some reason, adjustbox cannot be used, you can go with \raisebox:

\documentclass{article}
\usepackage{array}
\usepackage{booktabs}
\usepackage{graphicx}

\newcounter{myrow}
\newcommand\RaiseImage[2][scale=1]{%
\raisebox{-0.5\totalheight}{\includegraphics[#1]{#2}}}

\begin{document}

\begin{table}
\centering
\caption{Properties}
\label{Properties in Regionprops}
\begin{tabular}{>{\stepcounter{myrow}\themyrow.}ccc}
\toprule
&
\RaiseImage[width=3.5cm, height=3.5cm]{example-image-a}
&
sentence \\[1.57cm]
\midrule
&
\RaiseImage[width=3.5cm, height=3.5cm]{example-image-b}
&
sentence \\[1.57cm]
\midrule
&
\RaiseImage[width=3.5cm, height=3.5cm]{example-image-c}
&
sentence \\[1.57cm]
\bottomrule
\end{tabular}
\end{table}

\end{document}


In a comment it has been requeste to have the table with the original vertical rules:

\documentclass{article}
\usepackage{array}
\usepackage{graphicx}

\newcounter{myrow}
\newcommand\RaiseImage[2][scale=1]{%
\raisebox{-0.5\totalheight}{\includegraphics[#1]{#2}}}

\begin{document}

\begin{table}
\centering
\caption{Properties}
\label{Properties in Regionprops}
\begin{tabular}{|>{\stepcounter{myrow}\themyrow.}c|c|c|}
\hline
&
\RaiseImage[width=3.5cm, height=3.5cm]{example-image-a}
&
sentence \\
\hline
&
\RaiseImage[width=3.5cm, height=3.5cm]{example-image-b}
&
sentence \\
\hline
&
\RaiseImage[width=3.5cm, height=3.5cm]{example-image-c}
&
sentence \\
\hline
\end{tabular}
\end{table}

\end{document}


-
i use winedt. and \usepackage{adjustbox} is not supported. What i have to do? – Farhat Mann Aug 30 '13 at 15:37
@FarhatMann You have two options: 1) use the package manager of your LaTeX distribution to install the package. 2) Use the second approach in my updated answer which doesn't depend on adjustbox. – Gonzalo Medina Aug 30 '13 at 15:45
How to add line at between each column and in the left and the right side. Like an table? That code doesn't have a line to separate each column in the displayed table. – Farhat Mann Aug 30 '13 at 16:01
@FarhatMann simply use your original format for the tabular; see last code in my updated answer. – Gonzalo Medina Aug 30 '13 at 16:07
I had use the code, but the left side is not has the line.. How about to add the tittle in each column? i had try this code, but it has errors.. \begin{table} \centering \caption{Properties} \label{Recognition System's Results} \begin{tabular}{>{\stepcounter{myrow}\themyrow.}{|c|c|c|} No. & Modul & Page's Name \tabularnewline \hline – Farhat Mann Aug 30 '13 at 16:23

Since you are not interested in getting a legend or whatever, you should first try to remove the figure environment. The center environment is not needed either, since you already center your table elements (the c properties of your tabular). Besides, I am not sure you want (or can) have these kind of environment embedded in your table environment

\begin{table}[!h]
\centering
\begin{tabular}{|c|c|c|}
\hline
1. &
\includegraphics[width=3.5cm, height=3.5cm]{EPS_Thesis_Farhat/Plat_sukses/B5IB.eps} &
sentence\tabularnewline
\hline
\end{tabular}
\caption{Properties}
\label{Properties in Regionprops}
\end{table}

-
How to make the number and the sentences is locate in center (aligned with the image.) not in bottom of the table? What i had to do? I have add "[topsep=0pt]", but it doesn't work right. – Farhat Mann Aug 30 '13 at 15:00