cgnieder / xsim

eXercise Sheets IMproved
65 stars 20 forks source link

xsim interferes with minted #81

Closed poupryc closed 3 years ago

poupryc commented 3 years ago

Hi,

I just updated xsim to v0.20a and a report that used to compile very well before the update no longer compiles. Here is a minimal reproduction.

This code works just fine.

\documentclass{report}
\usepackage{xsim}
\usepackage{minted}

\begin{document}

\section{Exercises}
\begin{exercise}
  This is the first problem.
\end{exercise}

\begin{exercise}[subtitle=Another Problem]
This is the second problem.
\end{exercise}

\end{document}

This one does not.

\documentclass{report}
\usepackage{xsim}
\usepackage{minted}

\begin{document}

\section{Exercises}
\begin{exercise}
  This is the first problem.
\end{exercise}

\begin{exercise}[subtitle=Another Problem]
This is the second problem.

\begin{minted}{java}
public class A {}
\end{minted}
\end{exercise}

\end{document}

log:

1021   │ Runaway argument?
1022   │  
1023   │ ! Paragraph ended before \FV@BeginScanning was complete.
1024   │ <to be read again> 
1025   │                    \par 
1026   │ l.23 \end{exercise}
1027   │                    
1028   │ ? 
1029   │ ! Emergency stop.
1030   │ <to be read again> 
1031   │                    \par 
1032   │ l.23 \end{exercise}
1033   │                    
1034   │ End of file on the terminal!

Thanks for your work,

EDIT: just downgraded to Package: xsim 2020/04/04 v0.19b eXercise Sheets IMproved and everything works fine again. Seems to me like a regression.

cgnieder commented 3 years ago

Please read the xsim manual about writing to external files and verbatim content. It is a well known fact (which has been discussed over and over on tex.stackexchange.com) that you can't have verbatim material inside of macros.

xsim's way out is external files. You need \usepackage[use-files]{xsim}.

Did you realize that the manual even has an example of how to use minted with xsim?

poupryc commented 3 years ago

Sorry for the inconvenience, I didn't think there would be a change in behavior between two minor versions of xsim. I didn't have the idea to read the manual for this reason.

cgnieder commented 3 years ago

Well, from the the start the first section of the manual contains

Please be aware that \xsim\ is in an experimental state and actively developed. Many aspects may change from one update to another until a stable version~1 will be reached.