I'm writing a textbook and an accompanying solution manual. In the book, I have a series of exercises at the end of each chapter. As the number of chapters and exercises grows, I'm getting to the point where it's easy to get the ordering of the exercises and solutions mixed up. So what I'm looking for is a simple but effective way to always have them in a consistent order.
What I thought about, but don't know to implement (yet), is that each exercise and the corresponding solution would be located in one tex file. I could then \input that file in the book and the manual in the appropriate location, and (through an as of yet undetermined mechanism), only the exercise or the solution would be input. I also thought that I could create a separate "master" tex file for each chapter that in turn inputs the exercise/solution tex files. Then I simply input that "master" tex file in the book and the manual. In this way, it would be impossible to get the ordering mixed up.
In UNIX, I guess one way of accomplishing this would be true environment variables, but I don't know whether this is possible in LaTeX and whether this would be sensible.
Thanks in advance for criticisms, ideas, feedback.


answerspackage- have a look at the questions with the answers tag. With that in mind, I'd be tempted to call this a duplicate – cmhughes Sep 07 '12 at 21:44