# Subequation: Counter too large

I have several parent equations each with more than 30 subequations. When I write it normally with subequation command, I receive "counter too large" error.

I found out that there is a package named "alphalph" which can solve these numberings with different styles. I have seen this solution for subequations in StackExchange, but it doesn't work for me! I still get the error!! (since I want to refer to them later, I need to label them too).

Does anybody know where the problem is, or suggest an alternative?

Thanks

• Please attach a MWE and the error code. May 31, 2016 at 20:36
• can you provide a compilable example? that will make it much easier for potential helpers to help. May 31, 2016 at 20:37
• Thank you guys; one of the solutions worked for me. @MaestroGlanz: I don't know what MWE is. Jun 1, 2016 at 9:12
• @PeyM87: MWE means minimal working example, i.e. a compilable document that shows the issue or is suited as a starter to add a requested feature.
– user31729
Jun 1, 2016 at 21:49

Try this, perhaps!

\documentclass{article}
\usepackage{amsmath}
\usepackage{alphalph}
\usepackage{etoolbox}

\newcommand{\alphalphval}[1]{\alphalph{\value{#1}}}

\AtBeginDocument{%
\AtBeginEnvironment{subequations}{%
\let\alph\alphalphval%
}
}

\begin{document}

\begin{subequations}
\begin{align}
f(x) &= ax^2 + bx + c \\
f(x) &= ax^2 + bx + c \\
f(x) &= ax^2 + bx + c \\
f(x) &= ax^2 + bx + c \\
f(x) &= ax^2 + bx + c \\
f(x) &= ax^2 + bx + c \\
f(x) &= ax^2 + bx + c \\
f(x) &= ax^2 + bx + c \\
f(x) &= ax^2 + bx + c \\
f(x) &= ax^2 + bx + c \\
f(x) &= ax^2 + bx + c \\
f(x) &= ax^2 + bx + c \\
f(x) &= ax^2 + bx + c \\
f(x) &= ax^2 + bx + c \\
f(x) &= ax^2 + bx + c \\
f(x) &= ax^2 + bx + c \\
f(x) &= ax^2 + bx + c \\
f(x) &= ax^2 + bx + c \\
f(x) &= ax^2 + bx + c \\
f(x) &= ax^2 + bx + c \\
f(x) &= ax^2 + bx + c \\
f(x) &= ax^2 + bx + c \\
f(x) &= ax^2 + bx + c \\
f(x) &= ax^2 + bx + c \\
f(x) &= ax^2 + bx + c \\
f(x) &= ax^2 + bx + c \\
f(x) &= ax^2 + bx + c \\
f(x) &= ax^2 + bx + c \\
f(x) &= ax^2 + bx + c \\
f(x) &= ax^2 + bx + c \\
f(x) &= ax^2 + bx + c \\
f(x) &= ax^2 + bx + c
\end{align}
\end{subequations}

\end{document}


Update with a different style:

In order to get the aa,bb,cc style, it's necessary to use \newalphalph to define a new style, say, \aalphalph (see the code for the precise definitionand let\alphuse\aalphalph then.

\documentclass{article}
\usepackage{amsmath}
\usepackage{alphalph}
\usepackage{etoolbox}

\makeatletter
\newalphalph{\aalphalph}[mult]{\alphalph@alph}{26}
\newcommand{\alphalphval}[1]{%
\@ifundefined{c@#1}{% check first if #1 is a counter (\c@#1)
\aalphalph{#1}% No, it's most likely the direct value
}{%
\aalphalph{\value{#1}}% It's a counter, so use \value{#1}
}
}
\makeatother

\AtBeginEnvironment{subequations}{%
\let\alph\alphalphval%
}

\begin{document}

\begin{subequations}
\begin{align}
f(x) &= ax^2 + bx + c \\
f(x) &= ax^2 + bx + c \\
f(x) &= ax^2 + bx + c \\
f(x) &= ax^2 + bx + c \\
f(x) &= ax^2 + bx + c \\
f(x) &= ax^2 + bx + c \\
f(x) &= ax^2 + bx + c \\
f(x) &= ax^2 + bx + c \\
f(x) &= ax^2 + bx + c \\
f(x) &= ax^2 + bx + c \\
f(x) &= ax^2 + bx + c \\
f(x) &= ax^2 + bx + c \\
f(x) &= ax^2 + bx + c \\
f(x) &= ax^2 + bx + c \\
f(x) &= ax^2 + bx + c \\
f(x) &= ax^2 + bx + c \\
f(x) &= ax^2 + bx + c \\
f(x) &= ax^2 + bx + c \\
f(x) &= ax^2 + bx + c \\
f(x) &= ax^2 + bx + c \\
f(x) &= ax^2 + bx + c \\
f(x) &= ax^2 + bx + c \\
f(x) &= ax^2 + bx + c \\
f(x) &= ax^2 + bx + c \\
f(x) &= ax^2 + bx + c \\
f(x) &= ax^2 + bx + c \\
f(x) &= ax^2 + bx + c \\
f(x) &= ax^2 + bx + c \\
f(x) &= ax^2 + bx + c \\
f(x) &= ax^2 + bx + c \\
f(x) &= ax^2 + bx + c \\
f(x) &= ax^2 + bx + c
\end{align}
\end{subequations}

\end{document}


• The subequations code is taken from Werner's answer
– user31729
May 31, 2016 at 21:08
• Thank you. This one worked. I have upvoted and accepted your answer. Just in case, do you know how I can change the citing style in this answer? Jun 1, 2016 at 9:17
• @PeyM87: Which citing style?
– user31729
Jun 1, 2016 at 15:19
• There's one style: aa, bb, ...; There's another one like: ab, ac, ... and .... Jun 1, 2016 at 15:32
• @PeyM87: See the update at the end of my answer. Personally, aa,bb,.. isn't my favourite, however ;-)
– user31729
Jun 1, 2016 at 19:34

Patch subequations to use \alphalph instead of \alph; a similar patch might be used for numbering subequations in a different fashion.

The pictures just show the last rows.

\documentclass{article}
\usepackage{amsmath}
\usepackage{alphalph}
\usepackage{etoolbox}

\patchcmd{\subequations}{\alph{equation}}{\alphalph{\value{equation}}}{}{}

\begin{document}

\begin{subequations}
\begin{align}
f(x) &= ax^2 + bx + c \\
f(x) &= ax^2 + bx + c \\
f(x) &= ax^2 + bx + c \\
f(x) &= ax^2 + bx + c \\
f(x) &= ax^2 + bx + c \\
f(x) &= ax^2 + bx + c \\
f(x) &= ax^2 + bx + c \\
f(x) &= ax^2 + bx + c \\
f(x) &= ax^2 + bx + c \\
f(x) &= ax^2 + bx + c \\
f(x) &= ax^2 + bx + c \\
f(x) &= ax^2 + bx + c \\
f(x) &= ax^2 + bx + c \\
f(x) &= ax^2 + bx + c \\
f(x) &= ax^2 + bx + c \\
f(x) &= ax^2 + bx + c \\
f(x) &= ax^2 + bx + c \\
f(x) &= ax^2 + bx + c \\
f(x) &= ax^2 + bx + c \\
f(x) &= ax^2 + bx + c \\
f(x) &= ax^2 + bx + c \\
f(x) &= ax^2 + bx + c \\
f(x) &= ax^2 + bx + c \\
f(x) &= ax^2 + bx + c \\
f(x) &= ax^2 + bx + c \\
f(x) &= ax^2 + bx + c \\
f(x) &= ax^2 + bx + c \\
f(x) &= ax^2 + bx + c \\
f(x) &= ax^2 + bx + c \\
f(x) &= ax^2 + bx + c \\
f(x) &= ax^2 + bx + c \\
f(x) &= ax^2 + bx + c
\end{align}
\end{subequations}

\end{document}


You can obtain subequations numbered “1-01” and so on with

\makeatletter
\patchcmd{\subequations}
{\alph{equation}}
{-\two@digits{\arabic{equation}}}
{}{}
\makeatother


instead of the \patchcmd line above. In this case loading alphalph` is not necessary. (I assume you don't have more than 99 subequations.)

• Thanks for the reply. But as I mentioned, this didn't work for me! Jun 1, 2016 at 9:03