summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/mycv/mycv_dec.sty
blob: 31dbb3e2d853cccfff5d50794cd1d8e18ad7177c (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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
%%
%% This is file `mycv_dec.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% mycv.dtx  (with options: `mycv-dec.sty')
%% --------------------------------------------------------
%%  Author: Andrea Ghersi
%%  Copyright 2012 Ghersi Andrea (ghanhawk@gmail.com).
%% 
%%  This work may be distributed and/or modified under the
%%  conditions of the LaTeX Project Public License version
%%  1.3c, available at 'http://www.latex-project.org/lppl'.
%% 
%%  This work has the LPPL maintenance status "maintained".
%%  The Current Maintainer of this work is Andrea Ghersi.
%% 
%%  This work consists of the files listed in the README
%%  file.
%% --------------------------------------------------------

\NeedsTeXFormat{LaTeX2e}
\RequirePackage{svn-prov}

\input{mycv_version.def}

\ProvidesPackageSVN
   {$Id: mycv_dec.sty 89 2012-05-19 18:23:03Z ghangenit $}
   [v\@versionstr][Decorations commands]

\RequirePackage{tikz} % for graphics
\usetikzlibrary{shapes,decorations,shadows,fadings}
\usetikzlibrary{decorations.pathmorphing}
\usetikzlibrary{decorations.fractals}
\usetikzlibrary{decorations.shapes}
\usetikzlibrary{calc}
\RequirePackage{xparse}  % for commands with multiple default arguments
\RequirePackage{xstring} % for string utilities

%%%%%%%%%%%%%
%%          %
%% Settings %
%%          %
%%%%%%%%%%%%%

\def\@segmentLengthString{}
\def\@segmentLengthValue{}
\def\@lineWidthString{}
\def\@lineWidthValue{}
\def\@segmentAmplitudeString{}
\def\@segmentAmplitudeValue{}
\def\@xBottomRight{-1cm}
\def\@yBottomRight{1cm}
\def\@xTopLeft{1cm}
\def\@yTopLeft{-1cm}

\tikzfading[%
   name=fade out, inner color=transparent!0,
   outer color=transparent!100%
]

\tikzset{
   define mycolor/.code 2 args={\definecolor{#1}{rgb}{#2}},
   DecoratewithShape/.style={%
      decorate,decoration={shape backgrounds,shape=#1}%
   },
   DecoratewithPathMorphing/.style={%
      decorate,decoration=#1%
   },
   Mainstyle/.style={
      define mycolor={myred}{0.43,0.06,0,13},
      define mycolor={dpred}{0.80,0.35,0}
   }
}

%%%%%%%%%%%%%
%%          %
%% Commands %
%%          %
%%%%%%%%%%%%%

\newcommand{\versionBasedSettings}[2]{%
  \IfBooleanTF#1{%
      %% ---------------------------------------------------------
      %% From <xstring> package
      %% ---------------------------------------------------------
      %% Macros of this package take the catcodes of tokens into
      %% account. To avoid unexpected behaviour (particulary with
      %% tests), you should keep in mind that tokens and their
      %% catcodes are examined.
      %% For instance, these two arguments: {\string a\string b}
      %% and {ab} do not expand into equal strings for xstring!
      %% Because of the command \string, the first expands into
      %% ab with catcodes 12 while the second have characters
      %% with their natural catcodes 11. Catcodes do not match!
      %% Starred macros do not take catcodes into account. They
      %% simply convert some arguments into arguments with
      %% catcodes 10, 11 and 12, and call the non-starred macros
      %% with these modified arguments.
      %% ---------------------------------------------------------
      \IfStrEqCase*{#2}{%
         {radial}{\def\@colorStr{inner color}}%
         {ball}{\def\@colorStr{ball color}}%
         {none}{\relax}%
      }%
      [mycv: Unknown option <#2>!!!]%
   }{\relax}%
}

%% -----------------------------------------------------
%% Pathmorphing decoration values:
%%    shape, straight zigzag, random steps, saw, zigzag,
%%    bent, bumps, coil, snake, Koch snowflake
%%
%% Shadings: radial, ball
%% -----------------------------------------------------

\DeclareDocumentCommand{\mydecorationsPathmorphing}%
   {s O{1} m O{gray} D<>{radial} D<>{white}}%
{%
   \begingroup
   \versionBasedSettings{#1}{#5}%
   \begin{tikzpicture}[overlay,remember picture]%
      \IfBooleanTF#1{% version with a star (shading)
         \shade[
            Mainstyle,
            \@lineWidthString=\@lineWidthValue,
            \@segmentAmplitudeString=\@segmentAmplitudeValue,
            \@segmentLengthString=\@segmentLengthValue,
            DecoratewithPathMorphing=#3,
            color=#4,
            shading=#5,
            \@colorStr=#6,
            \ifnum#2>0draw\fi
         ]}%
      {% version without a star (not shading)
         \path[
            Mainstyle,
            \@lineWidthString=\@lineWidthValue,
            \@segmentAmplitudeString=\@segmentAmplitudeValue,
            \@segmentLengthString=\@segmentLengthValue,
            DecoratewithPathMorphing=#3,
            color=#4,
            fill=#6,
            \ifnum#2>0draw\fi
         ]}%
      ($ (current page.north west)+
         (\@xTopLeft,\@yTopLeft) $)
      rectangle % -- oppure circle (4), ...
      ($ (current page.south east)+
         (\@xBottomRight,\@yBottomRight) $);
   \end{tikzpicture}
   \endgroup
}

%% --------------------------------------
%% Shapes: dart, diamond, rectangle, star
%% --------------------------------------

\DeclareDocumentCommand{\mydecorationsShape}%
   {O{1} m O{gray}}
{%
   \begingroup
   \begin{tikzpicture}[overlay,remember picture]
      \path[
         Mainstyle,
         \@lineWidthString=\@lineWidthValue,
         \@segmentAmplitudeString=\@segmentAmplitudeValue,
         \@segmentLengthString=\@segmentLengthValue,
         DecoratewithShape=#2,
         color=#3,
         \ifnum#1>0draw\fi
      ]%
      ($ (current page.north west)+
         (\@xTopLeft,\@yTopLeft) $)
      rectangle
      ($ (current page.south east)+
         (\@xBottomRight,\@yBottomRight) $);
   \end{tikzpicture}
   \endgroup
}

\DeclareDocumentCommand{\mydecorationsFading}%
   {O{north} m O{80} O{black} D<>{1.0}}
{%
   \begin{tikzpicture}[overlay,remember picture]
   \draw[path fading=#1,fill=#2!#3!#4,opacity=#5]
      ($ (current page.north west)+
         (\@xTopLeft,\@yTopLeft) $)
      rectangle % -- oppure circle (4), ...
      ($ (current page.south east)+
         (\@xBottomRight,\@yBottomRight) $);
   \end{tikzpicture}%
}

\DeclareRobustCommand{\mydecorationsSetPosXTL}[1]%
   [1cm]%
{%
   \def\@xTopLeft{#1}%
}

\DeclareRobustCommand{\mydecorationsSetPosYTL}[1]%
   [-1cm]%
{%
   \def\@yTopLeft{#1}%
}

\DeclareRobustCommand{\mydecorationsSetPosXBR}[1]%
   [-1cm]%
{%
   \def\@xBottomRight{#1}%
}

\DeclareRobustCommand{\mydecorationsSetPosYBR}[1]%
   [1cm]%
{%
   \def\@yBottomRight{#1}%
}

\DeclareDocumentCommand{\mydecorationsSetLineWidth}%
   {s O{}}%
{%
   \IfBooleanTF#1%
      {\def\@lineWidthString{}} % starred
      {\def\@lineWidthString{line width}} % not starred

   \def\@lineWidthValue{#2}%
}

\DeclareDocumentCommand{\mydecorationsSetSegmentAmplitude}%
   {s O{}}%
{%
   \IfBooleanTF#1%
      {\def\@segmentAmplitudeString{}} % starred
      {\def\@segmentAmplitudeString{segment amplitude}} % not starred

   \def\@segmentAmplitudeValue{#2}%
}

\DeclareDocumentCommand{\mydecorationsSetSegmentLength}%
   {s O{}}%
{%
   \IfBooleanTF#1%
      {\def\@segmentLengthString{}} % starred
      {\def\@segmentLengthString{segment length}} % not starred

   \def\@segmentLengthValue{#2}%
}
\endinput
%%
%% End of file `mycv_dec.sty'.