Feed on
Posts
Comments

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}


Bookmark and Share

if that was helpful ...

check out the other tips and tricks i've compiled on these pages. you might learn something else interesting!

48 Responses to “place multiple images on one line in latex (or even create a matrix of images)”

  1. on 10 Jul 2006 at 1:58 pm Anonymous

    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

  2. on 29 Jul 2006 at 5:01 pm Anonymous

    Hello Man,

    Thanks for the nice code.

    All the best.
    Charles

  3. on 09 Aug 2006 at 9:33 am Anonymous

    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.

  4. on 13 Aug 2006 at 9:12 pm Lawrence David

    thanks for catching that – i’ve updated the code!

  5. on 03 Dec 2006 at 5:46 pm Max

    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

  6. on 23 Jul 2007 at 12:29 pm zoltan

    its 30°C in my office. i finish this report or it finishes me. thanx for the code.

  7. on 30 Dec 2007 at 5:06 am Tolga

    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.

  8. on 30 Dec 2007 at 5:26 am Tolga

    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}

  9. on 06 Jan 2008 at 11:57 am Lawrence David

    thanks tolga, i didn’t know that!

  10. on 30 Mar 2008 at 1:01 pm evenfall

    How a bout this ?

    [image] [ one ]
    big
    [image] [ image ]

    couldn’t do it at all

  11. on 24 Apr 2008 at 4:14 pm Kate

    Thanks Lawrence and the other commenters. This is a great tip.

  12. on 02 Jul 2008 at 10:16 pm Jianzhou Li

    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}

  13. on 25 Aug 2008 at 8:07 am Stephen

    Great tip! I’ve always wanted to know how to combine multiple images into one figure – no more minipage then :)

  14. on 08 Jan 2009 at 10:16 pm Bryant Durham

    hi
    bardlpm2r07q0uct
    good luck

  15. on 12 Jan 2009 at 11:08 am jon

    thx 4 the help. first time using latex. ISBI ’09 paper due jan 19 :)

  16. on 24 Jan 2009 at 12:51 am Zeynep

    The subfigure package is also good for this purpose. One plus side is that you can add captions for the subfigures, as well.

    Still very useful tip, though!

  17. on 12 Feb 2009 at 3:30 pm Kelley

    Thank you so much for this site!! I have been forever trying to figure out how to insert 2×2 matrices in LaTeX!!

  18. on 16 Apr 2009 at 10:15 pm Andres

    Excellent tip. I just have a doubt. Is it possible with this method to put a caption for each image in addition to the caption of the matrix??

    Thanks

  19. on 18 Apr 2009 at 3:01 pm Lucia

    Thanks for sharing this great snippet of code. It worked as advertised. I had some trouble getting it to use .jpg image but, it was okay with a .eps image.
    Thanks!

  20. on 11 May 2009 at 7:55 am Seyab Khan

    Thanks, your tip solved my problem.

    Now I want to put captions to the images, Is it possible to put caption to each image seperately.

  21. on 19 May 2009 at 8:43 am ercan

    Great, exactly what I want, a 2×2 figure matrix! Cheers!

  22. on 22 May 2009 at 1:26 pm Anna

    How can I place certain capture for each image?

  23. on 22 May 2009 at 1:27 pm Anna

    oops, I mean caption)

  24. on 12 Aug 2009 at 8:19 am ida

    thanx a lot.

    Seyab Khan

    Thanks, your tip solved my problem.

    Now I want to put captions to the images, Is it possible to put caption to each image seperately.

    ————————
    its also my problem. does anybody know?

  25. on 13 Aug 2009 at 10:30 am darodrigues

    if you use the subfig package, it gets easy. just do like this:

    \usepackage{subfig}

    \begin{figure}
    \centering
    \subfloat[Part 1][Subfigure 1]{\includegraphics{image1.jpg} \label{fig:fourfigures-a}}
    \subfloat[Part 2][Subfigure 2]{\includegraphics{image2.jpg} \label{fig:fourfigures-b}}\\
    \subfloat[Part 3][Subfigure 3]{\includegraphics{image3.jpg} \label{fig:fourfigures-c}}
    \subfloat[Part 4][Subfigure 4]{\includegraphics{image4.jpg} \label{fig:fourfigures-d}}
    \caption{Four figures}
    \label{fig:fourfigures}
    \end{figure}

    the [Part x] option is the subfigure caption in the figure list, and can be ommitted. The [Subfigure x] is the subfigure caption on the page itself. Subfigures will be “numbered” (a), (b), (c), etc unless the caption is ommitted completely. The manual will show you a bunch of other neat tricks.

  26. on 24 Dec 2009 at 4:41 am Reza

    Thanks, Very useful and nice codes.

  27. on 22 Jan 2010 at 1:25 pm Ricardo

    Thanks! Very useful code, it solved my problem easily and in an elegant way.

  28. on 25 Mar 2010 at 10:57 pm Dimitris

    Many thanks!

    Regards from Cambridge/UK

  29. on 21 Apr 2010 at 11:47 am Michael

    Thanks, this was really helpful. I have now been able to get some horizontal space between my 2 figures using subfloat.

  30. on 08 May 2010 at 6:51 am william brass

    thanks man!

  31. on 12 May 2010 at 2:35 pm Monameya

    Hi, I want to place a table and and an image on the same line.
    Thankx for Your reponse

  32. on 16 Jun 2010 at 12:04 pm GC

    Thanks a lot! Saved me tonnes of time searching for this option!

  33. on 27 Jul 2010 at 9:59 am lena

    thanks! that helped me a lot!

  34. on 12 Aug 2010 at 12:54 pm [.::MDT::.]

    Great!

    Thanks a lot!!!

  35. on 12 Nov 2010 at 3:32 am Callum

    Don’t use the \begin{center} environment in a figure, it adds extra vertical space which is not needed and doesn’t look good. Instead, use \centering.

    Cheers

  36. on 01 Mar 2011 at 5:05 am Nour

    Hi,
    I am using the following to include four figures in one page:
    \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}

    I found it very easy, however I have a problem which is; how could I label each figure separately. I mean, the first figure (top left), the second (top right) and so on.

    Thanks very much for your help.

  37. on 24 Jun 2011 at 2:59 am mishal

    Hi,
    I am using the following to include four figures in one page:
    \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}

    I found it very easy, however I have a problem which is; how could I label each figure separately. I mean, if i have 10 figures in an array i want to label each of them seperately
    e.g. (a)tiger (b)bird and so on
    please help

  38. on 18 Jul 2011 at 5:47 pm mug

    Hi,
    I would like to insert multiples images at once in Latex. I was thinking of using ‘for’ loops. Is it possible? Kindly advise me on this issue.

    Thank You.

  39. on 22 Aug 2011 at 10:57 am Mina

    Thank you very much..you solved my problem quickly :)

  40. on 17 Sep 2011 at 1:07 pm Nuno

    I think on 18 Jul 2011 someone trolled this comment section

  41. on 18 Oct 2011 at 10:21 am Saha

    Dude, that just worked like magic! Now I arrange pictures efficiently to save paper.

  42. on 30 Dec 2011 at 1:09 pm Adhip

    Thanks Buddy! :D

  43. on 11 Jan 2012 at 7:13 am S~

    Hey guys,

    Do you happen to know how I can make two pictures show up in latex as follows:
    one picture normal size with second picture to appear as a small insert covering the top right corner of the first picture. The second pic is a zoom in at a part of the first pic.
    I have no idea how to do this.. These are both matlab .eps files so if you know of any way that I could do it in matlab instead it would also be helpful. Thank you!

    Best,
    s~

  44. on 17 May 2012 at 4:57 pm Sanja

    Haha, who would have thought my old GRT will help me with LaTeX :) I miss you guys!

  45. on 23 May 2012 at 2:45 pm pyare

    Hi,
    Can any one tell me that how zoomed figure could be included in main figure window

  46. on 08 Nov 2013 at 2:36 pm matrus

    Thanks for the useful post. It works fine.

  47. on 30 Apr 2014 at 11:21 am Andy Soper

    Great Stuff. You helped me a lot.

    Andy

  48. on 30 Apr 2014 at 11:51 am Andy Soper

    Hi,

    This refers to placing multiple images side by side or in array in Latex. If the images are not the same size the effect can be ugly.

    I use a mathematical graphing program to, yep, draw graphs and then a drawing program to make my own graphics. The two images are rarely close to the same shape and size.

    Sometimes one can juggle the “width=” parameters. I find that other times I need to use Windows Paint.exe to resize an image and then, if it was a reduction, to crop away the white space using select, cut, new, reduce the canvass so that paste will fill it then save with an appropriate name.

    I hope that this helps someone.

    Andy

Did I get this wrong? Let me know!

Trackback URI | Comments RSS