\ref align 環境のラベルの式のカウンタが 1 ずれている

\ref align 環境のラベルの式のカウンタが 1 ずれている

\ref コマンドが align 内の方程式に対して、本来よりも 1 大きい数字をタイプセットするという問題が発生しています。方程式は正しく番号付けされていますが、参照がオフになっています。align 内の最後の方程式への \ref 呼び出しは、単に ?? を出力します。方程式環境は正しく動作します。

\documentclass{pnastwo}
\usepackage[xdvi]{graphicx}
\usepackage{amsmath}
\usepackage{xfrac}
\usepackage{refcount}

\begin{document}
\begin{article}

\begin{align}
  vt=d\\\nonumber
  \label{eq:1}
\end{align}

\begin{align}
  \frac{d}{t}=v\\\nonumber
  \label{eq:2}
\end{align}

\begin{equation}
  t=\frac{d}{v}\\\nonumber
  \label{eq:3}
\end{equation}

Here is the first reference: \ref{eq:1}

And here is the second: \ref{eq:2}

And here is the third: \ref{eq:3}

\end{article}
\end{document}

生産する

最初の参考文献は次の通りです: 2

そして2番目は次のとおりです:??

そして3番目はこれです: 3

答え1

または\\のような環境では、末尾に を付けてはいけません。または を1 行表示に使用しないでください。 また、の内部では何も実行されません。aligngatheraligngather\\equation

コマンド\labelは、それが配置される表示行を参照します。これを後ろに指定すると、\nonumberLaTeX が混乱するだけです。

\documentclass{pnastwo}
\usepackage{amsmath}

\usepackage{lipsum} % just for the example

\begin{document}
\begin{article}
\lipsum*[1]
\begin{align}
vt          &= d \label{eq:1} \\
\frac{d}{t} & =v \label{eq:2}
\end{align}
\lipsum*[3]
\begin{equation}
t=\frac{d}{v}  \label{eq:3}
\end{equation}
\lipsum[4]

Here is the first reference: \ref{eq:1}

And here is the second: \ref{eq:2}

And here is the third: \ref{eq:3}

\end{article}
\end{document}

ここに画像の説明を入力してください

最後のメモ
パッケージlipsumはテキストを提供するためだけのものです。 のオプションを使用しないでください。このxdviオプションgraphicxは存在しますが、下位互換性のためだけに存在します。 などのドライバーを使用しない場合はdvipdfmx、オプションを指定しないでください。また、例に必要のないパッケージも削除しました。

関連情報