3

I'm using the multicol package, along with embedded images. A minimal example would be:

\documentclass{article}
\usepackage[a4paper]{geometry}
\usepackage{graphicx}
\usepackage{caption}
\usepackage{mdframed}
\usepackage{multicol}
\usepackage{lipsum}

\newenvironment{Figure}
        {\par\medskip\noindent\minipage{\linewidth}}
        {\endminipage\par\medskip}

\begin{document}
\begin{multicols}{2}
\lipsum[1-2]
\begin{Figure}
        \begin{mdframed}
                \centering
                \includegraphics[width=\linewidth,height=1.5in,draft]{foo.jpeg}
                \captionof{figure}{Some small image.}
                \label{fig:Abb12}
        \end{mdframed}
\end{Figure}
\lipsum[3-4]
\end{multicols}
\end{document}

See paragraphs one and two in the left column: They're placed to the top and bottom of the column, which introduces quite some blank vertical space in between. Is there a way that I can push all content to the top, having the excess whitespace at the bottom (instead of showing up between the two paragraphs?) So my intended output would be like this:

| par 1 par1 | figure 1 |
| par 1 par1 | figure 1 |
| par 1 par1 |          |
|            | par 3    |
| par 2 par2 | par 3    |
| par 2 par2 |          |
|            | par 4    |
| here the   | par 4    |
| whitespace | par 4    |

instead of:

| par 1 par1 | figure 1 |
| par 1 par1 | figure 1 |
| par 1 par1 |          |
|            | par 3    |
| here be    | par 3    |
| whitespace |          |
|            | par 4    |
| par 2 par2 | par 4    |
| par 2 par2 | par 4    |
1

If you use \raggedcolumns you get the desired output:

enter image description here

Notes:

  • The showframe package was used just to show the page margins. It is not needed in your actual use case.

Code:

\documentclass{article}
\usepackage[a4paper]{geometry}
\usepackage{graphicx}
\usepackage{caption}
\usepackage{mdframed}
\usepackage{multicol}
\usepackage{lipsum}
\usepackage{showframe}

\newenvironment{Figure}
        {\par\medskip\noindent\minipage{\linewidth}}
        {\endminipage\par\medskip}

\begin{document}
\begin{multicols}{2}\raggedcolumns
\lipsum[1-2]
\begin{Figure}
        \begin{mdframed}
                \centering
                \includegraphics[width=\linewidth,height=1.5in,draft]{foo.jpeg}
                \captionof{figure}{Some small image.}
                \label{fig:Abb12}
        \end{mdframed}
\end{Figure}
\lipsum[3-4]
\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.