同じタグを持つ異なる方程式は間違った参照を引き起こします
Nov 22 2020
この質問と非常によく似たものを実現したいと思いますが、上記の方程式も参照したいと思います。最小限の例を次に示します。
\documentclass[12pt]{article}
\usepackage[hidelinks]{hyperref}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{mathtools}
\begin{document}
\section*{Chapter A}
\begin{equation}\label{star1}\tag{$\star$}
a^2 + b^2 = c^2
\end{equation}
The main equation of this chapter is the Pythagorean theorem, \eqref{star1}.
\pagebreak
\section*{Chapter B}
\begin{equation}\label{star2}\tag{$\star$}
i^2 = -1
\end{equation}
The main equation of this chapter is the definition of the imaginary unit, \eqref{star2}.
\end{document}
問題は、それ\eqref{star2}
がピタゴラスを指していることです。私はまた、私がかなり関連していると確信しているこの警告を受け取ります:destination with the same identifier (name{equation.0.1}) has been already used, duplicate ignored <to be read again>
前もって感謝します。
回答
3 egreg Nov 22 2020 at 22:43
パッケージhyperref
は最後にロードする必要があります。その後にロードする必要があるパッケージはわずかで、MWEにあるパッケージはありません。
ただし、これでは問題は解決しません。問題は競合状態です。equation
関連するカウンターがステップ実行され、前に\tag
スキャンされた場合は前の値にリセットされます\end{equation}
が、手遅れでhyperref
あり、すでにアンカーが提供されています。
タグが同じであっても問題はありませんが、読者を混乱させる可能性があるため、注意が必要です。
を使用equation*
すると問題が解決します。
\documentclass[12pt]{article}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{mathtools}
\usepackage[hidelinks]{hyperref}
\begin{document}
\section*{Chapter A}
\begin{equation*}\label{star1}\tag{$\star$}
a^2 + b^2 = c^2
\end{equation*}
The main equation of this chapter is the Pythagorean theorem, \eqref{star1}.
\pagebreak
\section*{Chapter B}
\begin{equation*}\label{star2}\tag{$\star$}
i^2 = -1
\end{equation*}
The main equation of this chapter is the definition of the imaginary unit, \eqref{star2}.
\end{document}