Document ClassesManaging exercises with solutions in textbooks

Information and discussion about specific document classes and how to create your own document classes.
Post Reply
bjornarl
Posts: 3
Joined: Wed Jan 14, 2009 4:43 pm

Managing exercises with solutions in textbooks

Post by bjornarl »

Hi to you all,

I am writing a college math textbook using the memoir class. As with all textbooks there are lots of exercises scattered throughout, with solutions in the back. I want LaTeX to handle this for me, and I want to be able to write something like this:

Code: Select all

\begin{exercise)
< the text of the exercise, maybe with parts a), b),...>
\begin{solution}
< solution text >
\end{solution}
\end{exercise}
I want LaTeX to automatically number the exercises and the corresponding solutions, printing the exercise text where it appears, and the solution(numbered correspondingly) in an appendix in the back.

My point is to be able to write the exercise together with its solution at the same point in my input file and have LaTeX separate them for me and place the solution text somewhere else. Is this at all possible?

Best regards,
Bjørnar Larssen
Last edited by cgnieder on Tue Oct 09, 2012 12:49 pm, edited 1 time in total.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

User avatar
nlct
Posts: 276
Joined: Thu Nov 06, 2008 11:15 am

Managing exercises with solutions in textbooks

Post by nlct »

Hi,

I don't know if this is quite what you want, but you can use the probsoln package to define the exercises and solutions. You'll need the latest version (v3.0) if you want the solutions in a separate place. You'll need something else to handle the actual numbering. Check the sample file sample5.tex that comes with the package. (It should be in the doc/latex/probsoln/samples/ directory of your TEXMF tree.)

Regards
Nicola Talbot
bjornarl
Posts: 3
Joined: Wed Jan 14, 2009 4:43 pm

Re: Managing exercises with solutions in textbooks

Post by bjornarl »

Thanks for your reply. I will look into it.

Bjørnar
hindmost
Posts: 2
Joined: Thu May 14, 2009 12:57 am

Re: Managing exercises with solutions in textbooks

Post by hindmost »

Wouldn't it be easier to use multiple source files and then including the question subfiles and answer subfiles at the appropriate points? It sounds like a job for make rather than pure LaTeX
Post Reply