0

I'm trying to create a new environment:

\newenvironment{tasksx}{
    \begin{tasks}[counter-format = (tsk[a]), after-item-skip = -.5ex, before-skip = -2.5em, after-skip = 1em]
        \task
    \end{tasks}
}

But when I try to compile:

Text 
\begin{tasksx}(3)
\task 1
\task 2
\task 3
\task 4
\task 5
\end{tasksx}

I get the error: !Undefined control sequence. \task 1

1 Answer 1

1

In order to define a new environment that behaves like the tasks environment, the tasks package offers the \NewTasks command. The general usage of this command is \NewTasks[〈options〉]{〈name〉}[〈separator〉](〈cols〉) as shown in the following MWE:

\documentclass{article}
\usepackage{tasks}
\NewTasks[counter-format = (tsk[a]), after-item-skip = -.5ex, before-skip = -2.5em, after-skip = 1em]{mytask}[\task](1)
\begin{document}
\begin{mytask}
\task bla
\end{mytask}
\end{document}
6
  • I tried this, but the before-skip doesn't work. It keeps the same space, no matter what I change.
    – mvfs314
    Commented Apr 5, 2018 at 17:45
  • 1
    @mvfs314; You are right. I have been overlooking this. Does before-skip work if you use it as an option to \begin{tasks} in your document?
    – leandriis
    Commented Apr 5, 2018 at 18:05
  • yes, it does work. I'm almost using this in case \NewTasksdoesn't work.
    – mvfs314
    Commented Apr 5, 2018 at 18:16
  • actually, no, before-skip just works when I use it in the preamble with settasks
    – mvfs314
    Commented Apr 5, 2018 at 18:41
  • @mvfs314: That's exactly what I observed. If you want to use the same settings for all tasks environments in your doument, it might be best, to just use \settasks instead of defining an own environment using \NewTasks.
    – leandriis
    Commented Apr 5, 2018 at 18:49

You must log in to answer this question.

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