3

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

PM0087
  • 233

2 Answers2

3

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}

enter image description here

  • The subequations code is taken from Werner's answer –  May 31 '16 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? – PM0087 Jun 01 '16 at 09:17
  • @PeyM87: Which citing style? –  Jun 01 '16 at 15:19
  • There's one style: aa, bb, ...; There's another one like: ab, ac, ... and .... – PM0087 Jun 01 '16 at 15:32
  • 1
    @PeyM87: See the update at the end of my answer. Personally, aa,bb,.. isn't my favourite, however ;-) –  Jun 01 '16 at 19:34
2

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}

enter image description here

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.)

enter image description here

egreg
  • 1,121,712