problem with \insertgroup[n]{groupname}

Added by Stan Reeves about 1 month ago

When I use this command with a number option, I'm getting many errors saying:

question ID used several times for the same paper: "question-id" [1]

If I take out the number option, it works fine. I don't have any duplicate question IDs.

Any suggestions?

I've also tried \copygroup5{groupname} and get the same error.


Replies (8)

RE: problem with \insertgroup[n]{groupname} - Added by Alexis Bienvenüe about 1 month ago

Can you post a minimal reproducible example?

RE: problem with \insertgroup[n]{groupname} - Added by Stan Reeves about 1 month ago

This works without the [2] argument but not with the [2].

I'm using version 1.5.1.

\documentclass{article}

\usepackage[box,completemulti,nowatermark]{automultiplechoice}

\begin{document}

\AMCrandomseed{1237894}

\element{general}{

\begin{question}{Q1}
Question
\begin{choices}
\wrongchoice{one}
\correctchoice{two}
\end{choices}
\end{question}

\begin{question}{Q2}
Question
\begin{choices}
\wrongchoice{one}
\correctchoice{two}
\end{choices}
\end{question}

\begin{question}{Q3}
Question
\begin{choices}
\wrongchoice{one}
\correctchoice{two}
\end{choices}
\end{question}

}

\onecopy{1}{

\shufflegroup{general}
\insertgroup2{general}
%\insertgroup{general}

}

\end{document}

RE: problem with \insertgroup[n]{groupname} - Added by Frédéric Bréal about 1 month ago

The good way is

\element{general}{
\begin{question}{Q1}
Question
\begin{choices}
\wrongchoice{one}
\correctchoice{two}
\end{choices}
\end{question}
}

RE: problem with \insertgroup[n]{groupname} - Added by Stan Reeves about 1 month ago

Here you go:

\documentclass{article}

\usepackage[box,completemulti,nowatermark]{automultiplechoice}    

\begin{document}

\AMCrandomseed{1237894}

\element{general}{

\begin{question}{Q1}
Question
    \begin{choices}
      \wrongchoice{one}
      \correctchoice{two}
    \end{choices}
\end{question}

\begin{question}{Q2}
Question
    \begin{choices}
      \wrongchoice{one}
      \correctchoice{two}
    \end{choices}
\end{question}

\begin{question}{Q3}
Question
    \begin{choices}
      \wrongchoice{one}
      \correctchoice{two}
    \end{choices}
\end{question}

}

\onecopy{1}{

\shufflegroup{general}
\insertgroup[2]{general}
%\insertgroup{general}

}

\end{document}

RE: problem with \insertgroup[n]{groupname} - Added by Frédéric Bréal about 1 month ago

If you want the 2 first questions in the group (general), only one question must be include in \element.

document.tex (660 Bytes)

RE: problem with \insertgroup[n]{groupname} - Added by Stan Reeves about 1 month ago

I don't follow your explanation.

In the code above, I want to randomly pick 2 out of 3 questions to include. So I shuffle three questions and then pick the first two. At least that's what I'm trying to do and what I understand the documentation to say is the way to do it.

RE: problem with \insertgroup[n]{groupname} - Added by Frédéric Bréal about 1 month ago

See my mwe in my previous message.

You have 1 group (general) with 3 questions so 1 element in 1 group

\element{general}{
Q1
Q2
Q3
}

With

\insertgroup[2]{general}

AMC insert twice the same group Q1 Q2 Q3 Q1 Q2 Q3

If you want only 2 questions, you have to split the elements

    \element{general}{
\begin{question}{Q1}
Question
\begin{choices}
    \wrongchoice{one}
    \correctchoice{two}
\end{choices}
\end{question}
}

\element{general}{
    \begin{question}{Q2}
Question
\begin{choices}
    \wrongchoice{one}
    \correctchoice{two}
\end{choices}
\end{question}
}

\element{general}{
\begin{question}{Q3}
Question
\begin{choices}
    \wrongchoice{one}
    \correctchoice{two}
\end{choices}
\end{question}
    }

I have one group (general), 3 different elements Q1 Q2 Q3

RE: problem with \insertgroup[n]{groupname} - Added by Stan Reeves about 1 month ago

Ah, thank you!

I didn't understand the distinction between an element and a group. I thought the group was defined by an element, but I see how it works now. That solved the problem.

(1-8/8)