cgnieder/xsim

Possible Bug when combining a tabular and an exercise environment

Closed this issue · 3 comments

Sk1nk commented

I tried to narrow it down as much as I could:

\documentclass{minimal}
\usepackage[clear-aux]{xsim}

\begin{document}
\begin{exercise}[points = 10]

\begin{tabular}{p{.7\linewidth} |c|c||c|c|c|c|}
\cline{2-7}
\textbf{Auffälligkeit} & H & B & d & r & a & g\\\cline{2-7}
\end{tabular}
\end{exercise}

\vfill 

\begin{center}
	\gradingtable[template=default*,type=exercise]
\end{center}
\end{document}

creates the following error:

Runaway argument?
\par \begin {tabular}{p{.7\linewidth } |c|c\q_stop \tl_set_rescan:Nnx \ETC.
! File ended while scanning use of \__xsim_extract_property_list_entry:NNNwww.
<inserted text> 
                \par 
<*> BUG.tex
           
! Emergency stop.
<*> BUG.tex
           
!  ==> Fatal error occurred, no output PDF file produced!

From sec. 5 of package doc,
image
You can try with a new separator which is more rare to appear in input, for example, |@|.

\documentclass{article} % \linewidth needs article class
\usepackage[clear-aux]{xsim}
\xsimsetup{split-aux-lists=|@|}
\begin{document}
\begin{exercise}[points = 10]

\begin{tabular}{p{.7\linewidth} |c|c||c|c|c|c|}
\cline{2-7}
\textbf{Auffälligkeit} & H & B & d & r & a & g\\\cline{2-7}
\end{tabular}
\end{exercise}

\vfill 

\begin{center}
	\gradingtable[template=default*,type=exercise]
\end{center}
\end{document}
Sk1nk commented

This solved my problem, thank you!

It is actually a bit nontrivial to find this issue because superficially it appears to be linked to arrays. However, there are many other ways one can run into it, e.g.

\documentclass{article}
\usepackage{xsim}

\DeclareExerciseType{problem}{
 exercise-env = problem ,
 solution-env = answer ,
 exercise-name = Problem ,
 solution-name = Answer ,
 exercise-template = default ,
 solution-template = default
}
 
\begin{document}
\begin{problem}[subtitle=Absolute value]
 Show that the absolute value of the product of two complex numbers equals the product of absolute values.   
\end{problem}

\begin{answer}
   We are to show that 
   $|z_1z_2|=|z_1||z_2|$.%<- error
   %$\vert z_1z_2\vert=\vert z_1\vert\vert z_2\vert$.%<- works  
\end{answer}
\end{document}