2

Within the fancytabs package, there is only a command for producing the fancytab on the right-hand side of a page. I am however using this in a twosided document and so I need it appear on the left-hand side of the page for odd numbered pages but I'm unsure on how to adjust the code provided by the package itself to do this.

fancytabs documentation

If this isn't possible, are there any alternatives to give a similar effect? Thanks.

1 Answers1

5

A good question!

Yes, it is possible. See the sketch of the definition \leftfancytab and its usage (with A working example of fancytabs as the starting point) .

\documentclass{scrbook}
\usepackage{scrpage2}
\usepackage{fancytabs}
\usepackage{lipsum}
% Capture chapter head
\let\oldchapter\chapter
\newcommand\temphead{}
\newcommand\chaphead{}
\renewcommand\chapter[2][\temphead]{%
\renewcommand\temphead{#2}%
\renewcommand\chaphead{#2}%
\oldchapter[#1]{#2}}

\makeatletter
\newcommand{\leftfancytab}[2]{%
  \begin{tikzpicture}[remember picture,overlay]%
    \node[yshift={-1*(\the\tab@top+\the\tab@height/2+
                 mod(#2-1-\tab@floor,\tab@count)*
                 (\the\tab@height+\the\tab@gap))},
    %              xshift=-0.5*\the\tab@width]
  xshift=0.5*\the\tab@width]
      at (current page.north west) {
      \tikz\shade[shading=axis,bottom color=\tab@leftcolor,
                  top color=\tab@rightcolor,shading angle=-90]
        (0,0) rectangle (\the\tab@width,\the\tab@height)
           node[rotate=0]
                  at (\tab@texthpos*\the\tab@width,\tab@textvpos*\the\tab@height)
                      {\rotatebox{90}{\tab@style#1}};%
    };%
  \end{tikzpicture}%
}
\makeatother

% Set central right header to display tab
% for both scrplain and scrheadings
\cohead[\leftfancytab{\chaphead}{\thechapter}]
{\leftfancytab{\chaphead}{\thechapter}}

\renewcommand*{\chapterpagestyle}{scrplain}
\pagestyle{scrheadings}
\begin{document}
\chapter{A chapter}
\lipsum
\lipsum
\end{document}

enter image description here