我試著理解答案的最後一部分,鍵值介面的頁碼,在線程中如何在附加文件的開頭透過自訂標籤產生目錄?
我想將頁碼著色為紅色並建立指向它的鏈接,返回到文件的第一頁(例如目錄)。我認為fancypagestyle
這不是線程中的最佳選擇如何在精美的頁腳中將所有頁碼標記為目錄?
我的建議,但確定如何將它們應用到基督徒的鍵值介面的頁碼
\usepackage{xcolor}
所以{\color{red} pagenumber}
帶有 ToC 的鏈接,以下偽代碼,但不確定如何在此處製作內部偽代碼
\href{some-how-link-to-1st-page-of-document}{{\color{red} pagenumber}}
Christian代碼的相關部分
% https://tex.stackexchange.com/a/365580/13173
\usepackage{pdfpages}
\usepackage{hyperref} % for links in TOC
% https://tex.stackexchange.com/q/56316/13173
\usepackage{fancyhdr}
\renewcommand{\headrulewidth}{0pt} % Werner, remove top margin border
% https://tex.stackexchange.com/a/338919/13173
\usepackage{letltxmacro}
\makeatletter
\LetLtxMacro\pdfpages@@includepdf\includepdf
\RenewDocumentCommand{\includepdf}{O{}mo}{%
\begingroup
\IfValueTF{#3}{% Is there a 3rd argument? Yes
% Process the keys for the \includepdf first in order to get the value of 'pages=...' option
% This is stored to \AM@pagestemp (see pdfpages.sty)
\setkeys{pdfpages}{#1}%
\SetupPdfInclude{label={label#2\AM@pagestemp},page={\AM@pagestemp}, heading={#2},#3}
% Call the old command with the options for addtotoc
\pdfpages@@includepdf[pagecommand={\thispagestyle{fancy}},addtotoc={\retrieveoption{page},\retrieveoption{section},\retrieveoption{level},\retrieveoption{heading},\retrieveoption{label}},#1]{#2}
}{% No, no 3rd. argument}
\pdfpages@@includepdf[pagecommand={\thispagestyle{fancy}},#1]{#2}
}%
\endgroup% Prevent leaking of key values to the next call of the command
}
\makeatother
作業系統:Debian 8.7
硬體:華碩 Zenbook UX303UB
答案1
試試\hypersetup{linkcolor}{red}\hyperlink{mytoc\jobname}{\thepage}}
(red
無論如何都是連結的預設顏色)`
由於這種情況發生在一個群組中,\hypersetup
因此不會洩漏到本地群組以外的其他地方。
\documentclass{article}
\usepackage{blindtext}
\usepackage{fancyhdr}
\usepackage{xcolor}
\usepackage[colorlinks]{hyperref} % for links in TOC
\renewcommand{\headrulewidth}{0pt}
\fancypagestyle{plain}{%
\fancyhf{}
\fancyfoot[L]{\hypersetup{linkcolor=blue}\hyperlink{docstart\jobname}{First page}}
\fancyfoot[C]{\hypersetup{linkcolor=red}\hyperlink{mytoc\jobname}{\thepage}}
}
\begin{document}
\pagestyle{plain}
\phantomsection
\hypertarget{docstart\jobname}{}
\blindtext[10]
\phantomsection
\hypertarget{mytoc\jobname}{}
\tableofcontents
\clearpage
\section{Beginning Foo}
\blindtext[10]
\end{document}
與fancy
頁面樣式:
\documentclass{article}
\usepackage{blindtext}
\usepackage{fancyhdr}
\usepackage{xcolor}
\usepackage[colorlinks]{hyperref} % for links in TOC
\renewcommand{\headrulewidth}{0pt}
% Now for fancy pagestyle
\fancyhf{}
\fancyfoot[L]{\hypersetup{linkcolor=blue}\hyperlink{docstart\jobname}{First page}}
\fancyfoot[C]{\hypersetup{linkcolor=red}\hyperlink{mytoc\jobname}{\thepage}}
\begin{document}
\pagestyle{fancy}
\phantomsection
\hypertarget{docstart\jobname}{}
\blindtext[10]
\phantomsection
\hypertarget{mytoc\jobname}{}
\tableofcontents
\clearpage
\section{Beginning Foo}
\blindtext[10]
\end{document}