2

I'm using \usepackage{graphicx,caption} and \usepackage{multicol}. I've got two columns of text. When I try to place an image in my text whilst using the mutlicols package that gives me two columns, I get the error message:

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

So what makes me be able to place images in text is to \begin and \end multicols around the image. This works for larger, horizontal images: enter image description here

The above is written as:

\end{multicols}
\begin{figure}[h]
\includegraphics[scale=0.275]{fig5closepittard.png}
\captionsetup{width=1.0\linewidth}
\caption{This caption and image is fine because they are oblong enough to cover both columns}
\end{figure}
\begin{multicols}{2}

However, when I have a portrait image that I want embedded within the column, the picture ends up to the side but the caption is in the middle of the page. I would like for the caption to be placed to the side, immediately under the image, but anything I've looked up just tells me how to align the caption but not how to move it across the page. It looks like this: enter image description here

The code is written like this:

\begin{figure}
\includegraphics[scale=0.275]{fig8closepittard.png}
\captionsetup{width=0.5\linewidth,justification=raggedright}
\caption{Please can I put this caption to the left underneath my image as opposed to having it in the centre? justification=raggedright or raggedleft only moves the alignment of the text, not the whole caption}
\end{figure}

If anyone knows how I could either place the caption so that it is under the image, or how to make it so that I can place images within multicols, I would be very grateful. Thank you very much in advance.

  • Please note that for the future, it is way easier for possible answerers to help you if you include a minimal working example (MWE) that starts at \documentclass and ends at \end{document} including everything to display the issue you're facing, but nothing more. – Skillmon Jul 9 '18 at 15:08
  • @Skillmon Noted. I will do that in the future. Thank you again for your help! – albc Jul 9 '18 at 15:15
2

A possible, very manual solution:

\documentclass[]{article}

\usepackage{multicol}
\usepackage{duckuments}% for dummy content
\usepackage[]{graphicx}
\usepackage{capt-of}% if you load the caption package you don't need this

\begin{document}
\begin{multicols}{2}
  \blindduck[-]
\end{multicols}
\begin{figure}[htp]% >>>
  \centering
  \includegraphics[width=.7\linewidth]{example-image-duck}%
  \caption
    {%
      A happy duck%
      \label{fig:duck}%
    }%
\end{figure}% <<<
\begin{multicols}{2}
  \blindduck[-]
\end{multicols}
\clearpage
\begin{multicols}{2}
  \blindduck[1-4]
  \vskip\intextsep
  \noindent\begin{minipage}{\linewidth}
    \centering
    \includegraphics[width=.7\linewidth]{example-image-duck}%
    \captionof{figure}
      {%
        A happy canard with a long caption being placed correctly%
        \label{fig:canard}%
      }%
  \end{minipage}
  \vskip\intextsep
  \blindduck[full]
\end{multicols}
\end{document}

Output of the full width figure:

enter image description here

Output of the single column figure:

enter image description here

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.