0

I want to have a reference from everypage to the first page of the document. I think the link can exist well in the pagenumber of every page back to the TOC (first page here). Code

\documentclass{article}
\usepackage{blindtext}
\usepackage{hyperref} % for links in TOC
% https://tex.stackexchange.com/q/56316/13173
\usepackage{fancyhdr}
\renewcommand{\headrulewidth}{0pt} % Werner, remove top margin border

\begin{document}
\tableofcontents
\clearpage
\section{Beginning \jobname}
\blindtext[10]

\end{document}

OS: Debian 8.7

  • 1
    Is it the header or the footer? – user31729 Apr 19 '17 at 18:49
  • 2
    the operating system is never going to be relevant here. – David Carlisle Apr 19 '17 at 18:49
  • @ChristianHupfer Footer. – Léo Léopold Hertz 준영 Apr 19 '17 at 18:49
2

Something like this?

A docstart\jobname hypertarget is placed right at the start of \begin{document} and another hypertarget anchor is placed as mytoc\jobname at \tableofconents.

In fancypagestyle{plain} the footer definitions use \hyperlink{docstart\jobname}{First page}} etc.

Please mind the\phantomsection in front of the \hypertarget command

\documentclass{article}
\usepackage{blindtext}
\usepackage{fancyhdr}
\usepackage{hyperref} % for links in TOC
\renewcommand{\headrulewidth}{0pt} 

\fancypagestyle{plain}{%
  \fancyhf{}
  \fancyfoot[L]{\hyperlink{docstart\jobname}{First page}}
  \fancyfoot[C]{\hyperlink{mytoc\jobname}{\contentsname}}
}

\begin{document}

\phantomsection
\hypertarget{docstart\jobname}{}
\blindtext[10]
\phantomsection
\hypertarget{mytoc\jobname}{}
\tableofcontents
\clearpage

\pagestyle{plain}

\section{Beginning Foo}
\blindtext[10]

\end{document}

enter image description here

| improve this answer | |
  • I am thinknig here how to apply this approach when I have this macro in use: \usepackage{letltxmacro} \LetLtxMacro\oldincludepdf\includepdf \renewcommand{\includepdf}[4][]{% \oldincludepdf[pagecommand={‌​\thispagestyle{fancy‌​}},addtotoc={#4,section,1,#2,#3}, #1]{#2}}. It calls there fancy but how to apply the specific fancypagestyle is a question mark for me. – Léo Léopold Hertz 준영 Apr 19 '17 at 19:13
  • @LéoLéopoldHertz준영: Yes, but that was not in your question, was it? ;-) – user31729 Apr 19 '17 at 19:15
  • No. - - I minimalised it with the target in my last comment. :) Now, scratching my head, but waiting now for your other answer in the other thread, because I think it can help. – Léo Léopold Hertz 준영 Apr 19 '17 at 19:24
  • I am trying to understand now the case better here after studying your proposal about key-value interface tex.stackexchange.com/q/365684/13173 – Léo Léopold Hertz 준영 Apr 20 '17 at 11:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.