2

I am trying to gain space by using enumerate in multicolumns, but here the (v) is not top aligned.

Is there a way to do it so?

\begin{multicols}{2}
\begin{enumerate}[label=(\roman*)]
    \item \lstinline{-1}
    \item \lstinline{07}
    \item \lstinline{-6}
    \item \lstinline{0x22}
    \item \lstinline{0b01110011}
\end{enumerate}
\end{multicols}

enter image description here

3
  • 1
    Please add a full compileable code
    – AndréC
    Nov 2, 2019 at 11:58
  • 2
    Probably the starred version of multicols helps?
    – leandriis
    Nov 2, 2019 at 12:09
  • 1
    There's also the tasks, tablists or shortlstpackage for a horizontal numbering.
    – Bernard
    Nov 2, 2019 at 13:26

2 Answers 2

3

Here are two different possibilites on how to achieve the desired alignment using either multicol or two minipages:

enter image description here

\documentclass{article}
\usepackage{enumitem}
\usepackage{multicol}
\usepackage{listings}

\begin{document}

\begin{multicols}{2}
\begin{enumerate}[label=(\roman*)]
    \item \lstinline{-1}
    \item \lstinline{07}
    \item \lstinline{-6}
    \item \lstinline{0x22}
    \item \lstinline{0b01110011}
    \item[\vspace{\fill}]
\end{enumerate}
\end{multicols}

\noindent
\begin{minipage}{0.5\textwidth}
\begin{enumerate}[label=(\roman*),series=mylist]
    \item \lstinline{-1}
    \item \lstinline{07}
    \item \lstinline{-6}
\end{enumerate}
\end{minipage}%
\begin{minipage}{0.5\textwidth}
\begin{enumerate}[resume*=mylist]
    \item \lstinline{0x22}
    \item \lstinline{0b01110011}
    \item[\vspace{\fill}]
\end{enumerate}
\end{minipage}
\end{document}
1
  • It only works with \vspace*{\fill} for me
    – pmaen
    Nov 6, 2022 at 14:01
3

Multicol balances by default and 2 columns with 3 and 2 items will then give you that result if there is enough stretchable glue (and in such lists there is).

There are a lot of bells and whistles in multicol to prevent that the last column stretches based on the situation (so look at the documentation for that: texdoc multicol) or use \raggedcolumns or you could make sure that there is no stretch between the \items in which case the balancing would figure out that your intended design is really all that is sensible.

But on the whole the environment isn't made for producing such lists but doing more or less straight text so maybe other packages or approaches will get you faster to the desired result.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .