Lassen Sie \numquestions\ die Bonusfragen nicht zählen

Lassen Sie \numquestions\ die Bonusfragen nicht zählen

Ich möchte \numquestions und \numparts verwenden, ohne dass diese die Bonusfragen und -teile mitzählen, so wie es \numpoints tut. Wie kann ich das erreichen?

Um ein Beispiel zu verwenden: Ich möchte, dass Folgendes gesagt wird:Diese Prüfung enthält 2 Fragen und eine Bonusfrage."

\documentclass[addpoints]{exam}

\begin{document}
This exams contains \numquestions\ questions and a bonusquestion.

    \begin{questions}
    \question[100]
    Is this the first question?
    \question[100]
    Is this the second question?
    \bonusquestion[100]
    Does this question count?
    \end{questions}
    
\end{document}

Antwort1

Verwenden des Pakets totcountund der Befehle \qquestionund \bbonusquestionanstelle von \questionund \bonusquestion.

A

\documentclass[addpoints]{exam}
    
%****************************** added <<<<<<<<<<<<<<<<<<
\usepackage{totcount}
\newtotcounter{q}
\setcounter{q}{0}
\newtotcounter{b}
\setcounter{b}{0}
\newcommand{\qquestion}[0]{\stepcounter{q}\question}
\newcommand{\bbonusquestion}[0]{\stepcounter{b}\bonusquestion}
%****************************** 
    
\begin{document}
    
This exams contains \total{q}\ question(s) and \total{b}\ bonusquestion(s).
    
    \begin{questions}
        \qquestion[100]
        Is this the first question?
        \qquestion[100]
        Is this the second question?
        \bbonusquestion[100]
        Does this question count?
        \bbonusquestion[100]
        Does this question count?       
    \end{questions}
    
\end{document}

Inspiriert durchZählen Sie die Anzahl der Fragen separat ...

verwandte Informationen