Clickable chapters on the right side of each page
One possibility:
The code:
\documentclass{article}
\usepackage[a5paper,vmargin=2cm]{geometry}
\usepackage{background}
\usepackage{etoolbox}
\usepackage{graphicx}
\usepackage{totcount}
\usepackage{lipsum}
\usepackage{hyperref}
% to have access to the total number of sections
\regtotcounter{section}
% every section starts on a new page
\pretocmd{\section}{\clearpage}{}{}
% auxiliary lengths for the height of the frame and the width of each tab
\newlength\mylen
\newlength\mylena
% style for the section tabs
\tikzset{
tab/.style={
text width=\mylena,
draw=gray,
thick,
rectangle,
rounded corners=12pt,
align=center,
text width=53pt,
inner sep=0pt,
fill=gray!20,
font=\sffamily\LARGE
}
}
% style for the current section tab
\tikzset{selectedtab/.style={tab,color=white,fill=gray!90}}
% the page number is showed in the background material
\pagestyle{empty}
\AtBeginDocument{
% calculation of the width for each tab
\setlength\mylen{\dimexpr\textheight+2cm\relax}
\ifnum\totvalue{section}>0
\setlength\mylena{\dimexpr\mylen/\totvalue{section}\relax}
\fi
% the main part; as background material we place the border,
% the section (current and other) tabs and the page number
\backgroundsetup{
scale=1,
color=black,
angle=0,
opacity=1,
contents= {
\begin{tikzpicture}[remember picture, overlay]
\node[
inner sep=0pt,
text width=\the\dimexpr\textwidth+1.5cm\relax
]
at (current page.center) (border) {\rule{0pt}{\dimexpr\textheight+2cm\relax}};
\foreach \valsection in {0,...,\numexpr\totvalue{section}-1\relax}
{
\node[
\ifnum\thesection<\numexpr\valsection+1\relax
tab%
\else
\ifnum\thesection>\numexpr\valsection+1\relax
tab%
\else selectedtab%
\fi\fi,
minimum height=\mylena
]
at ([yshift=-(0.5+\valsection)*\mylena]border.north east)
(tab-\valsection)
{\hspace*{25pt}\rotatebox{-90}{%
\hyperlink{sec:\valsection}{Section \the\numexpr\valsection+1\relax}%
}
};
}
\node[
draw=gray,
line width=2pt,
rectangle,
rounded corners=10pt,
inner sep=0pt,
text width=\the\dimexpr\textwidth+1.5cm\relax,
fill=white
]
at (current page.center)
{\rule{0pt}{\dimexpr\textheight+2cm\relax}};
\node[font=\LARGE\sffamily,fill=white]
at (border.south)
{\makebox[3em][c]{\thepage}};
\end{tikzpicture}}
}
}
\begin{document}
\section{Section One}
\hypertarget{sec:0}{}
\lipsum[1-3]
\section{Test Section Two}
\hypertarget{sec:1}{}
\lipsum[1-3]
\section{Test Section Three}
\hypertarget{sec:2}{}
\lipsum[1-3]
\section{Test Section Four}
\hypertarget{sec:3}{}
\lipsum[2]
\end{document}
Basically I reused some code from my answer
to How to print section titles like tab-list? but introducing some \hypertarget
, \hyperlink
commands to make the tabs hyperlinked to the corresponding section.
An example with the package TColorBox.
When viewing a PDF document as reading a paper book, one can consider positioning tabs on the left side on even pages and on the right side on odd pages.
\documentclass[twoside]{book}
\usepackage[margin=1in]{geometry}
\usepackage[]{hyperref}
\usepackage[all]{tcolorbox}
\usepackage{eso-pic}
\usepackage{nameref}
\usepackage{changepage}
\usepackage{lipsum}
% Tabs dimensions
\def\RightTabsNumberOf{5}
\newlength\RightTabVerticalLength
\setlength\RightTabVerticalLength{\dimexpr(\paperheight/\RightTabsNumberOf*97/100)\relax}
\newlength\RightTabVerticalDistance
\setlength\RightTabVerticalDistance{\dimexpr(\paperheight/\RightTabsNumberOf-(1mm/\RightTabsNumberOf))\relax}
\newcommand{\ClickableTcolorBox}[2]{
\begin{tcolorbox}[enhanced,size=normal,center upper,fontupper={\Large\bfseries}, colback={#2!50},width=\RightTabVerticalLength,arc=3mm,
if odd page={rounded corners=north}{rounded corners=south},
if odd page={sharp corners=south}{sharp corners=north},
if odd page={bottomrule=0mm}{toprule=0mm},
hyperref=#1
]
\nameref{#1}
\end{tcolorbox}
}
\newcommand{\RightTabs}{
\begin{tikzpicture}[overlay, remember picture]
\node (Tab1) [above left,xshift=1mm,rotate=90] at
(current page.north east){
\ClickableTcolorBox{LinkToChapterOne}{violet}};
\node (Tab2) [above left,xshift=1mm,
yshift=-\RightTabVerticalDistance,rotate=90] at
(current page.north east){
\ClickableTcolorBox{LinkToChapterTwo}{blue}};
\node (Tab3) [above left,xshift=1mm,
yshift=-2*\RightTabVerticalDistance,rotate=90] at
(current page.north east){
\ClickableTcolorBox{LinkToChapterThree}{green}};
\node (Tab4) [above left,xshift=1mm,
yshift=-3*\RightTabVerticalDistance,rotate=90] at
(current page.north east){
\ClickableTcolorBox{LinkToChapterFour}{yellow}};
\node (Tab5) [above left,xshift=1mm,
yshift=-4*\RightTabVerticalDistance,rotate=90] at
(current page.north east){
\ClickableTcolorBox{LinkToChapterFive}{red}};
\end{tikzpicture}
}
\newcommand{\LeftTabs}{
\begin{tikzpicture}[overlay, remember picture]
\node (LeftTab1) [below left,xshift=-1mm,rotate=90] at
(current page.north west){
\ClickableTcolorBox{LinkToChapterOne}{violet}};
\node (LeftTab2) [below left,xshift=-1mm,
yshift=-\RightTabVerticalDistance,rotate=90] at
(current page.north west){
\ClickableTcolorBox{LinkToChapterTwo}{blue}};
\node (LeftTab3) [below left,xshift=-1mm,
yshift=-2*\RightTabVerticalDistance,rotate=90] at
(current page.north west){
\ClickableTcolorBox{LinkToChapterThree}{green}};
\node (LeftTab4) [below left,xshift=-1mm,
yshift=-3*\RightTabVerticalDistance,rotate=90] at
(current page.north west){
\ClickableTcolorBox{LinkToChapterFour}{yellow}};
\node (LeftTab5) [below left,xshift=-1mm,
yshift=-4*\RightTabVerticalDistance,rotate=90] at
(current page.north west){
\ClickableTcolorBox{LinkToChapterFive}{red}};
\end{tikzpicture}
}
\strictpagecheck
\AddToShipoutPicture{
\checkoddpage
\ifoddpage
\RightTabs
\else
\LeftTabs
\fi
}
\begin{document}
\cleardoublepage
\chapter{Chapter One\label{LinkToChapterOne}}
\lipsum
\cleardoublepage
\chapter{Chapter Two\label{LinkToChapterTwo}}
\lipsum
\cleardoublepage
\chapter{Chapter Three\label{LinkToChapterThree}}
\lipsum
\cleardoublepage
\chapter{Chapter Four\label{LinkToChapterFour}}
\lipsum
\cleardoublepage
\chapter{Chapter Five\label{LinkToChapterFive}}
\lipsum
\end{document}
A variant of my answer of How to make hyperlinked tabs with specific colors?
\documentclass[]{book}
\usepackage[rmargin=3cm]{geometry}
\usepackage[pageanchor=true]{hyperref}
\usepackage{tikz}
\usetikzlibrary{positioning}
\usetikzlibrary{shapes}
\usepackage{eso-pic}
\usepackage{lipsum}
\def\TabThickness{8mm}
% RIGHT SIDE TABS
% Right side tabs dimensions
\def\RightTabsNumberOf{8}
\newlength\RightTabVerticalLength
\setlength\RightTabVerticalLength{\dimexpr\paperheight/\RightTabsNumberOf\relax}
\newlength\RightTabThickness
\setlength\RightTabThickness{\TabThickness}
% Right side tabs positioning
\newlength\xRightTab
\setlength\xRightTab{\dimexpr\paperwidth-(\RightTabThickness)+1pt\relax}
\newlength\xRightTabText
\setlength\xRightTabText{\dimexpr\RightTabThickness/2+1pt\relax}
\newlength\yRightTabOne
\newlength\yRightTabTwo
\newlength\yRightTabThree
\newlength\yRightTabFour
\newlength\yRightTabFive
\newlength\yRightTabSix
\newlength\yRightTabSeven
\newlength\yRightTabEight
\setlength\yRightTabOne{\dimexpr\paperheight-(\RightTabVerticalLength*1/2)\relax}
\setlength\yRightTabTwo{\dimexpr\paperheight-(\RightTabVerticalLength*3/2)\relax}
\setlength\yRightTabThree{\dimexpr\paperheight-(\RightTabVerticalLength*5/2)\relax}
\setlength\yRightTabFour{\dimexpr\paperheight-(\RightTabVerticalLength*7/2)\relax}
\setlength\yRightTabFive{\dimexpr\paperheight-(\RightTabVerticalLength*9/2)\relax}
\setlength\yRightTabSix{\dimexpr\paperheight-(\RightTabVerticalLength*11/2)\relax}
\setlength\yRightTabSeven{\dimexpr\paperheight-(\RightTabVerticalLength*13/2)\relax}
\setlength\yRightTabEight{\dimexpr\paperheight-(\RightTabVerticalLength*15/2)\relax}
% Right side tabs style
\tikzset{RightTabStyle/.style={align=center,
text=red!80!black,font=\scshape\bfseries,
text width=\RightTabVerticalLength,
text height=\RightTabThickness,
text depth=\xRightTabText,
inner sep=0pt,thick,rectangle,rounded corners=5pt,rotate=270,
draw=blue,fill=yellow!80}} %
\newcommand{\TheRightSideTabs}{%
\begin{tikzpicture}[remember picture,overlay]
\coordinate (CoordinatesRightTabOne) at (\xRightTab,\yRightTabOne) ;
\coordinate (CoordinatesRightTabTwo) at (\xRightTab,\yRightTabTwo) ;
\coordinate (CoordinatesRightTabThree) at (\xRightTab,\yRightTabThree) ;
\coordinate (CoordinatesRightTabFour) at (\xRightTab,\yRightTabFour) ;
\coordinate (CoordinatesRightTabFive) at (\xRightTab,\yRightTabFive) ;
\coordinate (CoordinatesRightTabSix) at (\xRightTab,\yRightTabSix) ;
\coordinate (CoordinatesRightTabSeven) at (\xRightTab,\yRightTabSeven) ;
\coordinate (CoordinatesRightTabEight) at (\xRightTab,\yRightTabEight) ;
\node (NodeRightTabOne) at (CoordinatesRightTabOne) {\hyperlink{LinkToChapterOne}{\tikz\node[RightTabStyle]{Chapter 1};}};
\node (NodeRightTabTwo) at (CoordinatesRightTabTwo) {\hyperlink{LinkToChapterTwo}{\tikz\node[RightTabStyle]{Chapter 2};}};
\node (NodeRightTabThree) at (CoordinatesRightTabThree) {\hyperlink{LinkToChapterThree}{\tikz\node[RightTabStyle]{Chapter 3};}};
\node (NodeRightTabFour) at (CoordinatesRightTabFour) {\hyperlink{LinkToChapterFour}{\tikz\node[RightTabStyle,text=green!80!black,fill=red!20!white]{Chapter 4};}};
\node (NodeRightTabFive) at (CoordinatesRightTabFive) {\hyperlink{LinkToChapterFive}{\tikz\node[RightTabStyle]{Chapter 5};}};
\node (NodeRightTabSix) at (CoordinatesRightTabSix) {\hyperlink{LinkToChapterSix}{\tikz\node[RightTabStyle]{Chapter 6};}};
\node (NodeRightTabSeven) at (CoordinatesRightTabSeven) {\hyperlink{LinkToChapterSeven}{\tikz\node[RightTabStyle]{Chapter 7};}};
\node (NodeRightTabEight) at (CoordinatesRightTabEight) {\hyperlink{LinkToChapterEight}{\tikz\node[RightTabStyle]{Chapter 8};}};
\end{tikzpicture}
}
\AddToShipoutPicture{
\TheRightSideTabs
}
\begin{document}
\mainmatter
\cleardoublepage
\hypertarget{LinkToChapterOne}{\chapter{Chapter One}}
\lipsum
\cleardoublepage
\hypertarget{LinkToChapterTwo}{\chapter{Chapter Two}}
\lipsum
\cleardoublepage
\hypertarget{LinkToChapterThree}{\chapter{Chapter Three}}
\lipsum
\cleardoublepage
\hypertarget{LinkToChapterFour}{\chapter{Chapter Four}}
\lipsum
\cleardoublepage
\hypertarget{LinkToChapterFive}{\chapter{Chapter Five}}
\lipsum
\cleardoublepage
\hypertarget{LinkToChapterSix}{\chapter{Chapter Six}}
\lipsum
\cleardoublepage
\hypertarget{LinkToChapterSeven}{\chapter{Chapter Seven}}
\lipsum
\cleardoublepage
\hypertarget{LinkToChapterEight}{\chapter{Chapter Eight}}
\lipsum
\end{document}