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

  • 1
    Please attach a MWE and the error code. – MaestroGlanz May 31 '16 at 20:36
  • can you provide a compilable example? that will make it much easier for potential helpers to help. – barbara beeton May 31 '16 at 20:37
  • Thank you guys; one of the solutions worked for me. @MaestroGlanz: I don't know what MWE is. – PeyM87 Jun 1 '16 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 '16 at 21:49
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 – user31729 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? – PeyM87 Jun 1 '16 at 9:17
  • @PeyM87: Which citing style? – user31729 Jun 1 '16 at 15:19
  • There's one style: aa, bb, ...; There's another one like: ab, ac, ... and .... – PeyM87 Jun 1 '16 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 '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

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

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.