我试图理解答案的最后一部分,键值接口的页码,在主题中如何通过附加文档开头的自定义标签生成目录?
我想将页码颜色改为红色,并创建一个指向它的链接,返回到文档的第一页(例如目录)。我认为这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}