I'm working on a math book with exercises interspersed within the running text. I have an
ex environment for these exercises and a
sol environment for the solutions. The solutions reside in an appendix at the end of the book. The book is pretty big already and distributed over 40+ files.
Right now, whenever I add an exercise, I add the corresponding solution to the appendix, but I have to make sure the order of solutions in the appendix corresponds to the order of exercises in the book. I have rearranged the order of some chapters a few times and that always was a PITA as I had to manually move the solutions around.
Is there a library similar to something like
endnotes that would allow me to put each solution directly after the corresponding exercise in the source with the outcome that in the final document the solutions would all be moved to their own chapter at the end of the text?
(I'm afraid I couldn't find a meaningful tag for this question. Maybe someone else can.)