
答え1
この動作はバグではありません。内容がそのまま読み取られ、外部ファイルに書き込まれることによる副作用です。
実際、これはマニュアル(演習環境の仕組みに関するセクション 5)に記載されています。
覚えておくべきもう 1 つのこと: 環境は多くの点で環境と同じように動作します
filecontents
。つまり、環境の最初の行にコメントを記述することはできません。\begin{exercise}[points=2] % this comment will cause trouble Lorem ipsum \end{exercise}
コメントを1行下に追加するだけで問題ありません。
\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}