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.
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.
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*}
lipsum
as an example, you don't need to put that in your document...
– Ryan
May 20 '15 at 2:28
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}
\section{Symmetric Padding}
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
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: \hbox
es, which are horizontally-oriented; and \vbox
es, 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.
\includegraphics{}
is positioned likeX
just put three next to each other and they come in a row. – David Carlisle May 19 '15 at 23:46\includegraphics{fig1}\includegraphics{fig2}\includegraphics{fig3}
– David Carlisle May 19 '15 at 23:51