0

If I add a comment after the solution environment of the xsim package the comment is printed before the solution.

enter image description here

\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
    The package has a github site where bugs can be reported. But probably is it a side effect of the verbatim reading and writing of the content and difficult to avoid. Put the comment on the next line. – Ulrike Fischer Aug 5 '19 at 14:36
1

This behaviour is not a bug. It is a side effect of the contents being read verbatim and then being written to an external file.

Actually, this is mentioned in the manual (section 5 about how the exercise environments work):

Another thing to keep in mind: the environment in many ways works the same way as the filecontents environment. This also means that you cannot have comments on the first line of the environments:

\begin{exercise}[points=2] % this comment will cause trouble
  Lorem ipsum
\end{exercise}

Just put your comments a line further down and you're fine:

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.