I tried to define the shortcuts
\documentclass{article}
\usepackage{tasks}
\def\bqcmt{\begin{tasks}(2)}
\def\eqcmt{\end{tasks}}
\def\myitem{\task}
\begin{document}
\bqcmt
\myitem This is a test
\eqcmt
\end{document}
But it does not work. The error is:
LaTeX Error: \begin{tasks} on input line 10 ended by \end {document}.
See the LaTeX manual or LaTeX Companion for explanation. Type H for immediate help. ...
l.13 \end{document}
Why is it so? How can I define such shorcuts?
A solution ?
The following seems to work
\documentclass{article}
\usepackage{tasks}
\def\bqcmt{\csname tasks\endcsname(3)}
\def\eqcmt{\endtasks}
\def\myitem{\csname endtasks\endcsname}
\begin{document}
\bqcmt
\task This is a test
\task This is a test
\task This is a test
\eqcmt
\end{document}
as well as
\documentclass{article}
\usepackage{tasks}
\newcommand{\bqcmt}[1]{\csname tasks\endcsname(#1)}
\def\eqcmt{\endtasks}
\def\myitem{\csname endtasks\endcsname}
\begin{document}
\bqcmt{3}
\task This is a test
\task This is a test
\task This is a test
\eqcmt
\end{document}
My new question ?
But I'm wondering if it is a good idea. Indeed, \begin{tasks}
will normally scan the rest of the file for an \end{tasks}
. With this "hack", I guess that this scan will not happen.
\tasks{2}
and\endtasks
(untested)\begin
is simply\csname #1\endcsname
and\end
is\csname end#1\endcsname
.