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}
Now you can directly start with your table environment and add figures:
\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}
It’s cool and sample for covers et all. Tanks. cc
Thanks a lot
Thanks, exactly what I was searching for.
Cheers, great page and great resource on latex issues overall. It has helped me so many times ;-). Thanks again!
Thanks a lot!!
Clean, simple, and to the point! Thank you š
Thanks a lot!!!!! So easy and so cool
Finally I read about nice hints to anchor figures. Thanks!
Very usefull material about image embedding in LATEX.
Thanks
I need some help on the use of figures in tables, I have done something like this
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?
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:
If you want a caption to your “tabular” however, than you simply need to add a floating environment “table” around it.
Cheers,
Tom.
how to reference image inside table? I use \label for image inside table but it refer to the table instead..
Hi Axle,
Thanks for this question. You need a caption to reference the figure, because the caption displays the figure number. Below is the example from the article with the caption added. I’m using the caption package which provides the
captionof
command.HTH, Tom
Just what I needed – thanks!
awesome! this is super helpful. thanks.
You can also wrap your tabular in a figure (at least in TeXLive 2009-7) to get access to a global caption and labels.
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.Thanks!
Use figure* with tabular in multi-column environments.
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
Please suggest me.
Hi Sarvesh,
Please provide a minimal example that I can copy and paste into my editor. It will help me understand what you are trying to do. In the meantime, you may want to consider the PGF/TikZ package. You may find this question on SX useful.
Best, Tom.
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.
Please help me to get desired output.
Thanks & Regards
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.
Sir while running the above code i am getting this error..
1.104 \pgfsetplottension{0.5}
?
Please make sure you have the latest version of PGF/TikZ and TeX and try again.
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
Thank you so much!
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?
Hi!
The array package with it’s column type “m” should do the trick. Best, Tom.
Thanks! That fixed it.
Hi sir,
i’ve tried using the
m{0.3\textwidth}}
command. but it only works on its own. when i tried usingc | c | c
to justify it, it automatically becomes bottom alligned again.I am writing for 2 column paper (IEEE template) and without the
c | c | c
, it becomes spans to the width of the whole page rather than just the columnhere’s my code:
See the updated code below for a possible fix. Just two notes for clarification:
tabular
with amsmathalign
environment. It’s nicer to have formulas in a math environment and saves a few $-signs.\begin{tabular}{|l|m{0.3\textwidth}|m{0.3\textwidth}|}
.Was having some HTML formatting issues, sorry for that. Everything should be fine now and you can copy-paste the code.
Thanks! i’ll give it a try
Great, let me know if you have further questions…
Tom
this fixed my problem.
thanks again. Learn something new today.
Regards.
Clement
Great, glad it worked! Cheers, Tom.
Thank you very much for the tutorial. But I have problem when vertically aligning the images inside the table column.
I need my image to be aligned to the top(Where the text starts). But how to do that. My code looks like this
Hi there,
The example below should do the trick.
HTH, Tom