\documentclass{article} \usepackage{xsim,lipsum,tcolorbox} \DeclareExerciseType{question}{ exercise-env = question , solution-env = hint , exercise-name = Question , solution-name = Hint , exercise-template = default , solution-template = default , counter = exercise % shares a counter with the `exercise' type } \DeclareExerciseType{problem}{ exercise-env = problem , solution-env = answer , exercise-name = Problem , solution-name = Answer , exercise-template = tcolorbox , solution-template = tcolorbox } \DeclareExerciseProperty{grade} \DeclareExerciseProperty{difficulty} \tcbuselibrary{breakable} \DeclareExerciseEnvironmentTemplate{tcolorbox} {% \newcommand*\writehere{% \IfInsideSolutionTF{}{% \tcblower \emph{Your answer:} \vspace*{4cm} }% } \vspace{\baselineskip} \tcolorbox[ colback = red!5!white , colframe = red!75!black , colbacktitle = yellow!50!red , coltitle = red!25!black , fonttitle = \bfseries , subtitle style = { boxrule = 0.4pt , colback = yellow!50!red!25!white } , breakable , title = \GetExerciseName~\GetExerciseProperty{counter} \IfExercisePropertySetT{points}{% (\GetExerciseProperty{points} \IfExerciseGoalSingularTF{points} {\XSIMtranslate{point}} {\XSIMtranslate{points}})% }] \IfInsideSolutionF{% \IfExercisePropertySetT{tags}{% Tags: \ListExerciseTags{tags}{, } \par }% }% } {% \endtcolorbox \vspace{\baselineskip} } \xsimsetup{ % tags = {geometry} , % topics = {geometry} % tags/ingore-untagged % if true untagged exercise will be printed regardless % % which tags have been chosen } \begin{document} \gradingtable \par \bigskip Total: \printtotalpoints \par from questions: \printpoints{question} \par from exercises: \printpoints{exercise} \par from problems: \printpoints{problem} \par \bigskip Total bonus: \printtotalbonus \par from questions: \printbonus{question} \par from exercises: \printbonus{exercise} \par from problems: \printbonus{problem} \par % 1 \begin{exercise}[points=4,bonus-points=1,topics=geometry,tags={geometry,triangles},grade=7] \lipsum[1] \begin{verbatim} foo x^2 y^3 \gna \end{verbatim} \end{exercise} \begin{solution}[print] This is the solution to \ExerciseType\ \GetExerciseProperty{counter}. \begin{verbatim} foo x^2 y^3 \gna \end{verbatim} \end{solution} % 2 \begin{exercise}[subtitle=Foo,points=5,topics=analysis,tags={analysis,functions},grade=11] \lipsum[2] \end{exercise} \begin{solution} This is the solution to \ExerciseType\ \GetExerciseProperty{counter}. \end{solution} % 3 \begin{problem}[tags={analysis,functions}] \lipsum[3] \writehere \end{problem} \begin{answer} This is the solution to \ExerciseType\ \GetExerciseProperty{counter}. \end{answer} % 4 \begin{question} \lipsum[4] \verb+\ExerciseID+: \GetExerciseAliasProperty{ID} \verb+\GetExerciseProperty{id}+: \GetExerciseProperty{id} \verb+\GetExerciseAliasProperty{ID}+: \GetExerciseAliasProperty{ID} \verb+\GetExerciseProperty{ID}+: \GetExerciseProperty{ID} \end{question} \begin{hint} This is the solution to \ExerciseType\ \GetExerciseProperty{counter}. \end{hint} % 5 \begin{problem}[points=2] \lipsum[3] \verb+\ExerciseID+: \GetExerciseAliasProperty{ID} \verb+\GetExerciseProperty{id}+: \GetExerciseProperty{id} \verb+\GetExerciseAliasProperty{ID}+: \GetExerciseAliasProperty{ID} \verb+\GetExerciseProperty{ID}+: \GetExerciseProperty{ID} \writehere \end{problem} \begin{answer} This is the solution to \ExerciseType\ \GetExerciseProperty{counter}. \end{answer} % 6 \begin{problem}[points=1] \lipsum[3] \verb+\ExerciseID+: \GetExerciseAliasProperty{ID} \verb+\GetExerciseProperty{id}+: \GetExerciseProperty{id} \verb+\GetExerciseAliasProperty{ID}+: \GetExerciseAliasProperty{ID} \verb+\GetExerciseProperty{ID}+: \GetExerciseProperty{ID} \end{problem} \begin{answer} This is the solution to \ExerciseType\ \GetExerciseProperty{counter}. \end{answer} % 7 \begin{exercise}[ID=test] \lipsum[5] \verb+\ExerciseID+: \GetExerciseAliasProperty{ID} \verb+\GetExerciseProperty{id}+: \GetExerciseProperty{id} \verb+\GetExerciseAliasProperty{ID}+: \GetExerciseAliasProperty{ID} \verb+\GetExerciseProperty{ID}+: \GetExerciseProperty{ID} \end{exercise} \begin{solution} This is the solution to \ExerciseType\ \GetExerciseProperty{counter}. \end{solution} % 8 \begin{exercise}[print=false,use=false] \lipsum[5] \end{exercise} \begin{solution} This is the solution to \ExerciseType\ \GetExerciseProperty{counter}. \end{solution} % \printsolutionstype{exercise} \printsolutions* \section{Statistics} \ForEachUsedExerciseByType{% \noindent\XSIMmixedcase{\ExerciseParameterGet{#1}{exercise-name}}~#3: \\ \hspace*{2em}id: #2, type: #1, subtitle: #4, points: #5, bonus: #6\par \medskip } \bigskip \ForEachUsedExerciseByID{% \noindent\XSIMmixedcase{\ExerciseParameterGet{#1}{exercise-name}}~#3: \\ \hspace*{2em}id: #2, type: #1, subtitle: #4, points: #5, bonus: #6\par \medskip } \bigskip \ForEachUsedExerciseByType{% \ExercisePropertyIfSetT{#1}{#2}{points} { \XSIMmixedcase{\ExerciseParameterGet{#1}{exercise-name}}~#3: #5~points\par }% } \bigskip Number of questions: \numberofquestions \par Number of exercises: \numberofexercises \par Number of problems: \numberofproblems \section{Grading tables} \gradingtable[template=default*,type=exercise] \par \bigskip \gradingtable[template=default*,type=problem] \par \bigskip \gradingtable[template=default*] \par \bigskip % vertical \gradingtable[type=exercise] \par \bigskip \gradingtable[type=problem] \par \bigskip \gradingtable \end{document}