General ⇒ Generating data similar to \toc or \lof
Generating data similar to \toc or \lof
I am typesetting a class for generating tests, and I would like to auto-generate an answer key at the end. I find that the syntax for \addcontentsline{}{}{} would work perfect for me, as I can just embed it directly into my question macro without any serious finagling and I have a counter for it set up already.
My question is, how do I go about defining a \answerkey macro, and a correct list so that I can just type something like \addcontentsline{ans}{\arabic{Qcount}}{#3} ? I assume that I would have to deal with some file I/O in latex, but it would be helpful if this stuff has already been defined; in particular, things like \@starttoc{}. Any sort of direction would be appreciated. Thanks!
Learn LaTeX easily with newest books:
The LaTeX Beginner's Guide: 2nd edition and perfect for students writing a thesis
The LaTeX Cookbook: 2nd edition full of practical examples for mathematics, physics, chemistry, and more
LaTeX Graphics with TikZ: the first book about TikZ for perfect drawings in your LaTeX thesis