Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I want the reader of output of a PDFLaTeX be able to go back to the table of content or first page. What is a good way of doing this?

Most PDF readers provide a TOC and navigation system but I was looking for something noticeable within the document and at the same time not obtrusive!

share|improve this question
1  
something like this: Linking the section text to the TOC ? –  cmhughes Aug 26 '13 at 16:35

1 Answer 1

up vote 17 down vote accepted

Here's one possibility: I used the background package to place a Return button on every page of the document; the button is placed centered at the bottom of each page (the position of the button can be freely and easily changed). The button is a hyperlink to the ToC; this was created using the \hyperlink, \hypertarget mechanism provided by hyperref. For the "Return" button symbol I used \Return from the keystroke package, but you can use the symbol that better suits your needs:

\documentclass{article}
\usepackage[a6paper]{geometry}% just for the example
\usepackage{background}
\usepackage{etoolbox}
\usepackage{keystroke}
\usepackage{lipsum}% just to generate text for the example
\usepackage[colorlinks=true,linkcolor=cyan]{hyperref}

\makeatletter
\patchcmd{\tableofcontents}{\@starttoc{toc}}{\hypertarget{totoc}{}\@starttoc{toc}}{}{}
\makeatother

\backgroundsetup{
scale=1,
angle=0,
color=black,
position=current page.south,
vshift=20pt,
contents={
  \tikz[remember picture,overlay]
    \node[inner sep=0pt] {\hyperlink{totoc}{\Return}};
  }
}

\begin{document}

\tableofcontents
\section{First section}
\lipsum[4]\lipsum[4]
\lipsum[4]\lipsum[4]
\section{Second section}
\lipsum[4]\lipsum[4]
\lipsum[4]\lipsum[4]

\end{document}

An image of the resulting document:

enter image description here

A zoom of one of the pages, showing the button:

enter image description here

In case you have an older version of background, you can use the old syntax (this will also work in the newer versions):

\documentclass{article}
\usepackage[a6paper]{geometry}% just for the example
\usepackage{background}
\usepackage{etoolbox}
\usepackage{keystroke}
\usepackage{lipsum}% just to generate text for the example
\usepackage[colorlinks=true,linkcolor=cyan]{hyperref}

\makeatletter
\patchcmd{\tableofcontents}{\@starttoc{toc}}{\hypertarget{totoc}{}\@starttoc{toc}}{}{}
\makeatother

\SetBgScale{1}
\SetBgAngle{0}
\SetBgColor{black}
\SetBgPosition{current page.south}
\SetBgVshift{20pt}
\SetBgContents{\tikz[remember picture,overlay]
    \node[inner sep=0pt] {\hyperlink{totoc}{\Return}};}

\begin{document}

\tableofcontents
\section{First section}
\lipsum[4]\lipsum[4]
\lipsum[4]\lipsum[4]
\section{Second section}
\lipsum[4]\lipsum[4]
\lipsum[4]\lipsum[4]

\end{document}
share|improve this answer
    
somehow my attempts lead to "Undefined control sequence. \backgroundsetup" and I have the package background included. Any ideas? I copied your example as the sole body of file and I got the same message. Perhaps we have different versions of some package. –  Maesumi Aug 26 '13 at 18:36
    
@Maesumi you have an outdated version of the package; either update the package or use the old syntax (I'd suggest the former). In any case, I added an example to my answer using the old syntax; this should also work for you while you update the package. –  Gonzalo Medina Aug 26 '13 at 20:10
    
@GonzaloMedina -- Is there any limitation on multiple SetBgContents used in the background package due to non-uniqueness of multiple positions. –  Jesse Aug 27 '13 at 4:22
    
@Jesse if I correctly understand what you are asking, then no. Using multiple nodes at the desired positions, for example, you can place multiple material. –  Gonzalo Medina Aug 27 '13 at 4:38

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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