# Letting Latex automatically place figures side by side

I have a document with a lot of figures, and most of them look good at a size of 0.45\textwidth. This means there is enough space for Figures to go side by side. However, I don't want to link the Figures. Is there a way to tell Latex that you are happy for two consecutive Figures to go next to each other if the dimensions allow it without going through and manually linking figures using minipage or subfigure etc?

EDIT: To clarify... by "not linking" I mean I do not want to put them in the same figure environment, or the same minipage. I do not wish to choose which images go side by side, just have Latex work out if 2 consecutive images will easily fit side by side and do this.

e.g.

Some text about a concept.
\begin{figure}
\includegraphics[width=0.45\textwidth]{figure1.png}
\caption{this is a figure about a concept}
\end{figure}
This is some text about a separate but similar concept that also needs to be explained.
\begin{figure}
\includegraphics[width=0.45\textwidth]{figure2.png}
\caption{this is a figure about a different concept}
\end{figure}


Depending on the other figures and the formatting, it may work out that these 2 figures are the only things on a page. If this is the case I would like Latex to put them next to each other, since they should fit. However, i don't want to go through putting them into a shared minipage or figure environment as it is possible for Figures and paragraphs to be moved and then it would all need to be redone and different images paired up into figure environments.

• Welcome to TeX.SE. Please clarify what you mean by "I don't want to link the Figures". Do you mean that you won't be cross-referencing them, or do also imply that you will not be assigning captions to the figures? Please advise. – Mico Feb 20 '17 at 8:28
• How do you put these figures in your document? Using \includegraphics would result in figures being placed next to each other, I think. However, \textwidth usually is larger than \linewidth, which means it is possible, that two times .45\textwidth is too large to fit on the same line. – Bananguin Feb 20 '17 at 8:55
• @user1129682 in a single column document \linewidth is \textwidth unless you are in a list or other indented environment. – David Carlisle Feb 20 '17 at 9:17
• It looks like you've got two separate accounts, which means you cannot edit your original post or leave comments. The Stack Exchange staff can merge them together for you. – CarLaTeX Feb 20 '17 at 10:31

The LaTeX float positioning code has no information about the content of the float so all of them appear to be full width boxes even if they are only half full (or even empty) so the only way to have tow figures side by side is to place them in the same figure environment.

This can be as simple as

\begin{figure}
\includegraphics{a}
\includegraphics{b}
\end{figure}


Or if you need to \caption you need a couple of minipage or one of the specific packages for handling subfigures.

Alternatively of course if you set your document (or that part of your document) in twocolumn mode then

\begin{figure}
\includegraphics{a}
\end{figure}

\begin{figure}
\includegraphics{b}
\end{figure}


Will do as you ask, making two figures each just less than half the text width, and (if other constraints allow) one may go at the top of each column.