xsimソリューション環境が印刷された後のコメント

xsimソリューション環境が印刷された後のコメント

solutionパッケージの環境の後にコメントを追加すると、xsimそのコメントはソリューションの前に印刷されます。

ここに画像の説明を入力してください

\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}

答え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}

関連情報