I am writing a textbook using LaTeX. Within the textbook I am using the xsim package to create the exercises and their solutions. I would like the printed textbook to contain the exercises only and I would like to be able to print a separate solution manual with just the solutions (and preserving cross references from the textbook). What is the best way to accomplish this?

1 Answer 1


One approach: If you embed ex&sol and other parts in dedicated environments (\begin{tbd} .. \end{tbd}), you can extract them; tbd stands for to-be-determined, i.e. you either use standards of define your own ones.

See here for some solutions: How to extract equation-environments (or other blocks) inside a Latex document? .

A second approach is to put them into separate files, which you can include in as many documents as needed via \input (modularization).

As you can see, both approaches are the inverse of the other ;-) Perhaps the second one is more practical and easier to organize.

Yes, they both are unspecific to xsim, i.e. will work with almost anything.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .