2

The tasks package forms a list like this

* a * b
* c * d
* e * f

How to configure the package to display such a list

* a * d
* b * e
* c * f

?

Also need to have line alignment as tasks does, multicols does not do this

enter image description here

3
  • No, you also need to have line alignment as well as tasks does, multicols does not do this.
    – Pavel
    Commented Feb 19, 2022 at 8:24
  • 1
    If you want that readers go down first and then move to the next column, alignment has no meaning. You want to vertically align only if the tasks have to be read in the normal reading sense (first left-to-right and then top-to-bottom).
    – egreg
    Commented Feb 19, 2022 at 9:16
  • In theory, you can get used to the format of the tasks package list. The main thing is to have a neat alignment.
    – Pavel
    Commented Feb 19, 2022 at 9:52

1 Answer 1

4

A quick and dirty solution.

With a little manual intervention: save (before the list) your highest item here: \sbox{\myhighitem}{<write here your highest item>}.

Explanation

\newlist{mylist}{enumerate}{10}

creates the new list environment mylist, like enumerate, with at max 10 levels of depth.

\setlist[mylist]{label =\alph*),
  before = \raggedcolumns\begin{multicols}{2},
  after = \end{multicols}}

sets the alphabetical label and the list in two columns with multicols.

\newsavebox{\myhighitem}

creates the box \myhighitem, to know what boxes are, see here: https://en.wikibooks.org/wiki/LaTeX/Boxes.

\newcommand{\myitem}{\item\vphantom{\usebox{\myhighitem}}}

creates a new command for \item that also sets the vertical dimension of the item as the height of \myhighitem. Using \vphantom you set a vertical dimension without writing anything.

\sbox{\myhighitem}{$\dfrac{e+f}{g-h}$}

saves in \myhighitem the string $\dfrac{e+f}{g-h}$.

\documentclass{article}
\usepackage{amsmath}
\usepackage{enumitem}
\usepackage{multicol}
\newlist{mylist}{enumerate}{10}
\setlist[mylist]{label =\alph*),
    before = \raggedcolumns\begin{multicols}{2},
    after = \end{multicols}}

\newsavebox{\myhighitem}
\newcommand{\myitem}{\item\vphantom{\usebox{\myhighitem}}}

\begin{document}
You can use a trick:
\sbox{\myhighitem}{$\dfrac{e+f}{g-h}$}% write here your highest item
\begin{mylist}
\myitem $\dfrac{a+b}{b}$
\myitem $c+d$
\myitem $\dfrac{e+f}{g-h}$
\myitem $m-n$
\myitem $o-p$
\myitem $\dfrac{i+j}{k-l}$
\end{mylist}

You can do it also at ``row level'':
\begin{mylist}
\sbox{\myhighitem}{$\dfrac{a+b}{c}$}% write here your highest item of the first row
\myitem $\dfrac{a+b}{b}$
\sbox{\myhighitem}{$cp$}% write here your highest item of the third row
\myitem $c+d$
\sbox{\myhighitem}{$\dfrac{e+f}{g-h}$}% write here your highest item of the third row
\myitem $\dfrac{e+f}{g-h}$
\sbox{\myhighitem}{$\dfrac{a+b}{c}$}% write here your highest item of the first row
\myitem $m-n$
\sbox{\myhighitem}{$cp$}% write here your highest item of the third row
\myitem $o-p$
\sbox{\myhighitem}{$\dfrac{e+f}{g-h}$}% write here your highest item of the third row
\myitem $\dfrac{i+j}{k-l}$
\end{mylist}
\end{document}

enter image description here

0

You must log in to answer this question.

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