## Automatic detection of number of choices

Hi,
I have been creating a number of scripts that interface with AMC. One of them is a style file that automates the way I usually create exams, to make my life easier.
For example, I like to have all multiple choice questions worth the same, so I have a command \setmultiplechoice that stores a number (the number of points each multiple choice question is worth). I then have a \begin\end{mcquestion} which is basically a wrapper for \begin\end{question} with \scoring{b=#} (# being the value held in \setmultiplechoice).

This is more difficult for questionmult questions. Ideally, I would want to set b to c/p, where c is the number of points a multiple choice question is worth, and p is the number of choices in the question. I have been just using \begin\end{questionmult} directly for these types of problems, but it would be nice if I could automate the scoring based on the numbers listed.

Is there (in latex only) a way to detect how many choices are present?

Thanks,

### Replies (3)

#### RE: Automatic detection of number of choices - Added by Alexis Bienvenüeabout 7 years ago

This seems quite difficult with LaTeX, but perhaps you can use the scoring variables N, NB to implement this.

#### RE: Automatic detection of number of choices - Added by S. McKayabout 7 years ago

Thanks for your reply, and for your patience. I did not even see that section in the manual. I've been using the table on page 31 and did not look for other options.

#### RE: Automatic detection of number of choices - Added by Al DUSabout 7 years ago

One can imagine to add a wrap around \wrongchoice and \correctchoice and use a new counter to store the maximum of the counter \AMCànumerotation with a simple \ifthenelse to compute the max. I used this to "count" the number of answers per question. It worked.

(1-3/3)