\footnote 圖像標題內的交叉引用

\footnote 圖像標題內的交叉引用

我想在同一個腳註中引用多個圖像。

這是兩個共享相同腳註的圖像

\begin{figure}[!ht]
  \begin{center}
    \leavevmode
    \includegraphics[width=0.86\textwidth]{figures/bottleneck_resnet}
    \caption[Bottleneck Design of Residual Neural Networks]{Bottleneck Design of Residual Neural Networks\footnote{\label{fn:resnet}https://towardsdatascience.com/review-resnet-winner-of-ilsvrc-2015-image-classification-localization-detection-e39402bfa5d8}}
    \label{fig:bottleneck_arch}
  \end{center}
\end{figure}

\begin{figure}[!ht]
  \begin{center}
    \leavevmode
    \includegraphics[width=0.9\textwidth]{figures/resnet_archs}
    \caption[ResNet overall architecture for all network]{ResNet overall architecture for all network\footref{fn:resnet}}
    \label{fig:resnet_arch_table}
  \end{center}
\end{figure}

然而,透過這種方法,我的圖像沒有被引用,我得到一個“??”。我還嘗試使用\footnotemark內部標題而\footnotetext不是footnote.第一個引用了前面的註腳,第二個也沒有引用正確性。我應該把我的放在哪裡\footnote{\label{fn:resnet}https://towardsdatascience.com/review-resnet-winner-of-ilsvrc-2015-image-classification-localization-detection-e39402bfa5d8}才能引用它?

問候

答案1

\footnote不能\footnotetext在浮動體中使用,但\footnotemark沒問題。我不確定 hyperref 如何定位腳註而不是\footnotemark,但確實如此。

請注意,腳註可能不會與浮動內容出現在同一頁上。然而,必須\footnotetext在不久之後\footnotemark(在任何其他腳註之前)呼叫此方法才能起作用。也不能使用可選參數。

\documentclass{article}
\usepackage{graphicx}
\usepackage{footmisc}
\usepackage{hyperref}

\begin{document}
\begin{figure}[ht]
  \centering
    \includegraphics[width=0.86\textwidth]{example-image-a}
    \caption[Bottleneck Design of Residual Neural Networks]{Bottleneck Design of Residual Neural Networks\footnotemark}
    \label{fig:bottleneck_arch}
\end{figure}

\footnotetext{\label{fn:resnet}%
  https://towardsdatascience.com/review-resnet-winner-of-ilsvrc-2015-image-classification-localization-detection-e39402bfa5d8}

\begin{figure}[ht]
  \centering
    \includegraphics[width=0.9\textwidth]{example-image-b}
    \caption[ResNet overall architecture for all network]{ResNet overall architecture for all network\footref{fn:resnet}}
    \label{fig:resnet_arch_table}
\end{figure}
\end{document}

該解決方案\footnotemark透過使用可選參數並將其放置\refstepcounter在腳註內來繞過該過程。它更強大,因為 (A) 可以處理每個浮動中的多個腳註,並且 (B) 它用於\afterpage將腳註與浮動放在同一頁面上(假設浮動有標題和標籤)。

它不能做的一件事是將腳註與 [p] 浮動在同一頁上。

\documentclass{article}
\usepackage{graphicx}
\usepackage{footmisc}
\usepackage{afterpage}
\usepackage{hyperref}

\newcommand{\footpage}[2]% #1 = label for \pageref, #2 = \footnote arg
 {\ifnum\value{page}<\getpagerefnumber{#1}\relax
    \afterpage{\footpage{#1}{#2}}%
  \else
    \stepcounter{footnote}% cannot put \refstepcounter into optional argument of \footnotetext
    \footnotetext[\thefootnote]{\addtocounter{footnote}{-1}\refstepcounter{footnote}#2}%
  \fi}

\begin{document}
\footpage{fig:bottleneck_arch}{\label{fn:resnet}%
  https://towardsdatascience.com/review-resnet-winner-of-ilsvrc-2015-image-classification-localization-detection-e39402bfa5d8}

\begin{figure}[ht]
  \centering
    \includegraphics[width=0.86\textwidth]{example-image-a}
    \caption[Bottleneck Design of Residual Neural Networks]{Bottleneck Design of Residual Neural Networks\footref{fn:resnet}}
    \label{fig:bottleneck_arch}
\end{figure}


\begin{figure}[ht]
  \centering
    \includegraphics[width=0.9\textwidth]{example-image-b}
    \caption[ResNet overall architecture for all network]{ResNet overall architecture for all network\footref{fn:resnet}}
    \label{fig:resnet_arch_table}
\end{figure}
\end{document} 

相關內容