Search code examples
latex

Multiple subfigures in a row in a LaTeX document


I am trying to insert four figures in a LaTeX document but if I use subfigure command, two of my figures stay in first row and the other two go to the second line. Like this : enter image description here

The other solution I tried was using minipage command, but the problem with minipage is that the subfigures get normal figure caption (like Figure 1) while I would like subfigure captions like (a). See the following figure: enter image description here

What I prefer is to have something like second picture but with the captions like first picture.


Solution

  • Your figures are too wide to fit side-by-side in one line. If multiple subfigures do not fit in one line, latex does an auto linebreak. You have to specify the width of each included graphic per subfigure such, that it will sum up to be smaller than the \textwidth parameter, i.e:

    \begin{figure}
        \centering
        \subfigure[]{\includegraphics[width=0.24\textwidth]{monalisa.jpg}} 
        \subfigure[]{\includegraphics[width=0.24\textwidth]{monalisa.jpg}} 
        \subfigure[]{\includegraphics[width=0.24\textwidth]{monalisa.jpg}}
        \subfigure[]{\includegraphics[width=0.24\textwidth]{monalisa.jpg}}
        \caption{(a) blah (b) blah (c) blah (d) blah}
        \label{fig:foobar}
    \end{figure}
    

    leads to

    enter image description here

    While if you set the width too high, e.g. width=0.5\textwidth leads to what I believe is your problem

    enter image description here