2

enter image description here

For consistent style I always need the pictures at the beginning of the multicol environments. It's just that the images do not overlap over the bottom of the page.

What is the correct way to avoid overlapping environments (pictures) in multicol-environments?

With \setlength\premulticols{10\baselineskip} (found in manual '2 The User Interface') I solved the problem here.
But how to fix this in common?

\documentclass[fontsize=9pt, paper=a5]{scrreprt}%
\usepackage{caption}
\captionsetup[figure]{skip=2pt}

\usepackage{multicol}
\setlength{\multicolsep}{2.0pt plus 2.0pt minus 1.5pt}% 50%/3 of original values
\setlength\columnseprule{0.4pt}

% Solution?
\setlength\premulticols{10\baselineskip}

% https://tex.stackexchange.com/questions/12262/multicol-and-figures
\newenvironment{Figure}
  {\medskip\noindent\minipage{\linewidth}}
  {\endminipage\par\medskip}

\usepackage{mwe}
\usepackage{showframe}
\begin{document}
%\tableofcontents
\chapter{Erstes Kapitel}
\lipsum[1-3]
\begin{multicols}{2}
\begin{Figure}
 \centering
 \includegraphics[width=\linewidth, height=4cm]{example-image-a}
 \captionof{figure}{my caption of the figure}
\end{Figure}
\lipsum[65-69]
\end{multicols}

\end{document}
3

My solution is to define a new environment that takes as argument the file to include and the caption. Thus we can set the figure before starting multicols and pass the needed space to \premulticols.

\documentclass[fontsize=9pt, paper=a5]{scrreprt}%

\usepackage{multicol}
\usepackage{graphicx}
\usepackage{caption}

\usepackage{showframe,lipsum}% for the example

\captionsetup[figure]{skip=2pt}

\setlength{\multicolsep}{2.0pt plus 2.0pt minus 1.5pt}% 50%/3 of original values
\setlength\columnseprule{0.4pt}

\newsavebox{\figuremcbox}
\newenvironment{figuremc}[3][]
 {% #1 = options for includegraphics
  % #2 = file to include
  % #3 = caption (with label)
  \par
  \sbox{\figuremcbox}{%
    \begin{minipage}[b]{\dimexpr(\textwidth-\columnsep)/2}
    \centering
    \includegraphics[#1]{#2}
    \captionof{figure}{#3}
    \end{minipage}%
  }%
  \setlength{\premulticols}{\ht\figuremcbox}
  \begin{multicols}{2}
  \noindent\usebox{\figuremcbox}\medskip
 }{\end{multicols}}


\begin{document}
%\tableofcontents

\chapter{Erstes Kapitel}
\lipsum[1-3]

\begin{figuremc}[width=\columnwidth, height=4cm]{example-image-a}{my caption of the figure}
\lipsum[65-69]
\end{figuremc}

\end{document}

enter image description here

  • Mmh, needspace is interesting. I thought multicol has its own tools (like premulticols). – cis Jun 28 at 11:17
  • 1
    @cis Actually needspace seems not needed: instead of \needspace{\ht\figuremcbox} you can just do \setlength{\premulticols}{\ht\figuremcbox}. I'll change the code. – egreg Jun 28 at 12:40
  • Ah, very good.......... – cis Jun 28 at 12:41
4

Well, the issue here is that in environment multicols are floats not allowed, so you can not use environment figure to let the figure float to the next page.

The only way I see to solve this is to manually (off course only done after the text is fixed and will not change any longer ...) move the code for Figure in the text to get the figure placed without errors ...

So please see the added blindtext in the following mwe to solve the issue (only manually possible):

\documentclass[fontsize=9pt, paper=a5]{scrreprt}%

\usepackage{caption}
\captionsetup[figure]{skip=2pt}

\usepackage{multicol}
\setlength{\multicolsep}{2.0pt plus 2.0pt minus 1.5pt}% 50%/3 of original values
\setlength\columnseprule{0.4pt}

% Solution?
%\setlength\premulticols{10\baselineskip}

% https://tex.stackexchange.com/questions/12262/multicol-and-figures
\newenvironment{Figure}
  {\medskip\noindent\minipage{\linewidth}}
  {\endminipage\par\medskip}

\usepackage{mwe} % loads lipsum too
\usepackage{showframe}


\begin{document}
%\tableofcontents
\chapter{Erstes Kapitel}
\lipsum[1-3]
\begin{multicols}{2}
Dies ist ein Blindtext. Dies ist ein Blindtext. Dies ist ein Blindtext. % <======================
Dies ist ein Blindtext. Dies ist ein Blindtext. Dies ist ein Blindtext. 
Dies ist ein Blindtext. Dies ist ein Blindtext. Dies ist ein Blindtext. 
Dies ist ein Blindtext. Dies ist ein Blindtext. Dies ist ein Blindtext. 
Dies ist ein Blindtext. Dies ist ein Blindtext. Dies ist ein Blindtext. 
Dies ist ein Blindtext. Dies ist ein Blindtext. Dies ist ein Blindtext. 
\begin{Figure}
 \centering
 \includegraphics[width=\linewidth, height=4cm]{example-image-a}
 \captionof{figure}{my caption of the figure}
\end{Figure}
\lipsum[65-69]
\end{multicols}

\end{document}

and the result (looks a bit ugly, it is not nice to have one column text and two column text on one page):

resulting page

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.