[Tex/LaTex] Counter too large error with \item

errorslists

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.

Best Answer

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