0

I am currently working on an exam template using xsim. I created a custom exercise template which can output indiviual points if the question consists of several subquestions. In the MWE below I now have the following problem:

Compiling as is does output all questions but without question numbers. The grading table does not contain any of the questions and the total point value is displayed as 0.

Already tried:

  • If I include \printcollection{klausur} while inside the collection-environment, the output does contain question numbers and points in the grading table. However this method will not be viable in the final template because I aim to include the datatool package to create multiple exams with pre-filled information e.g. name and id number of our students.
  • If I use the default \begin{exercise} ... \end{exercies} instead of my own template, question numbers and grading table are again visible. This leads me to believe that the problem is with my exercise template. However I am unable to find it.

Any input is appreciated.

\documentclass[12pt,parskip=true,headsepline=true]{scrartcl}
    %%%%%%%%%%%%%%%%%%%%%%%%%%%%Pakete%%%%%%%%%%%%%%%%%%%%%%%%%
    \usepackage[utf8]{inputenc}
    \usepackage[ngerman]{babel}
    \usepackage[most]{tcolorbox}
    %%%%%%%%%%%%%%%%%%%%%%%%%xsim setup%%%%%%%%%%%%%%%%%%%%%%%%
    \usepackage[use-aux]{xsim}
    \xsimsetup{collect}
    %%%%%%%%%%%%%%%%%%%%%Exercise template%%%%%%%%%%%%%%%%%%%%%%
    \DeclareExerciseProperty{subpoints}
    \DeclareExercisePropertyAlias{subpoints}{points}
    \DeclareExerciseEnvironmentTemplate{klausur}
        {%
        \tcolorbox[standard jigsaw,%
        opacityback=0,%
        opacityframe=0,%
        coltitle=black,%
        breakable,%
        drop shadow,%
        beforeafter skip=.5\baselineskip,%
        title= \textbf{\XSIMmixedcase{\GetExerciseName}~\GetExerciseProperty{counter}}%
        \GetExercisePropertyT{points}{%
          \quad
          (%
            \XSIMifeqF{\GetExerciseProperty{subpoints}}{\PropertyValue}
              {$\GetExerciseProperty{subpoints} ={}$}%
            $\printgoal{\PropertyValue}$ \IfExerciseGoalSingularTF{points}{Punkt}{Punkte}% 
          )%
        }%
        ]
        }
        {\endtcolorbox}%
    
    \DeclareExerciseType{klausuraufgabe}{%
      exercise-env = aufgabe ,%
      solution-env = loesung ,%
      exercise-name = Aufgabe ,%
      exercises-name = Aufgabenübersicht ,%
      solution-name = Lösung ,%
      solutions-name = Lösungen ,%
      exercise-template = klausur,%
      solution-template = klausur,%
      exercise-heading = \subsection*,%
      solution-heading = \subsection*%
    }%
    \DeclareExerciseCollection{klausur}%
    
    %%%%%%%%%%%%%%%%%%%%%%%%%Hauptteil%%%%%%%%%%%%%%%%%%%%%%%%
    \begin{document}
    
    \activatecollection{klausur}
    \collectexercises{klausur}
    
    \begin{aufgabe}[points=1]
    First Question.
    \end{aufgabe}
    
    \begin{aufgabe}[points=2]
    Second Question.
    \end{aufgabe}
    
    \begin{aufgabe}[points=1+1+1]
    Third question which consists of 3 subquestions.
    \end{aufgabe}
    
    %\printcollection{klausur}
    \collectexercisesstop{klausur}
    
    \printcollection{klausur}
    \gradingtable
    
    \end{document}

I already asked this question on the german site texwelt.

2
  • Question number is back after commenting out \activatecollection{klausur}. But the grading table still doesn't work. Oct 18, 2023 at 11:09
  • Moving \xsimsetup{collect} after \DeclareExerciseType{klausuraufgabe}{...} solves the grading table part. I will add a full answer later today. Oct 18, 2023 at 11:23

1 Answer 1

2

(originally see this question in https://github.com/cgnieder/xsim/issues/40)

Changes I made

  • Deleted \activatecollection{klausur}. This brings the exercise numbers back.
    xsim provides two pairs of commands for activating and deactivating collections, for the two use cases listed in package doc (v0.21, 2022/02/12), sec. 9.1. "Background", respectively.
    • The first pair is \activatecollection and \deactivatecollection. Activated by \activatecollection, printing of exercises is not disabled when the corresponding exercise environments are processed.
    • The second pair is \collectexercises and \collectexercisesstop. Activated by \collectexercises, printing of exercises is disabled when the corresponding exercise environments are processed.
    • It seems these two pair of commands cannot be used together for the same collection name. Since you used \printcollection{klausur}, I guess what you need is the second pair.
  • Moved \xsimsetup{collect} after \DeclareExerciseType{klausuraufgabe}{...}. This fixes the grading table.
    collect option acts immediately, hence it can only set <exercise type>/collect for all declared <exercise type>s at the moment. All <exercise type>s declared after use of collect option still remain the default setting <exercise type>/collect=false.
  • Deleted unnecessary %s and line \usepackage[utf8]{inputenc}.
    UTF-8 has been the default input encoding since LaTeX2e 2018-04-01, see ltnews, Issue 28.
  • Added \gradingtable[type=klausuraufgabe] using type option to show another possibility.
\documentclass[12pt,parskip=true,headsepline=true]{scrartcl}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%Pakete%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage[utf8]{inputenc} % default since LaTeX2e 
\usepackage[ngerman]{babel}
\usepackage[most]{tcolorbox}
%%%%%%%%%%%%%%%%%%%%%%%%%xsim setup%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage[use-aux]{xsim}
%%%%%%%%%%%%%%%%%%%%%Exercise template%%%%%%%%%%%%%%%%%%%%%%
\DeclareExerciseProperty{subpoints}
\DeclareExercisePropertyAlias{subpoints}{points}

\DeclareExerciseEnvironmentTemplate{klausur}
  {%
    \tcolorbox[standard jigsaw,
      opacityback=0,
      opacityframe=0,
      coltitle=black,
      breakable,
      drop shadow,
      beforeafter skip=.5\baselineskip,
      title={%
        \textbf{\XSIMmixedcase{\GetExerciseName}~\GetExerciseProperty{counter}}%
        \GetExercisePropertyT{points}{%
          \quad
          (%
            \XSIMifeqF{\GetExerciseProperty{subpoints}}{\PropertyValue}
              {$\GetExerciseProperty{subpoints} ={}$}%
            $\printgoal{\PropertyValue}$ \IfExerciseGoalSingularTF{points}{Punkt}{Punkte}% 
          )%
        }%
      }
    ]
  }
  {\endtcolorbox}

\DeclareExerciseType{klausuraufgabe}{
  exercise-env = aufgabe ,
  solution-env = loesung ,
  exercise-name = Aufgabe ,
  exercises-name = Aufgabenübersicht ,
  solution-name = Lösung ,
  solutions-name = Lösungen ,
  exercise-template = klausur,
  solution-template = klausur,
  exercise-heading = \subsection*,
  solution-heading = \subsection*
}

% To set all "<exercise-type>/collect", "collect" option must be used after
% all (new) exercise types are defined.
\xsimsetup{collect}
\DeclareExerciseCollection{klausur}

%%%%%%%%%%%%%%%%%%%%%%%%%Hauptteil%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}

\collectexercises{klausur}

\begin{aufgabe}[points=1]
First Question.
\end{aufgabe}

\begin{aufgabe}[points=2]
Second Question.
\end{aufgabe}

\begin{aufgabe}[points=1+1+1]
Third question which consists of 3 subquestions.
\end{aufgabe}

\collectexercisesstop{klausur}

\printcollection{klausur}

\gradingtable

Just to show the effect of \verb|type=<exercise-type>|\par
\gradingtable[type=klausuraufgabe]

\end{document}

enter image description here

4
  • Thank you very much for your answer (and please excuse my late reply, I got hit with some form of covid shortly after asking and have yet to fully recover). It seems that I will have to go through the documentation again and look up the differences you mentioned. I implemented your changes into my document. However if I move the grading table before the \printcollection, I again lose the individual questions in the grading table, only the total sum of points is displayed. Is it possible to have the (full) grading table printed before printing all questions?
    – Hirshy
    Nov 8, 2023 at 11:40
  • @Hirshy Before \printcollection (and after \collectexercises{klausur}), the exercises of collection klausur are neither used nor printed, hence there's no user interface to loop through such exercises. But a \gradingtable before \collectexercises{klausur} (actually could be place right before the first to-be-collected exercise-like env) works, as it uses info from last run as I guess. Nov 8, 2023 at 17:42
  • @Hirshy BTW, if all your exercises will be printed in the collection order, then you don't have to use the collection feature. Nov 8, 2023 at 17:44
  • I started using the collecetion feature because in the end I want to use the datatool package to create several (identical) exams with personalized front pages for each students. There might be the need for more individual exams based on different criteria, hence why I wanted to use the collection to output only suitable questions. But I guess that will now lead to a different question which is out of reach for this comment/answer. I will get back to reading the documentation and maybe changing my approach for what I want to achieve. Thank you again!
    – Hirshy
    Nov 9, 2023 at 9:04

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .