![xsim解決方案環境列印後的註釋](https://rvso.com/image/399819/xsim%E8%A7%A3%E6%B1%BA%E6%96%B9%E6%A1%88%E7%92%B0%E5%A2%83%E5%88%97%E5%8D%B0%E5%BE%8C%E7%9A%84%E8%A8%BB%E9%87%8B.png)
答案1
此行為不是錯誤。這是逐字讀取內容然後寫入外部文件的副作用。
實際上,手冊中提到了這一點(第 5 節關於運動環境如何運作):
另一件需要記住的事情是:環境在許多方面與
filecontents
環境的運作方式相同。這也意味著您不能對環境的第一行進行註釋:\begin{exercise}[points=2] % this comment will cause trouble Lorem ipsum \end{exercise}
只要把你的評論放在下面一行就可以了:
\documentclass[]{article}
\usepackage{xsim}
\begin{document}
\begin{exercise}
% execice 1
Statement of exercise 1
\end{exercise}
\begin{solution}[print]
% I need a comment here
Solution of exercise 1
\end{solution}
\end{document}