Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use of \thetask in the tasks environment is messed up #24

Closed
dejanziv opened this issue Mar 10, 2021 · 2 comments
Closed

Use of \thetask in the tasks environment is messed up #24

dejanziv opened this issue Mar 10, 2021 · 2 comments

Comments

@dejanziv
Copy link

dejanziv commented Mar 10, 2021

Use of \thetask in the tasks environment is messed up in the latest version 1.3a, as illustrated in the attached minimal example. With previous version 1.3 the example works just fine.
brokentasks.pdf

\documentclass{article}

\usepackage{tasks}

\newif\ifshowanswers
\showanswersfalse
\showanswerstrue% comment this out if you do not want to show correct answers

\newcommand{\correct}{%
\ifshowanswers
  {\bfseries\thetask}
\else
  \thetask
\fi
}

\begin {document}

A tricky question follows:

\begin{tasks}(1)%
%
\task[\correct] Correct answer 1.
\task Wrong answer 1.
\task Wrong answer 2.
\task Wrong answer 3.
\task[\correct] Correct answer 2.
%
\end{tasks}

\end{document}
@dejanziv dejanziv changed the title Usa of \thetask in the tasks environment is messed up Use of \thetask in the tasks environment is messed up Mar 10, 2021
@cgnieder
Copy link
Owner

The change is due to #23. This should never have worked in the first place. Here is a working version:

\documentclass{article}
\usepackage{tasks}

\newif\ifshowanswers
\showanswerstrue

\newcommand{\correct}{%
  \refstepcounter{task}%
  \ifshowanswers
    \bfseries
  \fi
  \thetask
}

\begin {document}

A tricky question follows:

\begin{tasks}
  \task[\correct] Correct answer 1.
  \task Wrong answer 1.
  \task Wrong answer 2.
  \task Wrong answer 3.
  \task[\correct] Correct answer 2.
\end{tasks}

\end{document}

@dejanziv
Copy link
Author

dejanziv commented Mar 14, 2021 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants