Graphics, Figures & TablesAligning images in tabular environment

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
shiricon
Posts: 2
Joined: Mon Jan 18, 2010 4:57 am

Aligning images in tabular environment

Post by shiricon »

I am having an issue.

Have 3 images two (Image 1 & 3) that are square and one (Image 2) that is vertically long. I would like to stack the square images on the left side and the long image on the right. I tried to do this with a tabular environment inside a figure environment and then use multirow in the right column, but the alignment of the right image is not centering itself in the right column.

I tried to do this with the following code:

Code: Select all

\begin{figure}[p!] \centering
\begin{tabular}{cc}
\subfloat[Tantalum Press]{\label{Tapress}\includegraphics[width=0.30\textwidth]{Tapress}} & \multirow{2}{*}{\subfloat[Arc welder]{\label{Arcweld}\includegraphics[width=0.45\textwidth]{Arcweld}}} \\
\subfloat[Copper blocks with steel "clamps"]{\label{Cublock}\includegraphics[width=0.30\textwidth]{Cublock}} & 
\end{tabular}
\isucaption{CAPTION GOES HERE}
\end{figure}

The output looks like this.
The output looks like this.
Latex problem.png (174.31 KiB) Viewed 2818 times
Please help me fix this code, I have been trying to fix it for 5 hours now.
Last edited by shiricon on Mon Jan 18, 2010 5:03 pm, edited 1 time in total.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

php1ic
Posts: 192
Joined: Wed Jan 28, 2009 8:17 pm

Aligning images in tabular environment

Post by php1ic »

You can use a nested table and the m{width} column specifier that is provided by the array package and vertically aligns the contents of a cell

Code: Select all

\documentclass{article}
\usepackage{array,graphicx,subfig}
\begin{document}
\begin{figure}[htb]
\centering
\begin{tabular}{m{0.30\textwidth}m{0.45\textwidth}}
\begin{tabular}{m{0.30\textwidth}}
\subfloat[small]{\includegraphics[width=0.3\textwidth]{file1}}\\
\subfloat[small]{\includegraphics[width=0.3\textwidth]{file2}}
\end{tabular}&\subfloat[large]{\includegraphics[width=0.3\textwidth]{file3}}
\end{tabular}
\caption{Big caption}
\end{figure}
\end{document}
shiricon
Posts: 2
Joined: Mon Jan 18, 2010 4:57 am

Re: Aligning images in tabular environment

Post by shiricon »

Absolutely brilliant... Thank you so much!

This actually solved the other problem I was having in that I wanted the large image to be image (c), and the way I was doing it the image was being labeled (b).

I had resigned myself to just be happy if I could get it to work and not care what it was (a), (b) or (c).

Thank you, thank you, thank you... you solved the problem I had and you solved the other problem I hadn't even mentioned :).
Post Reply