4

I want to make a multicolumn list with the same number of items in each column. I tried this with multicols, but some items have bigger heights than others so I got a column of 5 and a column of 3:

\documentclass{article}
\usepackage{multicol}
\usepackage{amsmath}
\begin{document}
\begin{multicols}{2}
\begin{enumerate}
\item $1$
\item $2$
\item $3$
\item $4$
\item $5$
\item $\cfrac{1}{4}$
\item $\cfrac{1}{5}$
\item $\cfrac{1}{6}$
\end{enumerate}
\end{multicols}
\end{document}

enter image description here Is there a simple way to get the same number of items in each column?

  • Add \vphantom{\cfrac14} -> \item $1\vphantom{\cfrac14}$, etc. – karlkoeller Sep 14 '13 at 16:05
  • The \cfrac command -- generally used for typesetting continued fractions -- inserts even more vertical space than \dfrac ("display style \frac") does. This choice contributes to making the lines look rather unbalanced. Could you live with using \tfrac ("text style \frac") throughout? – Mico Sep 14 '13 at 16:08
  • @karlkoeller That works for this, but I'd like something more automatic. Especially if I have several different item heights, this would be cumbersome, and might need to be redone entirely if I decide on 3 columns instead of 2 – Chris Chudzicki Sep 14 '13 at 16:09
  • @Mico: This was my MWE. I really don't care about fractions. My list might have single numbers, matrices, integrals . . . anything of different heights – Chris Chudzicki Sep 14 '13 at 16:11
3

I would create my own environment, say myenumerate, which inserts a strut with each \item to some predefined height and depth so it accommodates for the largest item. I've hardcoded it below to have a depth of 1\baselineskip and span 3\baselineskip (effectively 2\baselineskip above the baseline):

enter image description here

\documentclass{article}
\usepackage{multicol,amsmath}% http://ctan.org/pkg/{multicol,amsmath,etoolbox}
\newenvironment{myenumerate}
  {\enumerate% Regular enumerate environment
   \def\makelabel##1{\hss\llap{##1}\rule[-\baselineskip]{0pt}{3\baselineskip}}}
  {\endenumerate}
\begin{document}
\begin{multicols}{2}
\begin{myenumerate}
  \item $1$
  \item $2$
  \item $3$
  \item $4$
  \item $5$
  \item $\dfrac{1}{4}$
  \item $\dfrac{1}{5}$
  \item $\dfrac{1}{6}$
\end{myenumerate}
\end{multicols}
\end{document}

The strut is inserted through a (local) redefinition of \makelabel - the macro responsible for setting the actual label formatting.

1

Another option is the tasks package that I just learned about.

The package has the side effect that numbering increments horizontally rather than vertically, but that's fine with me. Also there are some limitations, like tasks environment can't be nested (but can contain itemize and other normal lists). I'm OK with both of those facts.

\documentclass{article}
\usepackage{multicol}
\usepackage{tasks}

\everymath{\displaystyle}

\begin{document}
    \begin{tasks}(2)
        \task $1$
        \task $2$
        \task $3$
        \task $\frac{1}{4}$
        \task $5$
        \task $\frac{1}{5}$
        \task $4$
        \task $\frac{1}{6}$
    \end{tasks}

\end{document}

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.