2

I am trying to put a task inside another task environment (I am very impressed that nobody has asked this), but it does not work:

\begin{tasks}(1)
    \task Task a)
    \task Task b)
    \begin{tasks}(1)
        \task Task b)1 % or b)1)  ,  or b1)  ,  something like that.
    \end{tasks}
    \task Task c)
\end{tasks}

When I compile I have 7 errors.


Instead of that, I use the inparaenum environment. For example:

\begin{tasks}(1)
    \task Task a)
    \task Task b)

    \begin{inparaenum}[b1)]
        \item Item b1)
        \hfil
        \item Item b2)
        \\
        \item Item b3)
        \hfil
        \item Item b4)
    \end{inparaenum}
    \task Task c)
\end{tasks}

Note that between \item Task b and \begin{inparaenum}[b1)] I added a line break because if not, the text appears immediately after Task b).

But if I run this code:

\begin{tasks}(1)
    \task Task a)

    \begin{inparaenum}[a1)]
        \item Item a1) % it says: 11) Item a1)
        \hfil
        \item Item a2) % it says: 22) Item a2)
        \\
        \item Item a3) % it says: 33) Item a3)
        \hfil
        \item Item a4) % it says: 44) Item a4)
    \end{inparaenum}
    \task Task b)
    \task Task c)
\end{tasks}

I get the following warning:

Package paralist Warning: Incorrect label; no or multiple counters.
(paralist)                The label is: a1) on input line 2435.

For that reason I do not want to work with the inparaenum environment, but yes with the task environment haha. I would like to work with a task within another task. Does anyone know if this is possible?

If not, I would like to solve the second problem.

Thanks!

EDIT:

I have this code now:

\documentclass[11pt]{article}
\usepackage{tasks}

\begin{document}

\begin{enumerate}
    \item 1.
    \item 2.
    \item 3.
    \begin{tasks}(1)
        \task a)
        {\begin{tasks}(2)
            \task a1)
            \task a2)
            \task a3)
            \task a4)
        \end{tasks}}
        \task b)
        \task c)
    \end{tasks}
    \item 4.
    \begin{tasks}(3)
        \task a)
        \task b)
        \task c)
    \end{tasks}
\end{enumerate}

\end{document}

When I compile I get:

Tasks and subtasks

And a Bad Box's message:

Overfull \hbox (27.37506 too wide) in paragraph at lines 22--22

How could I fix those 2 errors?

4
  • You can avoid the compilation errors enclosing the subtask list between curly braces but that not solve others problems. Funnily with your MWE everything will seems correct with this patch, but try with the sublist in other position that b) or with more than one column.
    – Fran
    Commented Jan 14, 2018 at 8:00
  • It's not possible. This is mentioned in the manual of the tasks package section 3.1: “the tasks environment cannot be nested.”
    – cgnieder
    Commented Jan 14, 2018 at 11:55
  • @Fran It does not work :(. If I have a many item and task items the task that is most out starts with d), but the subtasks starts correctly: a), b), c) and d). Are these the problems you were talking about? Thanks.
    – manooooh
    Commented Jan 14, 2018 at 22:47
  • @manooooh yes, the counter goes crazy. Split the main task in two o more columns does not work either if you force a subtasks in this way.
    – Fran
    Commented Jan 15, 2018 at 1:16

1 Answer 1

2

It is not possible to nest a tasks environment in another tasks, but it can be nested in enumerate. As your outer tasks has only one column, here is, hopefully, a solution with enumitem:

\documentclass[11pt]{article}
\usepackage{enumitem} 
\usepackage{tasks}

\begin{document}

\settasks{counter-format =\alph{enumi}tsk[1]), label-width = 1.5em, before-skip = -1ex}
\begin{enumerate}[label = \alph*), wide, leftmargin = *, itemsep = 1ex, after = \setcounter{enumi}{0}]
    \item Task A
    \item Task B

  \begin{tasks}(2)
 \task Item b1)
 \task Item b2)
 \task Item b3)
 \task Item b4)
 \end{tasks}
    \item Task C \begin{tasks}(2)
 \task Item b1)
 \task Item b2)
 \task Item b3)
 \task Item b4)
 \end{tasks}
\end{enumerate}

\end{document} 

enter image description here

5
  • I forgot to mention that there is a list above the task environment. If I put \begin{enumerate} and then \item 1. before \begin{enumerate}[label = \alph*), wide, leftmargin = *, itemsep = 1ex, after = \setcounter{enumi}{0}] the task list always says a1), a2), etc. in the two tasks environment you share. How could I fix that?
    – manooooh
    Commented Jan 14, 2018 at 20:06
  • If you have two levels of lists before, use enumii in the place of enumi, like this: \setup{tasks}{counter-format =\alph{enumii}tsk[1]), ...}.
    – Bernard
    Commented Jan 14, 2018 at 20:52
  • What do you mean? I edited my message adding an example. I clarify that the enumerate list is always one column, but the main task (inside the enumerate) list could have more than one column, and the task inside the task list too.
    – manooooh
    Commented Jan 15, 2018 at 4:56
  • @manooooh: I thought only the lowest level would have more than one column. I don't have time at the moment, I'll look at the problem later if no one has found a solution. Maybe using a two-column environment for the intermediate level would solve it.
    – Bernard
    Commented Jan 15, 2018 at 9:31
  • Ok, I will wait (no hurry :)).
    – manooooh
    Commented Jan 15, 2018 at 20:11

You must log in to answer this question.

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