alphalph 和 hyperref 与 amsmath 子方程之间的软件包不兼容

alphalph 和 hyperref 与 amsmath 子方程之间的软件包不兼容

我有一个文档,它使用了subequationsalphalph,无需 也可以编译hyperref,但使用 时会抛出错误hyperref。打包hyperref后加载alphalph没有帮助。

错误是:

! Undefined control sequence.
\GenericError  ...                                
                                                #4  \errhelp \@err@     ...
l.39    \end{align}

梅威瑟:

\documentclass{article}

\usepackage{amsmath}
\usepackage{hyperref}
\usepackage{alphalph}

\begin{document}
\begin{subequations}
\renewcommand{\theequation}{\theparentequation \alphalph{\value{equation}}}
\begin{align}
    Blah\\
    Blah\\
    Blah\\
    Blah\\
    Blah\\
    Blah\\
    Blah\\
    Blah\\
    Blah\\
    Blah\\
    Blah\\
    Blah\\
    Blah\\
    Blah\\
    Blah\\
    Blah\\
    Blah\\
    Blah\\
    Blah\\
    Blah\\
    Blah\\
    Blah\\
    Blah\\
    Blah\\
    Blah\\
    Blah\\
\end{align}
\end{subequations}
\end{document}

有谁知道如何解决吗?

答案1

我已经尝试了您的最小工作示例,并通过反复试验发现,如果您hyperref先加载包,一切都会正常进行。

因此,您发布的 MWE 变成:

\documentclass{article}

\usepackage{hyperref}
\usepackage{amsmath}
\usepackage{alphalph}

\begin{document}
\begin{subequations}
\renewcommand{\theequation}{\theparentequation \alphalph{\value{equation}}}
\begin{align}
    Blah\\
    Blah
\end{align}
\end{subequations}
\end{document}

请注意,我还从最后一个 中删除了两个反斜杠Blah。这可以防止创建带编号的空行。我Blah\\align块中省略了 25 行以保持简洁。

答案2

我认为实际问题在于您的 \label{} 语句在子方程环境中的位置,而您的重新排列无意中修复了 \label{} 位置问题。

这是一个 hyerref last 的示例,它失败仅仅是因为当存在标签问题时,amsmath 包无法很好地转储子方程环境。

编译如下:

\documentclass{amsart}

% mathematic related packages
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{amsthm}
\usepackage{thmtools}
\usepackage{hyperref}
% above is the preamble

\begin{document}

The Euler-Maclaurin summation formula for a function, $f(n, x)$, that is $(2 m + 1)$-differentiable in $z$ is:
\begin{subequations} \label{eq:EulerMacLaurin:GenM:Works}
\begin{align}
\sum\limits_{n = a}^{b} f(n, x) &= \int\limits_{z = a}^{b} f(t,x) dz \label{eq:EulerMacLaurin:GenM:Core}
\\ &+ 
\frac{1}{2}\left[ f(b,x) + f(a,x) \right] \label{eq:EulerMacLaurin:GenM:Endpoints}
\\ &+ 
\sum\limits_{k = 1}^{m} \frac{B_{2k}}{(2k)!}\left[ f^{(2 k -1 )}(b,x) - f^{(2 k -1 )}(a,x) \right] \label{eq:EulerMacLaurin:GenM:Corrections}
\\ &+ 
\int\limits_{z = a}^{b} f^{(2 m + 1)}(z,x) \frac{P_{2 m +1}(z)}{(2 m + 1)!} dt \label{eq:EulerMacLaurin:GenM:ErrorTerm}
\end{align}
\end{subequations}
Where equation \eqref{eq:EulerMacLaurin:GenM:Works}, has the following parts
\begin{itemize}
\item \eqref{eq:EulerMacLaurin:GenM:Core} is the core connection between an sum and its integral
\item \eqref{eq:EulerMacLaurin:GenM:Endpoints} is the correction due to the values at the end points of the interval
\item \eqref{eq:EulerMacLaurin:GenM:Corrections} are the sequence of progressively better corrections based on Bernoulli numbers and derivatives of the function under study
\item \eqref{eq:EulerMacLaurin:GenM:ErrorTerm} is the be-deviling error term that we hope goes to zero at some point
\end{itemize}

\begin{equation}
\int_limits_{s=-\infty}^{\infty} f(z,x) dz
\end{equation}

\end{document}

由于无法识别的控制序列而失败,\end{align} 在第二方程:

\documentclass{amsart}

% mathematic related packages
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{amsthm}
\usepackage{thmtools}
\usepackage{hyperref}
% above is the preamble

\begin{document}

The Euler-Maclaurin summation formula for a function, $f(n, x)$, that is $(2 m + 1)$-differentiable in $z$ is:
\begin{subequations}
\begin{align} \label{eq:EulerMacLaurin:GenM:Fails}
\sum\limits_{n = a}^{b} f(n, x) &= \int\limits_{z = a}^{b} f(t,x) dz \label{eq:EulerMacLaurin:GenM:Core}
\\ &+ 
\frac{1}{2}\left[ f(b,x) + f(a,x) \right] \label{eq:EulerMacLaurin:GenM:Endpoints}
\\ &+ 
\sum\limits_{k = 1}^{m} \frac{B_{2k}}{(2k)!}\left[ f^{(2 k -1 )}(b,x) - f^{(2 k -1 )}(a,x) \right] \label{eq:EulerMacLaurin:GenM:Corrections}
\\ &+ 
\int\limits_{z = a}^{b} f^{(2 m + 1)}(z,x) \frac{P_{2 m +1}(z)}{(2 m + 1)!} dt \label{eq:EulerMacLaurin:GenM:ErrorTerm}
\end{align}
\end{subequations}
Where equation \eqref{eq:EulerMacLaurin:GenM:Works}, has the following parts
\begin{itemize}
\item \eqref{eq:EulerMacLaurin:GenM:Core} is the core connection between an sum and its integral
\item \eqref{eq:EulerMacLaurin:GenM:Endpoints} is the correction due to the values at the end points of the interval
\item \eqref{eq:EulerMacLaurin:GenM:Corrections} are the sequence of progressively better corrections based on Bernoulli numbers and derivatives of the function under study
\item \eqref{eq:EulerMacLaurin:GenM:ErrorTerm} is the be-deviling error term that we hope goes to zero at some point
\end{itemize}

\begin{equation}
\int_limits_{s=-\infty}^{\infty} f(z,x) dz
\end{equation}

\end{document}

日志中没有帮助的部分内容如下:

! Package amsmath Error: Multiple \label's: label 'eq:EulerMaclaurin:GenM:Fails' will be lost.

See the amsmath package documentation for explanation.
Type  H <return>  for immediate help.
 ...                                              

! Undefined control sequence.
l.37     \end{align}

相关内容