如何使用 xsim 包进行子练习或练习部分?

如何使用 xsim 包进行子练习或练习部分?

我经常会看到,并且自己也会创建由多个子练习或部分组成的练习,如下所示:

# Exercise 1
Two cars are traveling in opposite directions. 
They are 2.7km apart, driving 50km/h and 65km/h, respectively.
a) Write the equations of motion for the two cars.
b) Find the time t at which the two cars will meet.
c) Find the distance traveled by the cars when they meet.

据我所知,这不是 xsim 包直接提供的功能。有没有关于如何通过其他方式实现此功能的建议?

使用枚举或逐项环境的解决方案有效,但也许还有其他方法。

\documentclass{article}
\usepackage{xsim}
\begin{document}
\begin{exercise}
Two cars travel ....
\begin{enumerate}
\item Write the equations ...
\item Find the time ...
\item Find the distance ...
\end{enumerate}
\end{exercise}
\end{document}

如果使用类似上述的解决方案,则必须手动在练习和解决方案环境中保持子练习或部分的顺序相同。

答案1

我只需使用enumeratetasks(来自tasks包)。

\documentclass{article}
\usepackage{xsim,tasks,siunitx}

\begin{document}

\begin{exercise}[subtitle=Cars]
  Two cars are traveling in opposite directions. They are
  \SI{2.7}{\kilo\meter} apart, driving \SI{50}{\kilo\meter\per\hour} and
  \SI{65}{\kilo\meter\per\hour}, respectively.
  \begin{tasks}(2)
    \task Write the equations of motion for the two cars. (\addpoints{1})
    \task Find the time $t$ at which the two cars will meet. (\addpoints{2})
    \task Find the distance traveled by the cars when they
      meet. (\addpoints{2})
  \end{tasks}
\end{exercise}

\end{document}

在此处输入图片描述


根据您的设置,也可能xsim直接使用 的环境进行子练习。此处可以找到一个示例:在exsheets中随机选择子问题

相关内容