Here's a possibility using the background
package (change the settings according to your needs). Using \AddLabels
the tabs are activated; \RemoveLabels
deactivates the tabs:
\documentclass[openany]{scrbook}
\usepackage[contents={},opacity=1,scale=1,color=black]{background}
\usepackage[a6paper]{geometry}% just for the example
\usepackage{tikzpagenodes}
\usepackage{totcount}
\usepackage{lipsum}% just to generate text for the example
\usetikzlibrary{calc}
\newif\ifMaterial
\newlength\LabelSize
\setlength\LabelSize{2.5cm}
\AtBeginDocument{%
\regtotcounter{chapter}
\setlength\LabelSize{\dimexpr\textheight/\totvalue{chapter}\relax}
\ifdim\LabelSize>2.5cm\relax
\global\setlength\LabelSize{2.5cm}
\fi
}
\newcommand\AddLabels{%
\Materialtrue%
\AddEverypageHook{%
\ifMaterial%
\ifodd\value{page} %
\backgroundsetup{
angle=90,
position={current page.east|-current page text area.north east},
vshift=15pt,
hshift=-\thechapter*\LabelSize,
contents={%
\tikz\node[fill=gray!30,anchor=west,text width=\LabelSize,
align=center,text height=15pt,text depth=10pt,font=\large\sffamily] {\thechapter};
}%
}
\else
\backgroundsetup{
angle=90,
position={current page.west|-current page text area.north west},
vshift=-15pt,
hshift=-\thechapter*\LabelSize,
contents={%
\tikz\node[fill=gray!30,anchor=west,text width=\LabelSize,
align=center,text height=15pt,text depth=10pt,font=\large\sffamily] {\thechapter};
}%
}
\fi
\BgMaterial%
\else\relax\fi}%
}
\newcommand\RemoveLabels{\Materialfalse}
\begin{document}
\chapter{Test Chapter One}
\AddLabels
\lipsum[1-2]
\chapter{Test Chapter Two}
\lipsum[1-2]
\chapter{Test Chapter Three}
\lipsum[1-2]
\chapter{Test Chapter Four}
\lipsum[1-2]
\chapter{Test Chapter Five}
\RemoveLabels
\lipsum[1-2]
\end{document}
