# How to put several images in one row in LaTex?

I want to know how to put 3 images in one row in Latex, so that it looks like the following format:

Anyone can help me! Thank you so much!

Note: The figures need to span two columns inside a multicols environment.

• \includegraphics{} is positioned like X just put three next to each other and they come in a row. – David Carlisle May 19 '15 at 23:46
• @DavidCarlisle, can you give me an example? – user3761566 May 19 '15 at 23:47
• @DavidCarlisle, I tried "\includegraphics[width=0.5\textwidth]{fig1.jpg, fig2.jpg, fig3.jpg }", but it does not work – user3761566 May 19 '15 at 23:50
• \includegraphics{fig1}\includegraphics{fig2}\includegraphics{fig3} – David Carlisle May 19 '15 at 23:51
• @DavidCarlisle,my figures are too big, the command works, but cannot display the third figures. How to deal with this problem? – user3761566 May 19 '15 at 23:56

Here's how to position figures across the columns of multicol:

\documentclass{article}

\usepackage{multicol}
\usepackage{lipsum}
\usepackage{mwe}

\begin{document}
\begin{multicols}{2}
\begin{figure*}[ht!]
\includegraphics[width=.3\textwidth]{example-image-a}\hfill
\includegraphics[width=.3\textwidth]{example-image-b}\hfill
\includegraphics[width=.3\textwidth]{example-image-c}
\caption{Image A.}
\caption{Image B.}
\caption{Image C.}
\end{figure*}
\lipsum[1-10]
\end{multicols}
\end{document}


Note that I'm using the starred version of the figure environment. The [ht] tag specifies position, here indicating "at the top of this page." Google "LaTeX Floats" for how to change that and how to adjust the figure environment.

Here: copy\paste only this part:

        \begin{figure*}[ht!]
\includegraphics[width=.3\textwidth]{example-image-a}\hfill
\includegraphics[width=.3\textwidth]{example-image-b}\hfill
\includegraphics[width=.3\textwidth]{example-image-c}
\caption{Image A.}
\caption{Image B.}
\caption{Image C.}
\end{figure*}

• I use exactly your command. There is one error : ! LaTeX Error: Can be used only in preamble.See the LaTeX manual or LaTeX Companion for explanation.Type H <return> for immediate help.... \begin{document} – user3761566 May 20 '15 at 2:25
• And in my paper, there are lots of unrecognized characters above and under the 3 images. They looks like this: consectetuer adipiscing elit. In hac habitasse platea dictumst. Integer tempus convallis augue. Etiam facilisis. Nunc elementum fermentum wisi. Aenean placerat. Ut imperdiet, enim sed gravida sollicitudin, felis odio placerat quam, ac pulvinar elit purus eget enim. Nunc vitae tortor. Proin tempus nibh sit amet nisl. Vivamus quis tortor vitae risus porta – user3761566 May 20 '15 at 2:27
• @user3761566 Well... did you paste the whole thing in, including my documentclass, usepackage commands, and begin document? if so, there's your problem... – Ryan May 20 '15 at 2:27
• ...I've used lorem ipsum from lipsum as an example, you don't need to put that in your document... – Ryan May 20 '15 at 2:28
• @user3761566 See my edit now, I've separated the solution from the example... – Ryan May 20 '15 at 2:29

I just prepared a question/answer (see here) and I think that the code is suitable for the question here. I provide different examples that are based on the subcaption package.

\documentclass{article}

\usepackage[
showframe, % This option shows the margins and so on -- remove it in the final version
]{geometry}

\usepackage{graphicx}

% Here: H option for float placement
\usepackage{float}

% caption and subcaption work together
\usepackage{subcaption} % loads the caption package

\begin{document}

\section{Two Figures}
\subsection{Horizontal}

\begin{figure}[H]
\centering
\subcaptionbox{Subcaption A}{\includegraphics[width=0.45\textwidth]{example-image-a}}%
\hfill % <-- Seperation
\subcaptionbox{Subcaption B}{\includegraphics[width=0.45\textwidth]{example-image-b}}%
\caption{Caption}
\end{figure}

\subsection{Vertical}

\begin{figure}[H]
\centering
\subcaptionbox{Subcaption A}{\includegraphics[width=0.45\textwidth]{example-image-a}}%
\\ % <-- Line break
\subcaptionbox{Subcaption B}{\includegraphics[width=0.45\textwidth]{example-image-b}}%
\caption{Caption}
\end{figure}

\section{Three Figures}
\subsection{Horizontal}

\begin{figure}[H]
\centering
\subcaptionbox{Subcaption A}{\includegraphics[width=0.30\textwidth]{example-image-a}}%
\hfill % <-- Seperation
\subcaptionbox{Subcaption B}{\includegraphics[width=0.30\textwidth]{example-image-b}}%
\hfill % <-- Seperation
\subcaptionbox{Subcaption C}{\includegraphics[width=0.30\textwidth]{example-image-C}}%
\caption{Caption}
\end{figure}

\subsection{Vertical}

\begin{figure}[H]
\centering
\subcaptionbox{Subcaption A}{\includegraphics[width=0.30\textwidth]{example-image-a}}%
\\ % <-- Line break
\subcaptionbox{Subcaption B}{\includegraphics[width=0.30\textwidth]{example-image-b}}%
\\ % <-- Line break
\subcaptionbox{Subcaption C}{\includegraphics[width=0.30\textwidth]{example-image-C}}%
\caption{Caption}
\end{figure}

\subsection{Mixed}

\begin{figure}[H]
\centering
\subcaptionbox{Subcaption A}{\includegraphics[width=0.30\textwidth]{example-image-a}}%
\hfill % <-- Seperation
\subcaptionbox{Subcaption B}{\includegraphics[width=0.30\textwidth]{example-image-b}}%
\\ % <-- Line break
\subcaptionbox{Subcaption C}{\includegraphics[width=0.30\textwidth]{example-image-C}}%
\caption{Caption}
\end{figure}

\begin{figure}[H]
\centering
\subcaptionbox{Subcaption A}{\includegraphics[width=0.45\textwidth]{example-image-a}}%
\hfill % <-- Seperation
\subcaptionbox{Subcaption B}{\includegraphics[width=0.45\textwidth]{example-image-b}}%
\\ % <-- Line break
\subcaptionbox{Subcaption C}{\includegraphics[width=0.30\textwidth]{example-image-C}}%
\caption{Caption}
\end{figure}

\section{Four Figures}
\subsection{Horizontal}

\begin{figure}[H]
\centering
\subcaptionbox{Subcaption A}{\includegraphics[width=0.20\textwidth]{example-image-a}}%
\hfill % <-- Seperation
\subcaptionbox{Subcaption B}{\includegraphics[width=0.20\textwidth]{example-image-b}}%
\hfill % <-- Seperation
\subcaptionbox{Subcaption C}{\includegraphics[width=0.20\textwidth]{example-image-C}}%
\hfill % <-- Seperation
\subcaptionbox{Subcaption D}{\includegraphics[width=0.20\textwidth]{example-image}}%
\caption{Caption}
\end{figure}

\subsection{Mixed}

\begin{figure}[H]
\centering
\subcaptionbox{Subcaption A}{\includegraphics[width=0.45\textwidth]{example-image-a}}%
\hfill % <-- Seperation
\subcaptionbox{Subcaption B}{\includegraphics[width=0.45\textwidth]{example-image-b}}%
\\ % <-- Line break
\subcaptionbox{Subcaption C}{\includegraphics[width=0.45\textwidth]{example-image-C}}%
\hfill % <-- Seperation
\subcaptionbox{Subcaption D}{\includegraphics[width=0.45\textwidth]{example-image}}%
\caption{Caption}
\end{figure}

See the following example with small picture widths.

\begin{figure}[H]
\centering
\subcaptionbox{Subcaption A}{\includegraphics[width=0.20\textwidth]{example-image-a}}%
\hfill % <-- Seperation
\subcaptionbox{Subcaption B}{\includegraphics[width=0.20\textwidth]{example-image-b}}%
\\ % <-- Line break
\subcaptionbox{Subcaption C}{\includegraphics[width=0.20\textwidth]{example-image-C}}%
\hfill % <-- Seperation
\subcaptionbox{Subcaption D}{\includegraphics[width=0.20\textwidth]{example-image}}%
\caption{Caption}
\end{figure}

You can use the optional argument of the \texttt{\textbackslash subcaptionbox} in order to define the width of the sub element.

\begin{figure}[H]
\centering
\subcaptionbox{Subcaption A}[0.50\textwidth]{\includegraphics[width=0.20\textwidth]{example-image-a}}%
\hfill % <-- Seperation
\subcaptionbox{Subcaption B}[0.50\textwidth]{\includegraphics[width=0.20\textwidth]{example-image-b}}%
\\ % <-- Line break
\subcaptionbox{Subcaption C}[0.50\textwidth]{\includegraphics[width=0.20\textwidth]{example-image-C}}%
\hfill % <-- Seperation
\subcaptionbox{Subcaption D}[0.50\textwidth]{\includegraphics[width=0.20\textwidth]{example-image}}%
\caption{Caption}
\end{figure}

Here I try to illustrate the idea behind the solution -- \textbf{don't use this code}!

\begin{figure}[H]
\centering
\fbox{%
\subcaptionbox{Subcaption A}[0.482\textwidth]{\includegraphics[width=0.20\textwidth]{example-image-a}}%
}%
\hfill % <-- Seperation
\fbox{%
\subcaptionbox{Subcaption B}[0.482\textwidth]{\includegraphics[width=0.20\textwidth]{example-image-b}}%
}%
\\ % <-- Line break
\fbox{%
\subcaptionbox{Subcaption C}[0.482\textwidth]{\includegraphics[width=0.20\textwidth]{example-image-c}}%
}%
\hfill % <-- Seperation
\fbox{%
\subcaptionbox{Subcaption D}[0.482\textwidth]{\includegraphics[width=0.20\textwidth]{example-image}}%
}%
\caption{Caption}
\end{figure}

\end{document}


Here is a way to do what you want maybe it is not the best but it does the work, use multicol package and just play with the \columsep and the scale of the image and for the figure name use caption package as the code below

\documentclass{article}
\usepackage{multicol}
\usepackage{graphicx}
\usepackage{caption}
\usepackage[left=2cm,right=2cm,top=2cm,bottom=2.5cm]{geometry}

\begin{document}
\begin{multicols}{3}[\columnsep=3cm]
\includegraphics[scale=0.3]{Figura}
\columnbreak
\includegraphics[scale=0.3]{Figura}
\columnbreak
\includegraphics[scale=0.3]{Figura}
\end{multicols}
\captionof{figure}{Name of the figure}
\end{document}


This is the result don't take to much attention to the cat it was the first image I can find, Hope it helps

• I am writing two columns format paper, I input your command, they are not in a row and they are in the left column. I want the three images in one row ,which occupy two columns. Can you modify your command? – user3761566 May 20 '15 at 1:23
• Also, I want to add descriptions below the three images – user3761566 May 20 '15 at 1:24
• *heavy breathing* – Sean Allred May 20 '15 at 2:40

To do this in LaTeX, I think you want to take a look at the subfig package. The documentation is clear and well-written, and it seems to provide the facilities you want. That, combined with Ryan's answer about figures spanning columns in multicol, should get you what you want. (Ryan's answer will also get you there by itself; but there is a package for that, as there usually is.)

But TeX works simply by shoving boxes together in various ways, sometimes with certain amounts of space between them; that space can be rigid (a "skip") or variable ("glue," which can stretch or shrink as required by the typesetting). Those boxes come in two forms: \hboxes, which are horizontally-oriented; and \vboxes, which are vertically oriented. These can be nested more or less infinitely (not really, as TeX's memory is limited, but there's no conceptual limit).

E.g., consider a paragraph. Every letter is a box; the spaces between the words and the lines are glue (they stretch or shrink within certain limits); and TeX puts them together into horizontal boxes (each line) and a vertical box (the lines arranged into a paragraph) based on its complex system of penalties which leads to the best results.

This is done automatically with paragraph-typesetting; but it can be done manually, too, by explicitly setting the boxes. And box-twiddling is super-fun, so let's see how we can do that in this case:

\documentclass{article}
\usepackage{graphicx}
\begin{document}
\hbox to\linewidth{%
\hfil%
\includegraphics[scale=0.2]{Bo0MI.jpg}%
\hfil%
\includegraphics[scale=0.2]{Bo0MI.jpg}%
\hfil%
\includegraphics[scale=0.2]{Bo0MI.jpg}%
\hfil%
}
\end{document}


As for putting a caption under each image, it looks like a caption already is part of your image; but if you want something besides what's already there, you can do this in a number of ways. E.g., with direct box-twiddling:

\documentclass{article}
\usepackage{graphicx}
\begin{document}
\hbox to\linewidth{%
\hfil%
\vbox{%
\hbox{\includegraphics[scale=0.15]{Bo0MI.jpg}}%
\hbox{Some caption here.}
}%
\hfil%
\vbox{%
\hbox{\includegraphics[scale=0.15]{Bo0MI.jpg}}%
\hbox{Another caption here.}
}%
\hfil%
\vbox{%
\hbox{\includegraphics[scale=0.15]{Bo0MI.jpg}}%
\hbox{A third caption here.}
}%
\hfil%
}
\end{document}


Of course, if this is anything more than a one-off, you'd want to define a new command for it; but since subfig has already done that, you can skip the overhead. There's no need to reinvent the wheel.

There's a lot more to boxes than just this, but that's the concept behind things. Any good TeX reference can tell you more.