#StackBounty: #macros #tasks How to define shorcuts for the tasks package with def?

Bounty: 50

I tried to define the shortcuts

documentclass{article}

usepackage{tasks}

defbqcmt{begin{tasks}(2)}
defeqcmt{end{tasks}}
defmyitem{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?

edit

The following works

documentclass{article}
usepackage{tasks}

defbqcmt{csname tasksendcsname(3)}
defeqcmt{endtasks}
defmyitem{csname endtasksendcsname}

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 tasksendcsname(#1)}
defeqcmt{endtasks}
defmyitem{csname endtasksendcsname}

begin{document}
bqcmt{3}
task This is a test
task This is a test
task This is a test
eqcmt
end{document}

But is it a good idea?


Get this bounty!!!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.