![xsim:有多个问题的问题](https://linux22.com/image/371555/xsim%EF%BC%9A%E6%9C%89%E5%A4%9A%E4%B8%AA%E9%97%AE%E9%A2%98%E7%9A%84%E9%97%AE%E9%A2%98.png)
使用xsim
,如何输入包含多个部分(问题)的问题,这样可以为每个部分分配一定数量的分数,并自动计算整个问题的总分数。该软件包eqexam
方便地提供了该功能。
答案1
\documentclass{article}
\usepackage[verbose]{xsim}
\usepackage{bophook}
\newcounter{pagepoints}
\DeclareExerciseEnvironmentTemplate{simple}
{\par\noindent\setcounter{pagepoints}{\numexpr\GetExerciseProperty{points}+\value{pagepoints}}{\large\bfseries\theexercise\ }
}
{[points=\GetExerciseProperty{points}]\par}
\xsimsetup{
exercise/within=section ,
exercise/the-counter = \thesection.\arabic{exercise}
,
exercise/template=simple ,
exercise/name=Example ,
solution/template=red}
\AtBeginPage{\setcounter{pagepoints}{0}}
\begin{document}
\section{Test}
\begin{exercise}[points=2]
Lorem ipsum
\end{exercise}
\begin{exercise}[points=8]
second Lorem
\end{exercise}
\vfill\hfill
[total=\thepagepoints]
\pagebreak
\begin{exercise}[points=13]
Lorem ipsum
\end{exercise}
\begin{exercise}[points=7]
second Lorem
\end{exercise}
\vfill\hfill
[total=\thepagepoints]
\end{document}
输出: