![XSIM 练习标题问题](https://linux22.com/image/435551/XSIM%20%E7%BB%83%E4%B9%A0%E6%A0%87%E9%A2%98%E9%97%AE%E9%A2%98.png)
如果我使用 XSIM 包创建第一个练习,并带有特定的副标题,则所有内容都会正确排版。但是,当练习的主体更改为另一个没有副标题的练习时,旧的副标题仍然存在,而它不应该显示。你知道为什么吗?
平均能量损失
\documentclass[oneside]{scrbook}
\usepackage{xcolor,lipsum,hyperref}
\usepackage[use-files,blank,clear-aux]{xsim}
%
\DeclareExerciseHeadingTemplate{custom}{\XSIMtranslate{default-heading}}
%
\DeclareExerciseEnvironmentTemplate{custom}
{%
\IfExistSolutionTF
{%
\IfInsideSolutionTF
{%
\label{sol:\ExerciseID}
}
{%
\label{ex:\ExerciseID}
}
}{}%
\IfInsideSolutionTF
{%
{\color{green}\bfseries\XSIMmixedcase{\GetExerciseName}~(\GetExerciseParameter{exercise-name}%
~\GetExerciseProperty{counter})}%
}
{%
{\color{orange}\bfseries\XSIMmixedcase{\GetExerciseName}~\GetExerciseProperty{counter}}~{\color{black}\bfseries\itshape\GetExercisePropertyT{subtitle}{\PropertyValue}}%
}
\IfExistSolutionTF
{%
\IfInsideSolutionTF
{%
{\color{gray}\footnotesize{\big(Énoncé:\pageref{ex:\ExerciseID}\big)}~}%
}
{%
{\color{gray}\footnotesize{\big(Solution:\pageref{sol:\ExerciseID}\big)}~}
}%
}%
{}%
}{}
% Traductions
\DeclareExerciseType{exercice}{
exercise-env = exo ,
solution-env = sol ,
exercise-name = \XSIMtranslate{exercise} ,
exercises-name = \XSIMtranslate{exercises} ,
solution-name = \XSIMtranslate{solution} ,
solutions-name = \XSIMtranslate{solutions} ,
exercise-template = custom ,
solution-template = custom ,
exercise-heading = custom ,
solution-heading = custom
}
%
\xsimsetup{
print-solutions/headings-template = custom ,
print-solutions/headings = false ,
}
%
\begin{document}
\chapter{First chapter}
% First typesetting :
%\begin{exo}[subtitle={Test}]
%\lipsum[1]
%\end{exo}
\begin{exo}
\lipsum[1]
\end{exo}
\begin{sol}
\lipsum[1]
\end{sol}
\printsolutions*
\end{document}