I am trying to work out a special document that through a seed generates a test for my students. I have gotten quite alot to work but I have the issue that when I try to add my answers into an array (which I use to store the answers to be printed on a seperate sheet for myself).
\newcommand\setans[2]{%
\csdef{answer#1}{#2}}
\newcommand\addans[1]{%
\stepcounter{a}%
\csdef{answer\thea}{#1}}
\newcommand\getans[1]{%
\csuse{answer#1}}
This is what I use for my array and I store things in the manner of
\addans{\answer}
the issue is of course due to my algorithms the \answer
variable changes along the line so when it comes to the end of the document it will just display for all positions the last \answer
's value, is there a way to extract the text of \answer
that I then use on \addans
, or another way to go about it?
Best regards
\documentclass
and the appropriate packages that sets up the problem. While solving problems can be fun, setting them up is not. Then, those trying to help can simply cut and paste your MWE and get started on solving the problem. In this specific case it would go a long way towards clearing up any confusion as to your intent.