在 LaTeX 包 XSIM 中,如何在问题后面的括号中获取分数?

在 LaTeX 包 XSIM 中,如何在问题后面的括号中获取分数?

梅威瑟:

\documentclass{article}
\usepackage[verbose]{xsim}
\begin{document}
\begin{exercise}[points = 4]
    Solve the equation \[ 3(x-2) + 7 = x + 3 \]
\end{exercise}
\end{document}

输出:

在此处输入图片描述

我想要(忽略字体差异):

在此处输入图片描述

答案1

通过在序言中添加以下内容“解决”:

\DeclareExerciseEnvironmentTemplate{custom}{%
\GetExerciseHeadingF{\subsection*}%
    {\XSIMmixedcase{\GetExerciseName}\nobreakspace
    \GetExerciseProperty{counter}
\IfInsideSolutionF{%
    \GetExercisePropertyT{points}{\normalfont %
        (%
         \printgoal{\PropertyValue}
         \IfExerciseGoalSingularTF{points}
            {\XSIMtranslate{point}}
            {\XSIMtranslate{points}}%
        )%
    }}%
}%
\par}

\DeclareExerciseType{problem}{
    exercise-env = problem ,
    solution-env = answer ,
    exercise-name = Problem ,
    solution-name = Answer ,
    exercise-template = custom ,
    solution-template = custom
}

现在输出结果为:

在此处输入图片描述

相关内容