Reference another answer

Added by David Dixon about 8 years ago

I'd have a question like this:

Linux is
A) a computer operating system
B) a racecar
C) a penguin
D) both A and C are correct

and have it work with the answers re-ordered. I've tried
\wrongchoice{a computer operating system}\AMClabel{penguin}
\wrongchoice{a racecar}\AMCqlabel{penguin}
\wrongchoice{a penguin}\AMCqlabel{penguin}
\correctchoice{both \AMCref{os} and \AMCref{penguin} are correct}

but I get "both 1 and 1 are correct" (because it's question #1). If I use \AMClabel it doesn't work, and if I use \label with \ref it doesn't work.

Suggestions?


Replies (3)

RE: Reference another answer - Added by David Dixon about 8 years ago

I'm not a LaTeX programmer but I was feeling brave and opened the code for AMC. I figured out I could do this:

\newcommand{\AMCanslabel}[1]{​%
  \protected@write\@auxout{}{\string\newlabel{\the\AMCid@etud-#1}{​{\the\AMCrep@count}{\thepage}}}
}

which gives me the answer number, but not the answer letter. I'm trying to figure out how to turn the number into a letter with no success. I thought maybe \AMCChoiceLabel was the right thing, but apparently not.

RE: Reference another answer - Added by David Dixon about 8 years ago

\newcommand{\AMCanslabel}[1]{ %
  \protected@write\@auxout{}{\string\newlabel{\the\AMCid@etud-#1}{ {\the\AMCrep@count}{\thepage}}}
}

RE: Reference another answer - Added by shreikant kv about 8 years ago

I guess \AMCqlabel is for questions, not choices. A simple work around is to do:
(1) use [o]: ordered choices where you start choices environment: \begin{choices}[o]
(2) Rewrite your last option: \correctchoice{both a comp. os and a penguin}

(1-3/3)