summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/fancytabs/fancytabs.sty
blob: 24b712b908088d17a75bab57a5e773be45ed1183 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
%%
%% This is file `fancytabs.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% fancytabs.dtx  (with options: `package')
%% 
%% This is a generated file.
%% 
%% Copyright (C) 2011 by Raphaël Pinson
%% 
%% This file may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either
%% version 1.2 of this license or (at your option) any later
%% version. The latest version of this license is in:
%% 
%%    http://www.latex-project.org/lppl.txt
%% 
%% and version 1.2 or later is part of all distributions of
%% LaTeX version 1999/12/01 or later.
%% 
\NeedsTeXFormat{LaTeX2e}[1999/12/01]
\ProvidesPackage{fancytabs}
   [2016/03/29 1.9 Fancy page border tabs with Tikz]

\ProvidesPackage{fancytabs}
\RequirePackage{tikz}
\RequirePackage{etoolbox}
\newcommand{\tab@style}{\Large\scshape}
\newlength{\tab@height}
\setlength{\tab@height}{4cm}
\newlength{\tab@width}
\setlength{\tab@width}{1cm}
\newcommand{\tab@count}{6}
\newcommand{\tab@leftcolor}{white}
\newcommand{\tab@rightcolor}{gray!50}
\newlength{\tab@top}
\setlength{\tab@top}{\the\tab@height}
\newcommand{\tab@textvpos}{0.5}
\newcommand{\tab@texthpos}{\tab@textvpos}
\newlength{\tab@gap}
\setlength{\tab@gap}{0in}
\newcommand{\tab@floor}{0}
\newcommand{\tab@rotate}{90}
\newcommand{\fancytabsStyle}[1]{\renewcommand{\tab@style}{#1}}
\newcommand{\fancytabsHeight}[1]{\setlength{\tab@height}{#1}}
\newcommand{\fancytabsWidth}[1]{\setlength{\tab@width}{#1}}
\newcommand{\fancytabsCount}[1]{\renewcommand{\tab@count}{#1}}
\newcommand{\fancytabsLeftColor}[1]{\renewcommand{\tab@leftcolor}{#1}}
\newcommand{\fancytabsRightColor}[1]{\renewcommand{\tab@rightcolor}{#1}}
\newcommand{\fancytabsTop}[1]{\setlength{\tab@top}{#1}}
\newcommand{\fancytabsTextVPos}[1]{\renewcommand{\tab@textvpos}{#1}}
\newcommand{\fancytabsTextHPos}[1]{\renewcommand{\tab@texthpos}{#1}}
\newcommand{\fancytabsGap}[1]{\setlength{\tab@gap}{#1}}
\newcommand{\fancytabsFloor}[1]{\renewcommand{\tab@floor}{#1}}
\newcommand{\fancytabsRotate}[1]{\renewcommand{\tab@rotate}{#1}}
\AtBeginDocument{\@ifpackageloaded{babel}
  {\@ifundefined{active@char;}{}{%
    \g@addto@macro\tikz@installcommands{%
      \shorthandoff{;}}%
      \g@addto@macro\tikz@uninstallcommands{%
        \shorthandon{;}}%
  }%
  }{}%
}
\newcommand{\fancytab}[3][RIGHT]{%
  \ifstrequal{#1}{LEFT}
    {
      \newcommand{\eastwest}{west}
      \newcommand{\multiplier}{0.5}
    }
    { %else
      \newcommand{\eastwest}{east}
      \newcommand{\multiplier}{-0.5}
    }
  \begin{tikzpicture}[remember picture,overlay]%
    \node[yshift={-1*(\the\tab@top+\the\tab@height/2+
                 mod(#3-1-\tab@floor,\tab@count)*
                 (\the\tab@height+\the\tab@gap))},
                  xshift=\multiplier*\the\tab@width]
      at (current page.north \eastwest) {
      \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{\tab@rotate}{\tab@style#2}};%
    };%
  \end{tikzpicture}%
}
\endinput
%%
%% End of file `fancytabs.sty'.