TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have already posted a similar question here before, but because it was way too open-like and not defined well, it got closed. I'm giving it another try, this time being a bit more specific. I'm really puzzled why I can't find something like this on Google. I guess I'm search for wrong things because I'm not sure if "workbook" is a correct word anyway.

I want to create a book similar to this one. So it's a list of problems divided in sections and subsections, and after all of them, solutions to problems. The book I want to create is just a collection of problems from a lot of different places, and I'm not yet sure in which order will they go.

So, I want to create some sort of database of problems, where each problem and solution have their unique ID. For example, like this:

[Text of problem, including lots of "$$" and other maths (possibly pictures too?)]
[Solution to the problem above. "ID_001" "tag" is opinional,
I'm fine with typing it if it's gonna make things easier]

Then, I wish to create a standard LaTeX file where I could do something like this:


This file should generate a Part I "Problems" with (in this case only one) title "Geometry", and two subtitles with two problems each (numbered 1.1, 2.1, 2.1, 2.2 or 1, 2, 3, 4 or 1, 2, 1, 2 but NOT 025, 546, 002, 001). After that, a Part II "Solutions" with same structure, but showing respective solutions instead of problems.

I hope you get the idea what I want to achieve. Obviously, the "database" and "commands" i Made up, \problem can be whatever, but I want to achieve effect similar to what I have described, also take a look at the book I have provided, here is the link again.

Please consider pointing me out to some useful links or help me determine what's the package I'm looking for (if it exists), since I'm very stuck. It's hard to find somethign you don't know the name of. And Googling "problems" along with "latex" doesn't really help much for obvious reasons.

EDIT Another thing I forgot to state, I'd also include the source of the problem in database and then, in the end of the book, after solutions, I'd generate a list like, for example:

1.1. Regional competition 2006, 4th grade
1.2. "Number theory" by John Doe

share|improve this question

closed as unclear what you're asking by Keks Dose, Svend Tveskæg, Christian Hupfer, Paul Gaborit, darthbith Jul 27 '15 at 10:40

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question.If this question can be reworded to fit the rules in the help center, please edit the question.

Does this question help: Automating error message references. – Peter Grill Feb 16 '13 at 19:02
I don't think that's it. It doesn't explain how to "divide" problems and solutions in two different parts of text, while keeping correct order. I'm pretty skeptical about the fact that there isn't a package already for creating things like this. I mean, there are loads of "workbooks" with similar style everywhere. List of problems, then list of solutions. I'd just do a simple ordered list, but editing solution for a question would be very complicated since I'd have to "count" where is solution for the problem. – Lazar Ljubenović Feb 16 '13 at 19:13
(La)TeX is Turing-complete, so it can be done. But I'd very much prefer to use a language like Perl to slice and dice the files from a format like you describe to LaTeX documents. – vonbrand Feb 17 '13 at 0:59
I've found [this][math.canterbury.ac.nz/~m.hickman/LaTeX/ProblemsManual.pdf] package. It seems to do almost what I want. But it doesn't mention if I can separate problems from solutions. – Lazar Ljubenović Feb 17 '13 at 7:50
Have you looked at the available packages on ctan under topics exercise? The answers package there looks close to the type of structure you asking for. – Andrew Swann Feb 18 '13 at 10:51

Browse other questions tagged or ask your own question.