0

I would like to place 4 images next to each other, with a single caption underneath. Normally, I would use the following for this:

\begin{figure}[htb]
\centering
\subfloat{\includegraphics[width=0.25\linewidth]{fig1.pdf}}\hfill
\subfloat{\includegraphics[width=0.25\linewidth]{fig2.pdf}}\hfill
\subfloat{\includegraphics[width=0.25\linewidth]{fig3.pdf}}\hfill
\subfloat{\includegraphics[width=0.25\linewidth]{fig4.pdf}}\hfill
\caption{Single caption underneath all 4 images!}
\label{fig:four-figs}
\end{figure}

However, since I am in a multicols environment, I get the following error:

Package multicol Warning: Floats and marginpars not allowed inside `multicols' environment!.

How can I achieve the same effect of the subfloat, but within the multicols environment?

Here is my MWE:

\documentclass[a0,portrait]{a0poster}

\usepackage{multicol} 
\columnsep=100pt 
\columnseprule=3pt
\usepackage[svgnames]{xcolor}
\usepackage{palatino} 
\usepackage{graphicx}
\usepackage[font=small,labelfont=bf]{caption} 
\usepackage{amsfonts, amsmath, amsthm, amssymb}
\usepackage{wrapfig}
\usepackage[caption=false]{subfig}
\captionsetup[figure]{labelfont={color=NavyBlue}}

\begin{document}

\begin{multicols}{2} 

\begin{figure}[htb]
\centering
\subfloat{\includegraphics[width=0.25\linewidth]{fig1.pdf}}\hfill
\subfloat{\includegraphics[width=0.25\linewidth]{fig2.pdf}}\hfill
\subfloat{\includegraphics[width=0.25\linewidth]{fig3.pdf}}\hfill
\subfloat{\includegraphics[width=0.25\linewidth]{fig4.pdf}}\hfill
\caption{Single caption underneath all 4 images!}
\label{fig:four-figs}
\end{figure}

\end{multicols}
\end{document}
5
  • Do you want the subfloat to be displayed over the whole \textwidth or within one column?
    – Bernard
    Aug 16, 2017 at 12:59
  • @Bernard Within one column
    – JNevens
    Aug 16, 2017 at 12:59
  • Did you try with [width=0.25\columnwidth]?
    – Bernard
    Aug 16, 2017 at 13:01
  • @Bernard But the figure environment is simply not showing on the output.
    – JNevens
    Aug 16, 2017 at 13:03
  • 1
    It makes no sense to let float a figure on a poster. Simply use the center environment and \captionof{figure}{Single caption underneath all 4 images!}.
    – Bernard
    Aug 16, 2017 at 13:15

2 Answers 2

1

the same result you obtain without use of minipage:

\documentclass[a0,portrait]{a0poster}

\usepackage{multicol} 
\columnsep=100pt 
\columnseprule=3pt
\usepackage[svgnames]{xcolor}
\usepackage{palatino} 
\usepackage{graphicx}
\usepackage[font=small,labelfont=bf]{caption} 
\usepackage{amsfonts, amsmath, amsthm, amssymb}
\usepackage{wrapfig}
\captionsetup[figure]{labelfont={color=NavyBlue}}

\usepackage{lipsum}

\begin{document}
\begin{multicols}{2} 
\lipsum[1]
\begin{center}
    \includegraphics[width=0.25\linewidth]{fig1.pdf}%
    \includegraphics[width=0.25\linewidth]{fig2.pdf}%
    \includegraphics[width=0.25\linewidth]{fig3.pdf}%
    \includegraphics[width=0.25\linewidth]{fig4.pdf}
\captionof{figure}{Single caption}
\end{center}
\lipsum[2]

\end{multicols}
\end{document}

if you like to have space between images, than you need to reduce image width and inserts \hfill between them:

\begin{center}
    \includegraphics[width=0.22\linewidth]{fig1.pdf}\hfill
    \includegraphics[width=0.22\linewidth]{fig2.pdf}\hfill
    \includegraphics[width=0.22\linewidth]{fig3.pdf}\hfill
    \includegraphics[width=0.22\linewidth]{fig4.pdf}
\captionof{figure}{Single caption}
\end{center}
0

I found a solution using minipage and the captionof command of the caption package. Here it is:

\documentclass[a0,portrait]{a0poster}

\usepackage{multicol} 
\columnsep=100pt 
\columnseprule=3pt
\usepackage[svgnames]{xcolor}
\usepackage{palatino} 
\usepackage{graphicx}
\usepackage[font=small,labelfont=bf]{caption} 
\usepackage{amsfonts, amsmath, amsthm, amssymb}
\usepackage{wrapfig}
\captionsetup[figure]{labelfont={color=NavyBlue}}

\begin{document}

\begin{multicols}{2} 

\begin{minipage}{0.25\linewidth}
    \centering
    \includegraphics[width=\linewidth]{fig1.pdf}
\end{minipage}%
\begin{minipage}{0.25\linewidth}
    \centering
    \includegraphics[width=\linewidth]{fig2.pdf}
\end{minipage}%
\begin{minipage}{0.25\linewidth}
    \centering
    \includegraphics[width=\linewidth]{fig3.pdf}
\end{minipage}%
\begin{minipage}{0.25\linewidth}
    \centering
    \includegraphics[width=\linewidth]{fig4.pdf}
\end{minipage}
\captionof{figure}{Single caption}

\end{multicols}
\end{document}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.