I was wondering if/why it is necessary to have the extra solution for the \blank
exercises, as the question already contains all the informations.
One reason for the question is, that it is extra work to copy and paste the stuff into the solution and this extra step could produce mistakes... Another reason is, that I would love to have the possibility to use the solution/exercise in two different grades.
Grade 1: only the missing words (for an answer-only-sheet), now to be written as:
\begin{solution}
\blank{a}, \blank{b}
\end{solution}
Output:
Solution 1
a,b
Grade 2 (perhaps rather a variation of the exercise than the solution): the whole text with filled blanks, now to be written as:
\begin{solution}
\blank{a} and \blank{b} are the first letters of the alphabet.
\end{solution}
Output:
Solution 1
a and b are the first letters of the alphabet.
So that I can use the filled blanks in the whole text (grade 2) for the trainers workbook where the students have the empty blanks AND additionally use the condensed solution (grade 1) for a combined only-answer-sheet of all the solutions of all exercises at the end of the workbook.
Perhaps there could be a possibility of a \printcollection[print=exercise*]{foo}
that prints the exercises, but with the blanks in the filled-style.
Here a MWE, showing the possible outcome, that compiles as long as the trainer boole is false.
\documentclass{article}
\usepackage{xsim}
\usepackage{etoolbox}
\newcounter{sections}
\newbool{trainer}
%\booltrue{trainer} % if trainer version, activate
\DeclareExerciseCollection{foo}
\DeclareExerciseCollection{ba}
\begin{document}
\section{A}
\collectexercises{foo}
\begin{exercise}
The \blank{a} is the first letter of the alphabet.
\end{exercise}
\begin{solution}
The \blank{a} is the first letter of the alphabet.
\end{solution}
\begin{exercise}
The \blank{b} is the second letter of the alphabet.
\end{exercise}
\begin{solution}
The \blank{b} is the second letter of the alphabet.
\end{solution}
\collectexercisesstop{foo}
\ifbool{trainer}
{\printcollection[print=solution]{foo}} %that is how it should look in the trainers workbook, but I don't want the whole text in the collection of all solutions
{\printcollection{foo}}
\section{B}
\collectexercises{ba}
\begin{exercise}
The \blank{z} is the last letter of the alphabet.
\end{exercise}
\begin{solution}
\blank{z}
\end{solution}
\collectexercisesstop{ba}
\ifbool{trainer}
{\printcollection[print=exercises*]{ba}} %that is what I would like for a kind of command that it prints the filled exercise like in section A if you put the whole text in the solution - perhaps it is rather a \printcollection*[print=exercises]
{\printcollection{ba}}
\section{Answersheet} % solution to number 3 shows how all solutions should look like in the answers-only-sheet
\setcounter{sections}{1}
\whileboolexpr
{ test {\ifnumless{\value{sections}}{\value{section}+1}} }
{
\printsolutions[section=\value{sections},headings-template=per-section]
\stepcounter{sections}
}
\end{document}