Graphics, Figures & Tables ⇒ 2x2 figures with subfig
2x2 figures with subfig
I'd like to have 4 subfloats organized in two lines
(i.e.:
x x
x x )
But when I had 2x subfloats separated by \newline, the second pair of figures won't align.
Do I have to use subfigure?
I'm at the end of a long document, I'm concerned having to change all the syntax of my figures.
Thanks everyone!
M
my example:
\usepackage{subfig}
\begin{document}
\begin{figure}%[!hbt]
\begin{center}
\subfloat[Float1]{\includegraphics[width=0.33\textwidth, height=0.23\textheight]{figures/F1}}
\subfloat[Figure2]{\includegraphics[width=0.33\textwidth,height=0.23\textheight]{figures/F2}}
\newline
\noindent
\subfloat[Figure3]{\includegraphics[width=0.33\textwidth, height=0.23\textheight]{figures/F3}} % \newline
\subfloat[Biomass in bioreactor]{\includegraphics[width=0.33\textwidth,height=0.23\textheight]{figures/F3}}
\end{center}
\caption[caption]{caption}
\end{center}
\end{figure}
\end{document}
NEW: TikZ book now 40% off at Amazon.com for a short time.
And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p
Re: 2x2 figures with subfig
2. There are two \end{center} but only one \begin{center}. Anyway, this produces extra (and usually unwanted) extra vertical space, so better use a simple \centering instead.
3. Never ever use \newline inside a centered environment because it simply don't work correctly. Use \\ instead.
Re: 2x2 figures with subfig
No 3. did the trick. All good.
Thanks for reminding me the correct syntax and a minimal working example, in other words have a rest when it is late night.
Thanks!
- localghost
- Site Moderator
- Posts: 9202
- Joined: Fri Feb 02, 2007 12:06 pm
2x2 figures with subfig
Then please be so kind and mark the topic accordingly as written in Section 3 of the Board Rules.miceleee wrote:[…] No 3. did the trick. All good. […]
Thorsten
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10