place multiple images on one line in latex (or even create a matrix of images)
May 16th, 2006 by Lawrence David
to tile images in a figure, use the following code:
\begin{figure}[h]
\begin{center}$
\begin{array}{cc}
\includegraphics[width=2.5in]{image1.jpg} &
\includegraphics[width=2.5in]{image2.jpg}
\end{array}$
\end{center}
\caption{my caption}
\end{figure}
to place more than 2 images on a line, add extra ‘c’s to the {array} specification and follow each \includegraphics[]{} with an ampersand (&). to create a matrix of images, insert newlines using two slashes: for instance, to make a 2X2 matrix of images:
\begin{figure}[h]
\begin{center}$
\begin{array}{cc}
\includegraphics[width=2.5in]{image1.jpg} &
\includegraphics[width=2.5in]{image2.jpg} \\ \includegraphics[width=2.5in]{image1.jpg} &
\includegraphics[width=2.5in]{image2.jpg}
\end{array}$
\end{center}
\caption{my caption}
\end{figure}
Hey man, good website with very useful information on latex.
Good luck with your PhD in MIT.
Bidur Khanal
Research student
University if southampton, UK
Hello Man,
Thanks for the nice code.
All the best.
Charles
You mention it in the main text of your message, but it is not in the code - that you need two slashes (\), code only has one
Works great then.
thanks for catching that - i’ve updated the code!
Why don’t you use the tabular environment? It works just like array, but it doesn’t need to be in math mode (i.e. no surrounding dollars).
Also, try the subfig package: http://tug.ctan.org/cgi-bin/ctanPackageInformation.py?id=subfig
its 30°C in my office. i finish this report or it finishes me. thanx for the code.
Great one thank you. It really eased my pain.
I wonder if there is some code for placing images like:
[image]
[image] [image]
I could not make this by playing with your code.
Reply to myself for three images: one centered on top, the two below, again centered:
\begin{figure}[H]
\begin{center}
\subfloat{\includegraphics[width=2cm]{image1.png}} \\
\subfloat{\includegraphics[width=2cm]{image2.png}}
\subfloat{\includegraphics[width=2cm]{image3.png}}
\end{center}
\end{figure}
thanks tolga, i didn’t know that!
How a bout this ?
[image] [ one ]
big
[image] [ image ]
couldn’t do it at all
Thanks Lawrence and the other commenters. This is a great tip.
Hello sir,
Do you know how to put two figures top-down tightly, without any space between them. I tried several different method. The array method mention here
get the large space between the two figures.
Many thanks!
\begin{figure}[h]
\begin{center}$
\begin{array}{c}
\includegraphics[width=2.5in]{64_1_2.eps} \\
\includegraphics[width=2.5in]{64_1_2.eps}
\end{array}$
\end{center}
\caption{my caption}
\end{figure}
Great tip! I’ve always wanted to know how to combine multiple images into one figure - no more minipage then