Hyperref 不適用於跨多個頁面的自訂圖形環境

Hyperref 不適用於跨多個頁面的自訂圖形環境

我想使用該hyperref套件在文字 ( \usepackage[colorlinks,citecolor=blue,urlcolor=blue]{hyperref}) 中以藍色突出顯示引文和網址,以及稍後使用hyperref將圖引文連結到相應的圖頁。

但是,在大圖形/大標題的情況下,我使用自訂圖形環境來處理跨越多個頁面的標題。

當我設定 時hyperref package,跨越多個頁面的標題會發出警告

包標題警告:對於此特定的 \caption,選項“hypcap=true”將被忽略。

如何將跨多個頁面的大標題與包協調起來hyperref

這是我的程式碼:

\documentclass[12pts,openright,twoside]{report}
\usepackage[a4paper,width=150mm,top=25mm,bottom=25mm, bindingoffset=6mm]{geometry}
\usepackage[font={small,sf}, singlelinecheck=false]{caption}
\usepackage{graphicx}
\graphicspath{{./fig/}}
\usepackage{chngcntr}
\counterwithout{figure}{chapter}
\counterwithout{table}{chapter}
\usepackage{natbib}
\bibliographystyle{apa}
\usepackage[nottoc,notlot,notlof]{tocbibind}
\usepackage[colorlinks,citecolor=blue,urlcolor=blue]{hyperref}

\begin{document}

\begin{center}
\includegraphics[width=\textwidth]{fig/chap2-workflow.pdf}
\bigskip
\setbox0\vbox{\makeatletter
\let\caption@rule\relax
\captionof{figure}[My Figure Title.]{Very very large caption}
\global\skip1\lastskip\unskip
\global\setbox1\lastbox
}
\unvbox0
\setbox0\hbox{\unhbox1\unskip\unskip\unpenalty
\global\setbox1\lastbox}
\unvbox1
\vskip\skip1
\label{workflow1}
\end{center}

\end{document}

答案1

警告在日誌中繼續顯示

請參閱標題包文件以取得解釋。

6.5 hyperref如果在那裡搜尋 hypcap,您將看到描述您的選項的部分。例如,一個例子是使用\captionsetup\caption而不是\captionof在真實的浮動環境之外:

\documentclass[12pt,openright,twoside]{report}
\usepackage[font={small,sf}, singlelinecheck=false]{caption}
\usepackage{graphicx}
\usepackage[colorlinks,citecolor=blue,urlcolor=blue]{hyperref}

\begin{document}

\begin{center}
\captionsetup{type=figure}
\includegraphics[width=\textwidth]{example-image}
\caption[My Figure Title.]{Very very large caption}
\label{workflow1}
\end{center}

\end{document}

相關內容