6

I want to create two columns next to each other. The left side contains a text in two columns using the multicol package. On the left side is some other content.

I've tried minipage, but in combination with multicol it fails in vertical aligning both minipages correctly. Minimal working example:

\documentclass{article}

\usepackage{multicol}
\usepackage{blindtext}

\begin{document}
   \begin{minipage}[t]{0.5\linewidth}
        \noindent
        \begin{multicols}{2}
            \blindtext
        \end{multicols}
    \end{minipage}
    \begin{minipage}[t]{0.5\linewidth}
            \blindtext
    \end{minipage}
\end{document}

The result, with a vertical misalignment of the top of both texts: misaligned minipages

Am I doing something wrong here?

  • Welcome to SE! I do not what is cause of your problem but this (dirty trick) can help: ....\begin{document} \noindent \begin{minipage}[t]{0.5\linewidth} ~ \vspace{-2\baselineskip} \begin{multicols}{1} ... – Zarko Feb 17 '16 at 14:42
  • 1
    Also, you should use {\dimexpr 0.5\textwidth - 0.5\columnsep} for the column width. – John Kormylo Feb 17 '16 at 15:24
  • You have explanation in @egreg answer :-) – Zarko Feb 17 '16 at 15:58
4

You have to set an anchor at the top for [t] to take effect, because the top line inside the multicols environment is not the top line in the enveloping minipage: \vspace{0pt} is sufficient. Also you need to countermand the insertion of a glob of glue (we need to back up by the difference between \topskip and the height of a strut) and to set an initial \strut to ensure good alignment between the baselines.

\documentclass{article}

\usepackage{multicol,calc}
\usepackage{blindtext}

\begin{document}

\noindent % or the indent would apply
\begin{minipage}[t]{0.5\linewidth-0.5em} % some separation
  \vspace{0pt} % anchor for [t]
  \vspace{\dimexpr\ht\strutbox-\topskip}% remove excess glue
  \begin{multicols}{2}
    \strut\makebox[0pt][l]{\vrule width 10cm height 0pt depth 0.1pt}%
    \blindtext
  \end{multicols}
\end{minipage}\hfill
\begin{minipage}[t]{0.5\linewidth-0.5em} % some separation
  \vspace{0pt} % anchor for [t]
  \strut\blindtext
\end{minipage}

\end{document}

enter image description here

The rule shows the alignment. Thanks to Frank Mittelbach for spotting a mistake.

| improve this answer | |
  • might be mistaken Enrico, but this still looks misaligned – Frank Mittelbach Feb 18 '16 at 7:47
  • Yes, the real backup depends on \splittopskip, rather than \lineskip. – egreg Feb 18 '16 at 8:55
3

Wouldn't using paracol and multicol be an easier approach?

\documentclass{article}
\usepackage{paracol}
\usepackage{multicol}
\usepackage{mwe}

\begin{document}
   \begin{paracol}{2}
       \begin{multicols}{2}
            \blindtext
        \end{multicols}
  \switchcolumn
     \blindtext
  \end{paracol}
\end{document}
| improve this answer | |
  • paracol seems to target specifically bilingual texts and is therefore restricted to two columns – fkjogu Feb 17 '16 at 15:32
  • No, it supports multiple columns, and can even specify columns with different widths. The question is whether you want to align columns or flow between them. – John Kormylo Feb 17 '16 at 15:35
  • Okay, so it is definitely an option. Thank you! – fkjogu Feb 17 '16 at 15:57

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.