8

I am trying to get a blue thumb index with some text to go down all the way on the right hand side of every page in some sort of application I am writing on. The text on the thumb index can be different for every page. I can not get it to work properly. Even if I try to maipulate it to get "correct" on the screen it gets ugly when I print it out as a hard copy.

Is there anybody who know how I can sort this on a better way. All help will be appreciated!

My code:

\documentclass[a4paper,12pt,twoside]{article} 
\usepackage[norsk]{babel} 
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[margin=2.5cm]{geometry}
\usepackage{setspace}
\onehalfspacing
\usepackage{parskip}
\usepackage{fontawesome} 
\usepackage{graphicx,tikz}
\definecolor{color1}{rgb}{0.22,0.45,0.70} %blå fra cvmodern.
\usepackage{lipsum}

\begin{document}

\setcounter{page}{0}
\pagenumbering{roman}

%Contact info:
\noindent
\begin{minipage}[t][0.8cm][b]{0.33\textwidth} \small{name} \\ \small{address} \\ \small{post number}
\end{minipage}
\begin{minipage}[t][0.8cm][b]{0.33\textwidth}\faMobilePhone \hspace{2.2mm} \small{666 66 666}\\ \faEnvelope \hspace{0.2mm} \small{[email protected]} 
\end{minipage}
\begin{minipage}[t][0.8cm][b]{0.33\textwidth}\hfill \small{\today}
\end{minipage}

% thumb index:
\begin{tikzpicture}[overlay] 
\tikzset{anchor=west} %used to rotate the textnodes.
\draw [color=color1, fill=color1] (17.5,-35) rectangle (18.5,10);
\node [rotate=90,white,font=\Large\bfseries,below left] at (17.6,2.2){Application};
\end{tikzpicture}

\vspace{0.3cm}
\textbf{Application on the job} \\
\lipsum

\begin{tikzpicture}[overlay]
\tikzset{anchor=west}
\draw [fill=color1,color=color1] (17.5,-35) rectangle (18.5,10);
\node [rotate=90,white,font=\Large\bfseries,below left] at (17.6,0.48){Appendix};
\end{tikzpicture}  

\end{document}

enter image description here

enter image description here

1 Answer 1

9

You can use the current page family of nodes to avoid manually specifying coordinates:

\documentclass[a4paper,12pt,twoside]{article} 
\usepackage[norsk]{babel} 
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[margin=2.5cm]{geometry}
\usepackage{setspace}
\onehalfspacing
\usepackage{parskip}
\usepackage{fontawesome} 
\usepackage{graphicx,tikz}
\definecolor{color1}{rgb}{0.22,0.45,0.70} %blå fra cvmodern.
\usepackage{lipsum}

\begin{document}

\setcounter{page}{0}
\pagenumbering{roman}

%Contact info:
\noindent
\begin{minipage}[t][0.8cm][b]{0.33\textwidth} {\small name} \\ {\small address} \\ \small{post number}
\end{minipage}%
\begin{minipage}[t][0.8cm][b]{0.33\textwidth}\faMobilePhone \hspace{2.2mm} {\small666 66 666}\\ \faEnvelope \hspace{0.2mm} \small{[email protected]} 
\end{minipage}%
\begin{minipage}[t][0.8cm][b]{0.33\textwidth}\hfill {\small \today}
\end{minipage}

% thumb index:
\begin{tikzpicture}[remember picture,overlay] 
\draw [color=color1, fill=color1] 
  ([xshift=-35pt]current page.north east) rectangle (current page.south east);
\node[rotate=90,white,font=\Large\bfseries,anchor=south east] 
  at ([yshift=-10pt,xshift=-5pt]current page.north east) 
  {Application};
\end{tikzpicture}

\vspace{0.3cm}
\textbf{Application on the job} \\
\lipsum

\begin{tikzpicture}[remember picture,overlay]
\draw [color=color1, fill=color1] 
  ([xshift=-30pt]current page.north east) rectangle (current page.south east);
\node[rotate=90,white,font=\Large\bfseries,anchor=south east] 
  at ([yshift=-10pt,xshift=-5pt]current page.north east) 
 {Appendix};
\end{tikzpicture}  

\end{document}

The result:

enter image description here

Of couse, a new command will simplify the job:

\newcommand\ThumbIndex[1]{%
\begin{tikzpicture}[remember picture,overlay] 
\draw [color=color1, fill=color1] 
  ([xshift=-35pt]current page.north east) rectangle (current page.south east);
\node[rotate=90,white,font=\Large\bfseries,anchor=south east] 
  at ([yshift=-10pt,xshift=-5pt]current page.north east) 
  {#1};
\end{tikzpicture}%
}

And the, in the document,

 \ThumbIndex{Application}

and

 \ThumbIndex{Apprndix}

at the desired locations. The complete code:

\documentclass[a4paper,12pt,twoside]{article} 
\usepackage[norsk]{babel} 
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[margin=2.5cm]{geometry}
\usepackage{setspace}
\onehalfspacing
\usepackage{parskip}
\usepackage{fontawesome} 
\usepackage{graphicx,tikz}
\definecolor{color1}{rgb}{0.22,0.45,0.70} %blå fra cvmodern.
\usepackage{lipsum}

\newcommand\ThumbIndex[1]{%
\begin{tikzpicture}[remember picture,overlay] 
\draw [color=color1, fill=color1] 
  ([xshift=-35pt]current page.north east) rectangle (current page.south east);
\node[rotate=90,white,font=\Large\bfseries,anchor=south east] 
  at ([yshift=-10pt,xshift=-5pt]current page.north east) 
  {#1};
\end{tikzpicture}%
}

\begin{document}

\setcounter{page}{0}
\pagenumbering{roman}

%Contact info:
\noindent
\begin{minipage}[t][0.8cm][b]{0.33\textwidth} {\small name} \\ {\small address} \\ \small{post number}
\end{minipage}%
\begin{minipage}[t][0.8cm][b]{0.33\textwidth}\faMobilePhone \hspace{2.2mm} {\small666 66 666}\\ \faEnvelope \hspace{0.2mm} \small{[email protected]} 
\end{minipage}%
\begin{minipage}[t][0.8cm][b]{0.33\textwidth}\hfill {\small \today}
\end{minipage}

\ThumbIndex{Application};

\vspace{0.3cm}
\textbf{Application on the job} \\
\lipsum

\ThumbIndex{Appendix};

\end{document}

If you want to move the thumbindex, you can use another argument argument, or make the shift depend on sectional unit counters:

\newcommand\ThumbIndex[2]{%
\begin{tikzpicture}[remember picture,overlay] 
\draw [color=color1, fill=color1] 
  ([xshift=-35pt]current page.north east) rectangle (current page.south east);
\node[rotate=90,white,font=\Large\bfseries,anchor=south east] 
  at ([shift={#2}]current page.north east) 
  {#1};
\end{tikzpicture}%
}

And then

\ThumbIndex{Application}{(-5pt,-10pt)};

and

\ThumbIndex{Appendix}{(-5pt,-120pt)};

The result of the code below:

enter image description here

The complete code:

\documentclass[a4paper,12pt,twoside]{article} 
\usepackage[norsk]{babel} 
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[margin=2.5cm]{geometry}
\usepackage{setspace}
\onehalfspacing
\usepackage{parskip}
\usepackage{fontawesome} 
\usepackage{graphicx,tikz}
\definecolor{color1}{rgb}{0.22,0.45,0.70} %blå fra cvmodern.
\usepackage{lipsum}

\newcommand\ThumbIndex[2]{%
\begin{tikzpicture}[remember picture,overlay] 
\draw [color=color1, fill=color1] 
  ([xshift=-35pt]current page.north east) rectangle (current page.south east);
\node[rotate=90,white,font=\Large\bfseries,anchor=south east] 
  at ([shift={#2}]current page.north east) 
  {#1};
\end{tikzpicture}%
}

\begin{document}

\setcounter{page}{0}
\pagenumbering{roman}

%Contact info:
\noindent
\begin{minipage}[t][0.8cm][b]{0.33\textwidth} {\small name} \\ {\small address} \\ \small{post number}
\end{minipage}%
\begin{minipage}[t][0.8cm][b]{0.33\textwidth}\faMobilePhone \hspace{2.2mm} {\small666 66 666}\\ \faEnvelope \hspace{0.2mm} \small{[email protected]} 
\end{minipage}%
\begin{minipage}[t][0.8cm][b]{0.33\textwidth}\hfill {\small \today}
\end{minipage}

\ThumbIndex{Application}{(-5pt,-10pt)};

\vspace{0.3cm}
\textbf{Application on the job} \\
\lipsum

\ThumbIndex{Appendix}{(-5pt,-120pt)};

\end{document}

Remarks

  • Perhaps the background package could also be used here, but with the information in the question I cannot decide.

  • \small and similar switches don't receive arguments. Instead of \small{text} you should use {\small text}.

  • I added some % at the end of the first two minipages to prevent spurious blank spaces from causing overfull \hboxes.

1
  • +1, but: I think there's a typo in the last example. Surely the ; that follows the second argument of \ThumbIndex is not really part of how the command should be used.
    – jon
    Jul 31, 2015 at 1:54

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .