GeneralGenerating data similar to \toc or \lof

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
angelixd
Posts: 15
Joined: Thu Jul 26, 2007 4:53 pm

Generating data similar to \toc or \lof

Post by angelixd »

Hello everyone,

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!

Recommended reading 2024:

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

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

Post Reply