4

Is there a way to start with a higher counter within the tasks package.

I tried counter-format = (tsk[c]) but that did not work.

  • Welcome to TeX.SX! Please post compilable document examples, not just fragments of code – user31729 Jan 16 '16 at 12:04
4

I don't see how the setting of the counter is possible directly from the tasks package code, but perhaps I've overlooked some feature.

Anyway, tasks does not really use a traditional counter but is applying the expl3 int variable features. The task number is stored in \g__tasks_int, a global variable (but it is actually an internal one, because of the double underscore __ naming convention), which can be set using \int_gset:Nn.

However, this requres switching to \ExplSyntaxOn...\ExplSyntaxOff and defining a new command, say \SetTaskNumber, which can be used right after the \task command that should get the new number.

Setting outside of \begin{tasks} is not possible, since tasks resets the task number.

Be aware, that tasks have a resume feature -- this might break with this setting.

\documentclass{article}
\usepackage{tasks}

\ExplSyntaxOn
\newcommand{\ShowTaskNumber}{
  \int_use:N \g__tasks_int
}
\newcommand{\SetTaskNumber}[1]{
  \int_gset:Nn \g__tasks_int {#1}
}
\ExplSyntaxOff

\begin{document}
\begin{tasks}(2)
  \task\SetTaskNumber{5} Foo \ShowTaskNumber
  \task Bar \ShowTaskNumber
\end{tasks}
\end{document}

enter image description here

  • @clemens: Yes, that's true -- it's internal. But I suggest to provide an interface to access the 'counter' value ;-), something like enumitem package's start=... – user31729 Jan 16 '16 at 13:02
1

Since v1.0 (2019/10/04) tasks uses a standard counter named task:

\documentclass{article}
\usepackage{tasks}[2019/10/04]% v1.0 or newer
\begin{document}

\setcounter{task}{17}
\begin{tasks}[resume](3)
  \task foo \task bar \task baz
\end{tasks}

\end{document}

enter image description here


Version 1.1 will also support an option called start in order to set the value directly:

\documentclass{article}
\usepackage{tasks}[2019/11/03]% v1.1 or newer
\begin{document}

\begin{tasks}[start=18](3)
  \task foo \task bar \task baz
\end{tasks}

\end{document}

with the same output as above.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.