xsim 输出的打印问题集没有问题编号

xsim 输出的打印问题集没有问题编号

我目前正在使用 xsim 制作考试模板。我创建了一个自定义练习模板,如果问题包含多个子问题,它可以输出单独的分数。在下面的 MWE 中,我现在遇到以下问题:

按原样编译会输出所有问题,但没有问题编号。评分表不包含任何问题,总分值显示为 0。

已经尝试过:

  • 如果我在收集环境中包含 \printcollection{klausur},则输出确实包含评分表中的问题编号和分数。但是,这种方法在最终模板中不可行,因为我打算包含 datatool 包来创建多个带有预填信息(例如学生的姓名和 ID 号)的考试。
  • 如果我使用默认的 \begin{exercise} ... \end{exercies} 而不是我自己的模板,问题编号和评分表又会显示出来。这让我相信问题出在我的练习模板上。但我找不到它。

任何意见都值得赞赏。

\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}

我已经在德国网站上问过这个问题了纺织世界

答案1

(最初看到这个问题https://github.com/cgnieder/xsim/issues/40

我做的改变

  • 已删除\activatecollection{klausur}。这会将练习编号带回来。
    xsim提供两对用于激活和停用集合的命令,分别用于包文档(v0.21,2022/02/12)第 9.1 节“背景”中列出的两个用例。
    • 第一对是\activatecollection\deactivatecollection。由 激活\activatecollection,在处理相应的练习环境时不会禁用练习的打印。
    • 第二对是\collectexercises\collectexercisesstop。由 激活\collectexercises,打印练习在处理相应的练习环境时禁用。
    • 看来这两对命令不能同时用于同一个集合名称。由于您使用了\printcollection{klausur},我猜您需要的是第二对。
  • 移至\xsimsetup{collect}之后\DeclareExerciseType{klausuraufgabe}{...}。这将修复评分表。选项立即生效,因此目前
    collect只能<exercise type>/collect为所有声明的s 设置。使用选项后声明的所有 s 仍保持默认设置。<exercise type><exercise type>collect<exercise type>/collect=false
  • 删除了不必要的%s 和行\usepackage[utf8]{inputenc}
    自 LaTeX2e 2018-04-01 以来,UTF-8 一直是默认输入编码,请参阅ltnews,第 28 期
  • 添加了\gradingtable[type=klausuraufgabe]使用type选项来显示另一种可能性。
\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}

在此处输入图片描述

相关内容