summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/clrstrip/clrstrip.sty
blob: 6baafb8282443fd1696fc4e2344b38bb20285442 (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
%%
%% This is file `clrstrip.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% clrstrip.dtx  (with options: `pkg')
%% 
%% --------------------------------------------------------------
%% clrstrip -- place contents into a full width colour strip
%% E-mail: jspratte@yahoo.de
%% Released under the LaTeX Project Public License v1.3c or later
%% See http://www.latex-project.org/lppl.txt
%% --------------------------------------------------------------
%% 
%% Copyright (C) 2018-2020 Jonathan P. Spratte
%% 
%% This  work may be  distributed and/or  modified under  the conditions  of the
%% LaTeX Project Public License (LPPL),  either version 1.3c  of this license or
%% (at your option) any later version.  The latest version of this license is in
%% the file:
%% 
%%   http://www.latex-project.org/lppl.txt
%% 
%% This work is "maintained" (as per LPPL maintenance status) by
%%   Jonathan P. Spratte.
%% 
%% This work consists of the file  clrstrip.dtx
%% and the derived files           clrstrip.pdf and
%%                                 clrstrip.sty.
%% 
\newcommand*\clrstrip@date{2020-01-23}
\ProvidesPackage{clrstrip}
  [\clrstrip@date\space place contents into a full width colour strip]
\RequirePackage{expkv}
\newsavebox\clrstrip@box
\newlength\clrstrip@innerT
\clrstrip@innerT\medskipamount
\newlength\clrstrip@innerB
\clrstrip@innerB\clrstrip@innerT
\newlength\clrstrip@outerT
\clrstrip@outerT\clrstrip@innerT
\newlength\clrstrip@outerB
\clrstrip@outerB\clrstrip@innerT
\newlength\clrstrip@width
\newlength\clrstrip@left
\clrstrip@left1sp
\newcommand*\clrstrip@arg{}
\newcommand*\clrstrip@key{\protected\ekvdef{clrstrip}}
\newcommand*\clrstrip@keyNV{\protected\ekvdefNoVal{clrstrip}}
\newcommand\clrstrip@start[1][]
  {%
    \colorstripSet{#1}%
    \ifdim\clrstrip@width=\z@
      \clrstrip@width\linewidth
    \fi
    \setbox\clrstrip@box\vbox\bgroup
      \hsize\clrstrip@width
      \linewidth\hsize
      \color@setgroup
      \clrstrip@preventIndent
  }
\newcommand*\clrstrip@afterheading{\@afterindentfalse\@afterheading}
\newcommand*\clrstrip@noindent{\noindent\ignorespaces}
\newcommand*\clrstrip@preventIndent{}
\let\clrstrip@preventIndent\clrstrip@afterheading
\clrstrip@key{inner}{\clrstrip@innerT#1\relax\clrstrip@innerB#1\relax}
\clrstrip@key{outer}{\clrstrip@outerT#1\relax\clrstrip@outerB#1\relax}
\clrstrip@key{inner top}{\clrstrip@innerT#1\relax}
\clrstrip@key{inner bot}{\clrstrip@innerB#1\relax}
\clrstrip@key{outer top}{\clrstrip@outerB#1\relax}
\clrstrip@key{outer bot}{\clrstrip@outerB#1\relax}
\clrstrip@key{width}{\clrstrip@width#1\relax}
\clrstrip@key{left}{\clrstrip@left#1\relax}
\clrstrip@keyNV{afterheading}{\let\clrstrip@preventIndent\clrstrip@afterheading}
\clrstrip@keyNV{noindent}{\let\clrstrip@preventIndent\clrstrip@noindent}
\protected\def\colorstripSet{\ekvset{clrstrip}}
\newenvironment{colorstrip}[2][]
  {%
    \def\clrstrip@arg{#1}%
    \ifx\clrstrip@arg\@empty
      \def\clrstrip@arg{{#2}}%
    \else
      \def\clrstrip@arg{[{#1}]{#2}}%
    \fi
    \clrstrip@start
  }
  {%
    \color@endgroup
    \egroup
    \par
    \vskip\clrstrip@outerT
    \noindent
    \begingroup
      \expandafter\color\clrstrip@arg
      \advance\clrstrip@innerT\ht\clrstrip@box
      \advance\clrstrip@innerB\dp\clrstrip@box
      \rlap
        {%
          \hskip-\paperwidth
          \vrule
            width 2\paperwidth
            height \clrstrip@innerT
            depth \clrstrip@innerB
        }%
    \endgroup
    \ifdim\clrstrip@left=1sp
      \advance\clrstrip@width-\linewidth
      \clrstrip@left-.5\clrstrip@width
    \fi
    \rlap{\hskip\clrstrip@left\copy\clrstrip@box}%
    \par
    \vskip\clrstrip@outerB
    \@endpetrue
  }
%% 
%%
%% End of file `clrstrip.sty'.