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

4
  • 1
    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.
    – PM0087
    Jun 1, 2016 at 9:12
  • 2
    @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

2 Answers 2

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

5
  • 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?
    – PM0087
    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 ....
    – PM0087
    Jun 1, 2016 at 15:32
  • 1
    @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
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

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .