2

I am a new LaTeX user. I already searched through the topic and I have not found an answer yet. I am using the exercise package to build a large Multiple Choice math question set complete with an answer key and full explanations. This is the format of a typical Multiple Choice question:

\item \(\frac{19^2+19}{19}\)

\begin{enumerate}[(A)] % (A), (B), (C), (D),(E)

\item   396

\item  361

\item  38

\item  21

\item  20 

\end{enumerate}

\textbf{Explanation}\par

We may simplify the fraction by separating it into two fractions as follows:\par

\(\frac{19^{2}+19}{19}\)=\(\frac{19^2}{19}+\frac{19}{19}=19+1=20\)\par

\textbf{Answer:E}\par

The number of questions has grown beyond 50 and I have started getting the following error:

! LaTeX Error: Counter too large.

See the LaTeX manual or LaTeX Companion for explanation.
Type  H <return>  for immediate help.
 ...                                              

l.418 \item I
             f $x=\sqrt{5}{-37}$, then which of the following must be true?
? 

I may be doing something wrong with the alphalph package, so kindly help me resolve this problem. If I were to use the following command, what do I write instead of \thesection and section.

\renewcommand{\thesection}{\alphalph{\value{section}}}

Sorry if this question has already been answered before.

  • 2
    Welcome to TeX.SX! Please help us help you and add a minimal working example (MWE) that illustrates your problem. Reproducing the problem and finding out what the issue is will be much easier when we see compilable code, starting with \documentclass{...} and ending with \end{document}. – user31729 Sep 25 '15 at 20:48
  • I don't understand why you redefine \thesection. The problem is \theenumi which is in your case restricted (probably) to the value of 26 at most, unless redefined. Are you using the enumerate package? – user31729 Sep 25 '15 at 20:52
  • Yes, I am using the enumerate package. – Htown Sep 25 '15 at 20:55
  • Christian - Same error again. Just a note that this worked OK for 50 questions, so this error may not be related to \theenumi. Also, I am not looking to change the formatting. \item already gives me a question number - I am only looking to allow it to continue numbering the questions to 200 or so. – Htown Sep 25 '15 at 21:21
6

This is a short hack, for enumerate package using \AlphAlph as counter output format. (The \foreach is just the loop to generate 50 \item )

In a normal setup, enumerate[(A)] can use only the 26 characters of the Latin alphabet such that \Alph{enumi} would fail if the enumi counter has a value of 27 or greater. To prevent this, the [(A)] output must be changed to use \AlphAlph{\value{enumi}} (for example)

\documentclass{article}

\usepackage{alphalph}
\usepackage{enumerate}
\usepackage{pgffor}


\begin{document}

\renewcommand{\theenumi}{\AlphAlph{\value{enumi}}}

\begin{enumerate} 
\foreach \x in {1,...,50} {%
  \item Question \x 
}
\end{enumerate}
\end{document}

enter image description here

Improved version with enumitem

\documentclass{article}

\usepackage{alphalph}
\usepackage{enumitem}

\makeatletter
\newcommand{\AlphAlphFmt}[1]{\@alphfmt{#1}}  % Define the \AlphAlph wrapper for enumitem 
\newcommand{\@alphfmt}[1]{\AlphAlph{\value{#1}}}  % Internal representation 
\AddEnumerateCounter{\AlphAlphFmt}{\@alphfmt}{AAA} % Register this new format
\makeatother

\newlist{mcenum}{enumerate}{2}
\setlist[mcenum,1]{label={(\AlphAlphFmt*)}}


\usepackage{pgffor}
\usepackage{multicol}

\begin{document}

\begin{multicols}{2}
\begin{mcenum}
\foreach \x in {1,...,60} {%
  \item Question \x 
}
\end{mcenum}
\end{multicols}

\end{document}

enter image description here

  • I'll try a solution with the more flexible enumitem package – user31729 Sep 25 '15 at 21:06
  • Christian - Thanks for the help. I am getting the same error again. Just a note that the existing set up worked OK for 50 questions, so this error may not be related to \theenumi. Also, I am not looking to change the formatting. \item already gives me a question number - I am only looking to allow it to continue numbering the questions to 200 or so. – Htown Sep 25 '15 at 21:25
  • @Htown: The formatting is one thing. If you use Alpha formatting, you will get troubles. Unless you do not show your setup it's not really possible to provide help. The question number is just for the example here, not for production – user31729 Sep 25 '15 at 21:26
  • The file is too long - about 700 lines. How do I upload on here for your review? – Htown Sep 25 '15 at 21:34
  • 1
    Thanks again Christian. Suppose I want to remove the term "Exercise" completely. How would you change the command? Second, you seem to suggest that nested enumerates are not the best way to handle such question sets. What is a better, perhaps more efficient alternative? – Htown Sep 25 '15 at 23:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.