My inital problem was finding a solution which allowed me to collect all answers in the exam document class and have them printed at the end of an document. I found this solution click, which satisfies my needs almost perfectly, however, I don't like one thing:
I don't want the box around the solutions! I've tried finding which command actually causes that box to be printed, however, as someone who just started using LaTeX, I couldn't find anything.
I'd really appreciate if someone could guide me to a solution :)
Thanks in advance!
Below, I indicated the whole code from the above-linked thread, for your convenience :):
\documentclass[a4paper]{exam}
\usepackage{xparse}
\printanswers
\ExplSyntaxOn
% Counters are not reset on \end{parts} so I add code to reset them
\tl_put_right:Nn \endparts { \setcounter{partno}{0} }
\tl_put_right:Nn \endsubparts { \setcounter{subpart}{0} }
\tl_put_right:Nn \endsubsubparts { \setcounter{subsubpart}{0} }
\seq_new:N \l_exam_endprint_seq
\seq_new:N \l_exam_endprint_labels_seq
\tl_new:N \l__exam_endprint_temp_tl
\NewDocumentCommand \WriteAnswer { +m } {
\seq_gput_right:Nx \l_exam_endprint_labels_seq {\arabic{question}\alph{partno}\roman{subpart}\greeknum{subsubpart}} \seq_gput_right:Nn \l_exam_endprint_seq { #1 }
}
\NewDocumentCommand \EndPrintAnswers { } {
\seq_map_inline:Nn \l_exam_endprint_seq {
\seq_pop_left:NN \l_exam_endprint_labels_seq \l__exam_endprint_temp_tl
\renewcommand{\solutiontitle}{\noindent\textbf{Solution~\l__exam_endprint_temp_tl}:\enspace}
\begin{solution} ##1 \end{solution}
}
}
\ExplSyntaxOff
\begin{document}
\begin{questions}
\addpoints \question
\begin{parts}
\part This is the first part of question one.
\WriteAnswer{This is the solution to part one of question one.}
\part This is the second part of question one.
\begin{subparts}
\subpart This is the first subpart of the second part of question one.
\WriteAnswer{This is the solution to the first subpart of part two of question one.}
\subpart
\begin{subsubparts}
\subsubpart This is the first subsubpart of the second subpart of the second part of question one.
\WriteAnswer{This is the solution to the first subsubpart of the second subpart of the second part of question one.}
\end{subsubparts}
\end{subparts}
\part This is the third part of question one
\WriteAnswer{This is the solution to part three of question one.}
\end{parts}
\addpoints \question This is the second question.
\WriteAnswer{This is the solution to question two.}
\end{questions}
\EndPrintAnswers
\end{document}
\AtEndEnvironment{parts}{\setcounter{partno}{0}}and similarly for the other two instructions.. It's not necessarily true that\endpartscan be modified with\tl_put_right:Nn. – egreg Aug 12 '22 at 17:31