summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/latex/mycv/Doc/mycv-decs.def
blob: 390ef395e0cb7b98a93bd09e2c8e427ea314b661 (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
%%%%%%%%%%%%%
%           %
% Parchment %
%           %
%%%%%%%%%%%%%

% ==================================================================
% Code taken from http://www.texample.net/tikz/examples/framed-tikz/
% (just a couple of changes made)
% ==================================================================

\usepackage{framed}
\usetikzlibrary{decorations.pathmorphing,decorations.shapes,calc}
\pgfmathsetseed{1} % To have predictable results
% Define a background layer, in which the parchment shape is drawn
\pgfdeclarelayer{background}
\pgfsetlayers{background,main}

% -------------------------------------------------------
% define styles for the normal border and the torn border
% -------------------------------------------------------
\tikzset{
  normal border/.style={lightgray!12, % or: orange!20!black!10, brown!10
      decorate, decoration={shape, segment length=0.5cm, amplitude=.7mm}},
  torn border/.style={orange!30!black!5, decorate,
      decoration={random steps, segment length=.5cm, amplitude=1.7mm}}}

% ----------------------------------------------------------------------
% Macro to draw the shape behind the text, when it fits completly in the
% page
% ----------------------------------------------------------------------
\def\parchmentframe#1{
\tikz{
   \node[inner sep=2em] (A) {#1};  % Draw the text of the node
   \begin{pgfonlayer}{background}  % Draw the shape behind
   \fill[normal border]
      (A.south east) -- (A.south west) --
      (A.north west) -- (A.north east) -- cycle;
   \end{pgfonlayer}}}

% -----------------------------------------------------------------
% Macro to draw the shape, when the text will continue in next page
% -----------------------------------------------------------------
\def\parchmentframetop#1{
\tikz{
   \node[inner sep=2em] (A) {#1};    % Draw the text of the node
                                     % (inner sep=2em is for the
                                     % inner space of all borders
                                     % (left,right,top and bottom)
                                     % inner ysep=0pt for the top
                                     % and bottom borders)
   \begin{pgfonlayer}{background}
   \fill[normal border]              % Draw the ``complete shape'' behind
      (A.south east) -- (A.south west) --
      (A.north west) -- (A.north east) -- cycle;
   \fill[torn border]                % Add the torn lower border
      ($(A.south east)-(0,.2)$) -- ($(A.south west)-(0,.2)$) --
      ($(A.south west)+(0,.2)$) -- ($(A.south east)+(0,.2)$) -- cycle;
   \end{pgfonlayer}}}

% -------------------------------------------------------------------
% Macro to draw the shape, when the text continues from previous page
% -------------------------------------------------------------------
\def\parchmentframebottom#1{
\tikz{
   \node[inner sep=2em] (A) {#1};   % Draw the text of the node
   \begin{pgfonlayer}{background}
   \fill[normal border]             % Draw the ``complete shape'' behind
      (A.south east) -- (A.south west) --
      (A.north west) -- (A.north east) -- cycle;
   \fill[torn border]               % Add the torn upper border
      ($(A.north east)-(0,.2)$) -- ($(A.north west)-(0,.2)$) --
      ($(A.north west)+(0,.2)$) -- ($(A.north east)+(0,.2)$) -- cycle;
   \end{pgfonlayer}}}

% ------------------------------------------------------------------------
% Macro to draw the shape, when both the text continues from previous page
% and it will continue in next page
% ------------------------------------------------------------------------
\def\parchmentframemiddle#1{
\tikz{
   \node[inner sep=2em] (A) {#1};   % Draw the text of the node
   \begin{pgfonlayer}{background}
   \fill[normal border]             % Draw the ``complete shape'' behind
      (A.south east) -- (A.south west) --
      (A.north west) -- (A.north east) -- cycle;
   \fill[torn border]               % Add the torn lower border
      ($(A.south east)-(0,.2)$) -- ($(A.south west)-(0,.2)$) --
      ($(A.south west)+(0,.2)$) -- ($(A.south east)+(0,.2)$) -- cycle;
   \fill[torn border]               % Add the torn upper border
      ($(A.north east)-(0,.2)$) -- ($(A.north west)-(0,.2)$) --
      ($(A.north west)+(0,.2)$) -- ($(A.north east)+(0,.2)$) -- cycle;
   \end{pgfonlayer}}}

% ------------------------------------------------------------------------
% Define the environment which puts the frame
% In this case, the environment also accepts an argument with an optional
% title (which defaults to ``Example'', which is typeset in a box overlaid
% on the top border
% ------------------------------------------------------------------------
\newenvironment{parchment}{%[1][Example]{%
   \def\FrameCommand{\parchmentframe}%
   \def\FirstFrameCommand{\parchmentframetop}%
   \def\LastFrameCommand{\parchmentframebottom}%
   \def\MidFrameCommand{\parchmentframemiddle}%
   \vskip\baselineskip
   \MakeFramed {\FrameRestore}}
   %\noindent\tikz\node[inner sep=1ex, draw=black!20,fill=white,
   %      anchor=west, overlay] at (0em, 2em) {\sffamily#1};\par}%
{\endMakeFramed}