Forums » Using AMC (english) »
\AMClable and \AMCref for questions
Added by VInay Wagh almost 12 years ago
How can I refer to one question in the same test/group from another question?
For example: I would like to use these commands in the following manner:
\element{DCQ}{ \begin{question}{Q1}\AMClable{Q1} The first question goes here. \begin{choiceshoriz}[o] \correctchoice{TRUE} \wrongchoice{FALSE} \end{choiceshoriz} \end{question} } \element{DCQ}{ \begin{question}{Q2} Please refer to Question no \AMCref{Q1} on page \AMCpageref{Q1}. The second question goes here which \begin{choiceshoriz}[o] \wrongchoice{TRUE} \correctchoice{FALSE} \end{choiceshoriz} \end{question} }
VInay
Replies (8)
RE: \AMClable and \AMCref for questions - Added by Alexis Bienvenüe almost 12 years ago
You can add the following code at the beginning of the document, and use \AMCqlabel
instead of \AMClabel
. The new command \AMCqlabel
has just been added in revision r1318.
\makeatletter \newcommand{\AMCqlabel}[1]{\protected@write\@auxout{}{\string\newlabel{\the\AMCid@etud-#1}{\thepage}}}} \makeatother
RE: \AMClable and \AMCref for questions - Added by Akim Demaille almost 11 years ago
It does not work for me. When I replace an \AMClabel with \AMCqlabel, I get:
/Users/akim/src/lrde/cours-ccmp/exams/thl/qcm-2016.tex:66: Argument of \Hy@setref@link has an extra }. <inserted text> \par l.66 } Runaway argument? {\@firstoffive }\fi avec des directives précisant correctement prio\ETC. /Users/akim/src/lrde/cours-ccmp/exams/thl/qcm-2016.tex:66: Paragraph ended before \Hy@setref@link was complete. <to be read again> \par l.66 } Overfull \hbox (9.1447pt too wide) in paragraph at lines 66--66 \OT1/cmr/bx/n/10.95 Q.29 | \OT1/cmr/m/n/10.95 Ter-mi-ner la s^^Sequence de d^^Secalages/r^^Seductions sui-vante pour un par-ser Yacc/-Bi-son impl^^Sementant /Users/akim/src/lrde/cours-ccmp/exams/thl/qcm-2016.tex:66: Extra }, or forgotten \endgroup. <recently read> } l.66 } /Users/akim/src/lrde/cours-ccmp/exams/thl/qcm-2016.tex:66: Extra }, or forgotten \endgroup. \\insertgroup ...\AMCtok@ik <\AMCtok@max \repeat } l.66 } [5] /Users/akim/src/lrde/cours-ccmp/exams/thl/qcm-2016.tex:66: Extra }, or forgotten \endgroup. \iterate ...1]{problem} \QCMfooter {} \clearpage } \advance \AMCid@etud \@ne ... l.66 } /Users/akim/src/lrde/cours-ccmp/exams/thl/qcm-2016.tex:68: LaTeX Error: \begin{question} on input line 66 ended by \end{document}. See the LaTeX manual or LaTeX Companion for explanation. Type H <return> for immediate help. ...
Does it ring any bell? I don't have time right now to try to make a small self-contained test, I'm just asking if someone knows what's going on.
Btw, this is still not documented.
RE: \AMClable and \AMCref for questions - Added by Akim Demaille over 10 years ago
I had the problem again, and now I know why: I used colons (:) in my reference name. Colon is most probably special in French, so it must be an active character. However AMClabel is happy with it, contrary to AMCqlabel.
RE: \AMClable and \AMCref for questions - Added by Akim Demaille over 10 years ago
Sorry, ignore my previous message, it still does not work at all, even without any special character.
RE: \AMClable and \AMCref for questions - Added by Alexis Bienvenüe over 10 years ago
Can you post a minimal working source file that shows the problem?
RE: \AMClable and \AMCref for questions - Added by Akim Demaille over 10 years ago
Hi Alexis,
So, once reduced, it shows that this is a clash bw hyperref and amc.
bug-amc.tex (431 Bytes)
RE: \AMClable and \AMCref for questions - Added by Alexis Bienvenüe over 10 years ago
OK. Do you need hyperref
with AMC?
RE: \AMClable and \AMCref for questions - Added by Akim Demaille over 10 years ago
I have this big stack of macros that are used both to generate the lecture notes, the slides, and the exams. If I don't need hyper ref for the exam, but I do for all the rest; it does make my life more complex if I have to have my macros and styles be compatible with not having hyperref.
(1-8/8)