參考補充資料中的數字

參考補充資料中的數字

我正在超連結

\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 連結到方程式。 S14 不是等式。 14.

\ref 本身運作正常,但我認為 hyperref 套件中存在問題。有人知道解決這個問題的方法嗎?

答案1

經過一番實驗,我找到了創建新計數器的解決方案。我將其放在以下區塊的最後兩行中,我用它來開始我的補充資訊。

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

以便將標籤應用於 SIfig 計數器而不是標題。由於標籤的目標與數字計數器完全不同,因此對 SI 數字的引用正確地連結回 SI 數字。

相關內容