子方程:计数器太大

子方程:计数器太大

我有几个父方程,每个方程都有超过 30 个子方程。当我使用子方程命令正常写入时,我收到“计数器太大”错误。

我发现有一个名为“alphalph”的包可以解决这些不同风格的编号问题。我见过此解决方案在 StackExchange 中查找子方程,但它对我不起作用!我仍然收到错误!!(因为我稍后要引用它们,所以我也需要给它们贴上标签)。

有人知道问题出在哪里吗,或者建议替代方案吗?

谢谢

答案1

或许,试试这个吧!

\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}

使用不同的样式进行更新:

为了获得该aa,bb,cc风格,需要用 来\newalphalph定义一种新风格,比如,\aalphalph(参见代码以了解精确定义and let\alph use\aalphalph`。)

\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}

在此处输入图片描述

答案2

subequations用于\alphalph代替的补丁\alph;可以使用类似的补丁以不同的方式对子方程进行编号。

图片只显示最后几排。

\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}

在此处输入图片描述

你可以得到编号为“1-01”的子方程,等等

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

而不是\patchcmd上面的行。在这种情况下,alphalph无需加载。(我假设您没有超过 99 个子方程。)

在此处输入图片描述

相关内容