由于 1.0 无法识别,我该如何准确自定义分数?
在 MWE 中查看
我喜欢展示点1.0 和 2.0,如果积分是主要 1.001 显示在积分问题中,如何改变这一点
\documentclass[a4paper]{article}
\usepackage{tikz}
\usepackage{needspace}
\usepackage[no-files]{xsim}
\newcommand*\circled[2]{\tikz[baseline=(char.base)]{
\node[shape=circle,fill,inner sep=2pt, text=white] (char) {#1};}}
%%%%%-Custom Xsim exercises %%%%%
\DeclareExerciseEnvironmentTemplate{custom}
{%\item[\GetExerciseProperty{counter}]
\Needspace*{0\baselineskip}
\noindent
\circled{\XSIMmixedcase{\GetExerciseProperty{counter}}}~~~%
\noindent
\IfInsideSolutionF{%
\GetExercisePropertyT{points}{ % notice the space
(%
\printgoal{\PropertyValue}
\IfExerciseGoalSingularTF{points}
{%\XSIMtranslate{point}
}
%{\XSIMtranslate{points}}%
)%
}
}}
{\vspace{\baselineskip}}
\xsimsetup{
collect = false,
exercise/within = section,
exercise/template = custom,
exercise/the-counter = \arabic{exercise},
}
\begin{document}
\begin{exercise}[points=1.0]
Example 1
\end{exercise}
\begin{exercise}[points=1.001]
Example 1
\end{exercise}
\begin{exercise}[points=2.0]
Example 2
\end{exercise}
\begin{exercise}[points=1.5]
Example 3
\end{exercise}
\end{document}
答案1
\documentclass{article}
\usepackage{tikz}
\usepackage{needspace}
\usepackage[no-files]{xsim}
\xsimsetup{
goal-print={\pgfmathprintnumber[fixed zerofill,precision=1]{#1}}
}
\newcommand*\circled[2]{\tikz[baseline=(char.base)]{
\node[shape=circle,fill,inner sep=2pt, text=white] (char) {#1};}}
%%%%%-Custom Xsim exercises %%%%%
\DeclareExerciseEnvironmentTemplate{custom}
{%\item[\GetExerciseProperty{counter}]
\Needspace*{0\baselineskip}
\noindent
\circled{\XSIMmixedcase{\GetExerciseProperty{counter}}}~~~%
\noindent
\IfInsideSolutionF{%
\GetExercisePropertyT{points}{ % notice the space
(%
\printgoal{\PropertyValue}
\IfExerciseGoalSingularTF{points}
{\XSIMtranslate{point}
}
{\XSIMtranslate{points}
}%
)%
}
}}
{\vspace{\baselineskip}}
\xsimsetup{
collect = false,
exercise/within = section,
exercise/template = custom,
exercise/the-counter = \arabic{exercise},
}
\begin{document}
\begin{exercise}[points=1.0]
Example 1
\end{exercise}
%\begin{exercise}[points=1.001]
% Example 1
%\end{exercise}
\begin{exercise}[points=2.0]
Example 2
\end{exercise}
\begin{exercise}[points=1.5]
Example 3
\end{exercise}
\end{document}