I am trying to remap the \task to a new command that can take multiple arguments (noting that \NewTasksEnvironment can be used to change \task to \item, but this is not what I am trying to fix here).
I appreciate that the solution must be more nuanced than the below to maintain compatibility with the various tasks features (e.g. \task* or \task!), but nevertheless, trying to make the below work (if possible):
\documentclass{article}
\usepackage{tasks}
\usepackage{xparse}
% Define \itemJ using \NewDocumentCommand
\NewDocumentCommand{\itemJ}{m O{}}{%
\task #1 \\
\textit{Solution}:
#2
}
\begin{document}
\title{Tasks Package Example with \texttt{NewDocumentCommand}}
\author{Your Name}
\date{\today}
\maketitle
\section*{Example Task Lists}
\subsection*{Simple Task List with itemJ}
\begin{tasks}
\itemJ{First item}
\itemJ{Second item}
\itemJ{Third item}
\end{tasks}
\subsection*{Task List with Multiple Columns}
\begin{tasks}(3)
\itemJ{First item}
\itemJ{Second item}
\itemJ{Third item}
\itemJ{Fourth item}
\itemJ{Fifth item}
\itemJ{Sixth item}
\end{tasks}
\subsection*{Task List with Custom Labels}
\begin{tasks}[label=\alph*., label-format={\bfseries}](2)
\itemJ{First item}
\itemJ{Second item}
\itemJ{Third item}
\itemJ{Fourth item}
\end{tasks}
\end{document}
Current no tasks print
\task
just acts as a separator, try\begin{tasks}(3) \task {\meaning\task} \end{tasks}
, yielda) undefined
.tasks
environment looks for explicit use of the control sequence\task
and use that as a separating delimiter to identify (and manipulate) each task. So, without it, the environment assumes there's no tasks and nothing to do.