# Placing graphics/images inside a table

Pictures do not necessarily have to be placed inside the figure environment, but can perfectly be included inside table cells.

The advantage is, you can without any effort arrange a series of images in a matrix and individually scale them. Or, you could combine text with images in a table.

And here is how:

You first need to load the graphicx package to include figures:

\usepackage{graphicx}

\begin{table}[ht]
\caption{A table arranging  images}
\centering
\begin{tabular}{cc}
\includegraphics[scale=1]{graphic1}&\includegraphics[scale=1]{graphic2}\\

\includegraphics[scale=1]{graphic3}&\includegraphics[scale=1]{graphic4}\\
\end{tabular}
\label{tab:gt}
\end{table}

Note: In order to get a visual separation between cells, use \hline instead of \newline or a blank line as in the example. For horizontal separation, use |c|c| instead of cc.

The downside of this technique is obvious, you do not have access to features provided by the figure environment like a label or caption. Nevertheless, it might still come in handy in certain situations.

Note: The figures will not appear in the \listoffigures index, for the reason mentioned above.

Complete minimal working example

\documentclass[11pt]{article}
\usepackage{graphicx, array, blindtext}
\begin{document}
\begin{table}[ht]
\caption{A table arranging  images}
\centering
\begin{tabular}{*{2}{m{0.48\textwidth}}}
\hline
This is some text&\begin{center}\rule{0.4\textwidth}{0.3\textwidth}\end{center}\\
\hline
\blindtext&\begin{center}\rule{0.4\textwidth}{0.3\textwidth}\end{center}\\
\hline
\end{tabular}
\label{tab:gt}
\end{table}
\end{document}

#### 29 Responses to “Placing graphics/images inside a table”

• claudio

It’s cool and sample for covers et all. Tanks. cc

• Arsalan

Thanks a lot

• Juri Strumpflohner

Thanks, exactly what I was searching for.

• Michalis

Cheers, great page and great resource on latex issues overall. It has helped me so many times ;-). Thanks again!

• Shamima

Thanks a lot!!

• Ali

Clean, simple, and to the point! Thank you

• francisco

Thanks a lot!!!!! So easy and so cool

• Arcenio Cornejo Jordán

Finally I read about nice hints to anchor figures. Thanks!

• Mubasher Baig

Very usefull material about image embedding in LATEX.

Thanks

• Ana

I need some help on the use of figures in tables, I have done something like this

\begin{tabular}{cc}
\hspace{0.5em}\scalebox{1.25}{\includegraphics[height=7em]{a.png}} &
\hspace{0.5em}\scalebox{1.25}{\includegraphics[height=7em]{b.png}}
\end{tabular}\\

But I cannot put the captions, wherever I try to use the \caption all I get is errors… Any idea to put properly the captions?

• tom

Hi Ana,

You will not be able to add a caption to your pictures, since the caption has to go in the floating environment like “figure” or “table”. However, it is not possible to add a floating environment into the cell of a table.
In the worst case however, you can try to something like this within your cell, even though it is really bad style:

\parbox{4cm}{\includegraphics[scale=0.1]{image}%
Figure \thefigure: bla%
\addcontentsline{lof}{figure}{Figure \thefigure: bla}}
• 1. Defining a box within the cell
• 2. Add the image to the cell
• 3. Increase the image counter
• 4. Linebreak
• 5. Add a caption
• 6. Add caption to the list of figures

If you want a caption to your “tabular” however, than you simply need to add a floating environment “table” around it.

Cheers,
Tom.

• aran

Just what I needed – thanks!

• dave

awesome! this is super helpful. thanks.

• Brian

You can also wrap your tabular in a figure (at least in TeXLive 2009-7) to get access to a global caption and labels.

\begin{figure}
\caption{A table arranging images}
\centering
\begin{tabular}{cc}
\includegraphics[scale=1]{graphic1}&\includegraphics[scale=1]{graphic2}\\
\newline
\includegraphics[scale=1]{graphic3}&\includegraphics[scale=1]{graphic4}\\
\end{tabular}
\label{tab:gt}
\caption{some caption here}
\end{figure}
• angel

Super! Thank you!

Just for the record, with the \captionof{}{} command of the caption package you can also access the global captions and labels without needing to place your figure in a float environment.

\usepackage{caption}

\centering
\begin{tabular}{cc}
\includegraphics[scale=1]{graphic1}&\includegraphics[scale=1]{graphic2}\\
\newline
\includegraphics[scale=1]{graphic3}&\includegraphics[scale=1]{graphic4}\\
\end{tabular}
\label{tab:gt}
\captionof{figure}{some caption here}
• Mux

Use figure* with tabular in multi-column environments.

• sarvesh

Dear Sir, Is there any command to draw curly bracket in figure environment using latex. I want to use it on two vertical box drawn using

\put(-2,-2){\framebox(2,1)[c]{\shortstack[c]{Detection}}}
\put(-1,-2){\vector(0,-1){1.0}}
\put(-2,-4){\framebox(2,1)[c]{\shortstack[c]{Tracking}}}

• sarvesh

Dear Sir,
Please find herewith the code on which i am working. I wanted to cover the “motion segmentation” and “object classification” block together by using curly bracket to indicate “Human Detection Low-level Vision” statement at right side of curly bracket But i could not do it as the size of curly bracket (using this command {\Bigg\}}) is limited. It just fall short. I want to make it larger to fit according to dimension of my two block as stated above.

\begin{figure}[!htp]
\centering
\setlength{\unitlength}{1.6em}
\begin{picture}(5.000000,11.0000)(-2.000,-9.0000)
\scriptsize
\put(-4.0000,-2.0000){\framebox(5.0000,1.000)[c]{\shortstack[c]{Motion Segmentation}}}
\put(-1.500,-2.000){\vector(0,-1){0.75000}}
\put(1.1,-2.5){\Bigg\}}
\put(1.75,-2.250){\tiny{$Human\;Detection$}}
\put(1.75,-2.650){\tiny{$(Low-level\;Vision)$}}
\put(-4.0000,-3.75000){\framebox(5.0000,1.000)[c]{\shortstack[c]{Object Classification}}}
\put(-1.500,-3.75000){\vector(0,-1){0.75000}}
\put(-4.0000,-5.5000){\framebox(5.0000,1.000)[c]{\shortstack[c]{Human Tracking}}}
\put(-1.500,-5.5000){\vector(0,-1){0.75000}}
\put(1.1,-5.12500){\Big\}}%\bigg\}}
\put(1.75,-5.0){\tiny{$Human\;Tracking$}}
\put(1.75,-5.400){\tiny{$(Intermediate-level\;Vision)$}}
\put(-4.0000,-7.250000){\framebox(5.0000,1.000)[c]{\shortstack[c]{Action Recognition}}}
\put(-1.500,-7.250000){\vector(0,-1){0.75000}}
\put(-4.0000,-9.0000){\framebox(5.0000,1.000)[c]{\shortstack[c]{Semantic Description}}}
\put(1.1,-7.7500){\Bigg\}}
\put(1.75,-7.350){\tiny{$Behavior\;Understanding$}}
\put(1.75,-7.7500){\tiny{$(High-level\;Vision)$}}
\end{picture}
\caption{\small{A general framework of human motion analysis}}
\label{fig:featurebaseddecision}
\end{figure}

Thanks & Regards

• tom

Hi Sarvesh,

I adapted the first brace using TikZ (see code below). You can change the second brace accordingly. You will need to typeset the document twice to get everything right. Cheers, Tom.

\documentclass[11pt]{article}
\usepackage{tikz}
\usetikzlibrary{decorations.pathreplacing}
\begin{document}
\begin{figure}[!htp]
\centering
\setlength{\unitlength}{1.6em}
\begin{picture}(5.000000,11.0000)(-2.000,-9.0000)
\scriptsize
\put(-4.0000,-2.0000){\framebox(5.0000,1.000)[c]{\shortstack[c]{Motion Segmentation}}}
\put(1.0,-1.0){\tikz[remember picture] \node[coordinate, xshift=1em] (n1) {};}
\put(-1.500,-2.000){\vector(0,-1){0.75000}}
\put(-4.0000,-3.75000){\framebox(5.0000,1.000)[c]{\shortstack[c]{Object Classification}}}
\put(-4.0000,-3.75000){\tikz[remember picture] \node[coordinate] (n2) {};}
\begin{tikzpicture}[overlay,remember picture]
\path (n2) -| node[coordinate] (n3) {} (n1);
\draw[thick,decorate,decoration={brace,amplitude=3pt}]
(n1) -- (n3) node[midway, right=5pt, align=left] {Human Detection\\ Low-level Vision};
\end{tikzpicture}
\end{picture}
\end{figure}
\end{document}
• sarvesh

Sir while running the above code i am getting this error..
1.104 \pgfsetplottension{0.5}
?

• tom

Please make sure you have the latest version of PGF/TikZ and TeX and try again.

• sarvesh

Dear Sir,
Thanks a lot for the help. your code is working well on “bare_jrnl.tex V1.3 2007/01/11″ by Michael Shell (http://www.michaelshell.org/).
But its showing error “1.104 \pgfsetplottension{0.5}” while i am trying to compile it with “ieeecls SPECIFICATION FOR COMMON IEEE STYLES” by Gregory L. Plett, Istvan Kollar.

Thank you very much for your guidance and help.

with regards
Sarvesh

• Sanne

Thank you so much!

• burstenj

Hi, thanks for this!

I am trying to place graphics in the last column of a table. The other columns are text, and when I \includegraphics the text in the first three columns ends up at the bottom of the cell, even if I define the cells as paragraph. Is there anything I can do to center the text within the columns?

• tom

Hi!

The array package with it’s column type “m” should do the trick. Best, Tom.

\documentclass[11pt]{article}
\usepackage{array, blindtext}
\begin{document}
\begin{table}[ht]
\caption{A table arranging  images}
\centering
\begin{tabular}{*{2}{m{0.48\textwidth}}}
\hline
This is some text&\begin{center}\rule{0.4\textwidth}{0.3\textwidth}\end{center}\\
\hline
\blindtext&\begin{center}\rule{0.4\textwidth}{0.3\textwidth}\end{center}\\
\hline
\end{tabular}
\label{tab:gt}
\end{table}
\end{document}