summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/tikz-timing/tikz-timing-nicetabs.sty
blob: 9ff068c778d158f7a6ee427645f9f10a3a45adfc (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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
%%
%% This is file `tikz-timing-nicetabs.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% tikz-timing.dtx  (with options: `lib,lib-nicetabs')
%% 
%% Copyright (C) 2009 by Martin Scharrer <martin@scharrer-online.de>
%% 
%% This work may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either version 1.3c
%% 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.3c or later is part of all distributions of LaTeX
%% version 2008/05/04 or later.
%% 
%% This work has the LPPL maintenance status `maintained'.
%% 
%% The Current Maintainer of this work is Martin Scharrer.
%% 
%% This work consists of the files tikz-timing.dtx, tikz-timing.ins
%% and the derived file tikz-timing.sty.
%% 
\RequirePackage{svn-prov}[2009/05/03]
\ProvidesPackageSVN[tikz-timing-nicetabs]
  {$Id: tikz-timing.dtx 1655 2010-01-14 18:33:11Z martin $}
  [v0.7b
   TikZ-Timing Library for
   nice timing tables]
\GetFileInfoSVN*%
\RequirePackage{tikz-timing}[\filedate]%
\DefineFileInfoSVN
\RequirePackage{array}
\RequirePackage{booktabs}

\newcommand*\tikztiming@nicetabs@tableheader[1][]{%
  \path [timing/table/midrules] [/utils/exec=\xdef\@gtempa{\the\pgflinewidth}];
  \path [timing/table/header,#1]
    let \p1 = (0,\belowrulesep + \aboverulesep + \@gtempa
            + \arraystretch\ht\strutbox + \arraystretch*\extrarowheight
            + \arraystretch\dp\strutbox)
    in
      coordinate (diagram@header) at (0,\y1)
      coordinate (label@header)   at ($ -1*(\tikztiming@coldist,0) + (0,\y1) $)
    ;
  \tikztiming@normal@tableheader[#1]%
}
\newcommand*\tikztiming@nicetabs@tablerules[1][]{%
  \begin{scope}[#1]
    \coordinate (NW) at (current bounding box.north west);
    \coordinate (SE) at (current bounding box.south east);
    %
    \draw [timing/table/rules]
    let
      \p1 = (NW),
      \p2 = (SE),
      \p3 = (last label.base),
      \p4 = ($ (0,\y3) - (0,\arraystretch\dp\strutbox + \aboverulesep +
        .5\pgflinewidth) $)
    in
      (\x1-\tabcolsep,\y4) -- (\x2+\tabcolsep,\y4)
     \iftikztiming@tablehead
      let
        \p5 = (diagram@header.base),
        \p6 = ($ (0,\y5) + (0,\arraystretch\ht\strutbox + \arraystretch*\extrarowheight
        + \belowrulesep + .5\pgflinewidth) $)
      in
        (\x1-\tabcolsep,\y6) -- (\x2+\tabcolsep,\y6)
     \fi
    ;
    \draw
     \iftikztiming@tablehead [timing/table/midrules] \else [timing/table/rules] \fi
    let
      \p1 = (NW),
      \p2 = (SE),
      \p3 = (0, \arraystretch\ht\strutbox + \arraystretch*\extrarowheight +
        \belowrulesep + .5\pgflinewidth)
    in
      (\x1-\tabcolsep, \y3)
       --
      (\x2+\tabcolsep, \y3)
    ;
  \end{scope}
}
\let\tikztiming@normal@tableheader\tikztiming@tableheader
\let\tikztiming@normal@tablerules\tikztiming@tablerules
\let\tikztiming@normal@coldist\tikztiming@coldist
\let\tikztiming@normal@rowdist\tikztiming@rowdist

\tikzset{%
  timing/no nice tabs/.code={%
    \let\tikztiming@coldist\tikztiming@normal@coldist
    \let\tikztiming@rowdist\tikztiming@normal@rowdist
    \let\tikztiming@tableheader\tikztiming@normal@tableheader
    \let\tikztiming@tablerules\tikztiming@normal@tablerules
  },
  timing/nice tabs/.code={%
    \ifx\tikztiming@tableheader\tikztiming@nicetabs@tableheader\else
      \let\tikztiming@normal@coldist\tikztiming@coldist
      \let\tikztiming@normal@rowdist\tikztiming@rowdist
    \fi
    \def\tikztiming@rowdist{%
       \arraystretch\ht\strutbox
      +\arraystretch*\extrarowheight
      +\arraystretch\dp\strutbox
    }%
    \def\tikztiming@coldist{2\tabcolsep}%
    \let\tikztiming@tableheader\tikztiming@nicetabs@tableheader
    \let\tikztiming@tablerules\tikztiming@nicetabs@tablerules
  },
  timing/nicetabs/no nice tabs/.style={/tikz/timing/no nice tabs},
  timing/nicetabs/off/.style={/tikz/timing/no nice tabs},
  timing/nicetabs/nice tabs/.style={/tikz/timing/nice tabs},
  timing/nicetabs/on/.style={/tikz/timing/nice tabs},
}
\tikzset{timing/nice tabs}%
\RequirePackage{pgfopts}
\ProcessPgfOptions{/tikz/timing/nicetabs}
\endinput
%%
%% End of file `tikz-timing-nicetabs.sty'.