0

I am trying to use the multicol package to save vertical space while using the enumerate environment. To use a specific example, if I had 3 items in a list, I'd rather they not stack vertically, but be on the same row.

More specifically, I am trying to separate a set of answers to a physics problem from the problem statement itself neatly, and to this end I decided to use the \paragraph{} command.

This all works just fine, except when I try to place the multicols environment with the enumerated list inside of it right after a \paragraph{}. This is what I get:

Ugly alignment

Here ''Vastaukset:'' is inside the \paragraph. It's obvious this does not look very good. Here is a MWE code sample that produces the unwanted result:

\documentclass[a4paper,12pt,finnish]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{enumitem}
\usepackage{multicol}

\begin{document}
\paragraph{Vastaukset:}
\begin{multicols}{3}
\begin{enumerate}[label=\alph*)]
\item 2,70 fm ja 3,5 fm,
\item 4,26 fm ja 5,6 fm,
\item 6,34 fm ja 8,3 fm.
\end{enumerate}
\end{multicols}
\end{document}

If I were to place text between the \paragraph{} and multicols the list items would align themselves just fine:

\documentclass[a4paper,12pt,finnish]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{enumitem}
\usepackage{multicol}

\begin{document}
\paragraph{Vastaukset:}
aaa
\begin{multicols}{3}
\begin{enumerate}[label=\alph*)]
\item 2,70 fm ja 3,5 fm,
\item 4,26 fm ja 5,6 fm,
\item 6,34 fm ja 8,3 fm.
\end{enumerate}
\end{multicols}
\end{document}

The desired alignment

I was unable to find the solution to this specific problem through the search functionality on this site, and would really appreciate any help.

1
  • I think, you should rather look for the tasks package
    – user31729
    Mar 9, 2017 at 20:03

1 Answer 1

1

Use the tasks package which is especially meant for horizontal lists and has a sophisticated interface for configuration of behaviour and typesetting:

\begin{tasks}[counter-format=tsk[a])](3)
    \task \SIrange{2,70}{3,5}{\femto\metre}
    \task \SIrange{4,26}{5,6}{\femto\metre}
    \task \SIrange{6,34}{8,3}{\femto\metre}
 \end{tasks}

will setup a 3-column - wide horizontal list and lowercase 'numbering' (tsk[a]).

The \SIrange command is used to improve the formatting of numbers and units.

\documentclass[a4paper,12pt,finnish]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{tasks}
\usepackage{babel}
\usepackage{siunitx}

\sisetup{range-phrase={ ja }, copy-decimal-marker}

\begin{document}
\paragraph{Vastaukset:}
aaa
\begin{tasks}[counter-format=tsk[a])](3)
\task \SIrange{2,70}{3,5}{\femto\metre}
\task \SIrange{4,26}{5,6}{\femto\metre}
\task \SIrange{6,34}{8,3}{\femto\metre}
\end{tasks}
\end{document}

enter image description here

You must log in to answer this question.

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