補足情報内の数字の参照

補足情報内の数字の参照

私はハイパーリンクしています

\usepackage{hyperref}

次のコマンドを使用して、補足情報セクションを開始します。

\begin\newcommand{\beginsupplement}{
    \setcounter{section}{0}
    \renewcommand{\thesection}{S\arabic{section}}
    \setcounter{equation}{0}
    \renewcommand{\theequation}{S\arabic{equation}}
    \setcounter{figure}{0}
    \renewcommand{\thefigure}{S\arabic{figure}}}

\usepackage{hyperref} を呼び出す前に、方程式、図、セクションにはすべて 1、2、... という番号が付けられ、参照先の方程式、図、セクションに適切にリンクされます。

\usepackage{hyperref} を呼び出すと、方程式、図、セクションにはすべて S1、S2、... という番号が付けられ、方程式とセクションは適切にリンクされます。しかし、図はどういうわけかリンクされません。

私の数字は次のようにラベル付けされています

\begin{figure*}
    \centering
    \includegraphics[width=8cm]{subfig1.png}
    \includegraphics[width=8cm]{subfig2.png}

    \vspace{0.5cm}

    \includegraphics[width=8cm]{subfig3.png}
    \includegraphics[width=8cm]{subfig4.png}
    \caption{Caption text here.}
    \label{fig:spresults1}
\end{figure*}

補足情報の図 S3 を参照すると、番号 S3 は正しく表示されますが、リンクをクリックすると、本文の図 3 に移動します。ただし、式とセクションは正しく機能します。式 S14 は、式 14 ではなく、式 S14 にリンクします。

\ref 自体は正常に動作していますが、hyperref パッケージに問題があると思います。これを回避する方法をご存知の方はいらっしゃいますか?

答え1

いくつか実験した後、新しいカウンターを作成するという解決策を見つけました。補足情報の開始に使用する次のブロックの最後の 2 行にそれを配置しました。

\newcommand{\beginsupplement}{
    \setcounter{section}{0}
    \renewcommand{\thesection}{S\arabic{section}}
    \setcounter{equation}{0}
    \renewcommand{\theequation}{S\arabic{equation}}
    \setcounter{table}{0}
    \renewcommand{\thetable}{S\arabic{table}}
    \setcounter{figure}{0}
    \renewcommand{\thefigure}{S\arabic{figure}}
    \newcounter{SIfig}
    \renewcommand{\theSIfig}{S\arabic{SIfig}}}

そして、新しいカウンターを新しい図に使います。

\begin{figure*}
    \centering
    \includegraphics[width=8cm]{subfig1.png}
    \includegraphics[width=8cm]{subfig2.png}

    \vspace{0.5cm}

    \includegraphics[width=8cm]{subfig3.png}
    \includegraphics[width=8cm]{subfig4.png}

    \refstepcounter{SIfig}\label{fig:spresults1}

    \caption{Caption text here.}
\end{figure*}

ラベルがキャプションではなく SI 図のカウンターに適用されるようにします。ラベルの対象は図のカウンターとは完全に異なるため、SI 図への参照は SI 図に適切にリンクされます。

関連情報