Debian Codegraph @

texmf-dist/source/latex/koma-script/doc/plength-tikz.tex

raw
1 % ======================================================================
2 % plength-tikz.tex
3 % Copyright (c) Markus Kohm, 2005-2022
4 %
5 % This file is part of the LaTeX2e KOMA-Script bundle.
6 %
7 % This work may be distributed and/or modified under the conditions of
8 % the LaTeX Project Public License, version 1.3c of the license.
9 % The latest version of this license is in
10 % http://www.latex-project.org/lppl.txt
11 % and version 1.3c or later is part of all distributions of LaTeX
12 % version 2005/12/01 or later and of this work.
13 %
14 % This work has the LPPL maintenance status "author-maintained".
15 %
16 % The Current Maintainer and author of this work is Markus Kohm.
17 %
18 % This work consists of all files listed in MANIFEST.md.
19 % ----------------------------------------------------------------------
20 %
21 % Generation of plength figures at scrlttr2 chapter of the KOMA-Script
22 % guide
23 %
24 % Maintained by Markus Kohm
25 % Original metapost source by Stephan Hennig
26 % Original TikZ source by Marei Peischl
27 %
28 % ======================================================================
29
30 \KOMAProvidesFile{plength-tikz.tex}%
31 [$Date: 2022-06-05 12:40:11 +0200 (So, 05. Jun 2022) $
32 KOMA-Script guide (figure in scrlttr2.tex)]
33
34 \ExplSyntaxOn
35 \prop_if_exist:NF \l_this_plength_description_prop {
36 \prop_new:N \l_this_plength_description_prop
37 }
38 \prop_set_from_keyval:Nn \l_this_plength_description_prop {
39 firsthead=\letterheadname,
40 firstfoot=\letterfootname,
41 backaddress=\backaddressname,
42 specialmail=\specialmailname,
43 toaddr=\toaddrname,
44 refline=\reflinename,
45 title=\titlename,
46 subject=\subjectname,
47 opening=\openingname,
48 body=\letterbodyname,
49 closing=\closingname,
50 signature=\signaturename,
51 location=\begin{tabular}{@{}c@{}}\locationname\end{tabular},
52 }
53
54 \prop_if_exist:NF \l_this_plength_var_prop {
55 \prop_new:N \l_this_plength_var_prop
56 }
57
58 \prop_set_from_keyval:Nn \l_this_plength_var_prop {
59 ticksize=1,
60 textwidth= 147,
61 textheight= 209.4,
62 evensidemargin= 6.1,
63 oddsidemargin = 6.1,
64 paperwidth = 210,
65 paperheight = 297,
66 baselineskip = .9\baselineskip,% 3.86607,
67 headheight = 6,
68 headsep =7.2,
69 footskip =16.73,
70 foldmarkhpos = 3.5,
71 tfoldmarkvpos = 105,
72 bfoldmarkvpos = 210,
73 tfoldmarklength = 2,
74 pfoldmarklength = 4,
75 bfoldmarklength = 2,
76 toaddrvpos = 45,
77 refvpos = 98.5,
78 refaftervskip = \UseVar{baselineskip},
79 toaddrhpos = 20,
80 toaddrwidth = 85,
81 toaddrheight = 40,
82 toaddrindent = 6,
83 specialmailwidth = 50,
84 specialmailrightindent = 4,
85 specialmailheight = \UseVar{baselineskip},
86 locwidth = 37.5,
87 backaddrheight = 5,
88 firstheadvpos = 8,
89 firstheadwidth = \UseVar{paperwidth} - 2 * \UseVar{toaddrhpos},
90 firstfootwidth = \UseVar{firstheadwidth},
91 firstfootvpos = 16.58 + \UseVar{headheight} + \UseVar{headsep} + \UseVar{textheight} + \UseVar{footskip},
92 refwidth = 0,
93 sigindent = 0,
94 toaddrindent =0,
95 sigbeforevskip = 2*\UseVar{baselineskip},
96 firstheadhpos = 0.5* \UseVar{paperwidth}-.5*\UseVar{firstheadwidth},
97 firstheadheight = 5*\UseVar{baselineskip},
98 firstfoothpos = 0.5*(\UseVar{paperwidth}-\UseVar{firstfootwidth}),
99 firstfootheight = 3*\UseVar{baselineskip},
100 fromrulewidth = 0.5 * \UseVar{firstheadwidth},
101 lochpos = \UseVar{paperwidth}-\UseVar{toaddrhpos}-\UseVar{locwidth},
102 refhpos = 25.40+\UseVar{oddsidemargin},
103 text = \UseVar{refhpos},
104 textcenter = \UseVar{refhpos}+0.5*\UseVar{textwidth},
105 refheight = 2*\UseVar{baselineskip},
106 refwidth = \UseVar{textwidth},
107 titlevpos = \UseVar{refvpos}+\UseVar{refheight}+\UseVar{refaftervskip},
108 titlewidth = 90,
109 titleheight = 1.2*\UseVar{baselineskip},
110 subjectvpos = \UseVar{titlevpos}+\UseVar{titleheight}+1*\UseVar{baselineskip},
111 subjectwidth = 80,
112 subjectheight = \UseVar{baselineskip},
113 openingvpos = \UseVar{subjectvpos}+\UseVar{subjectheight}+2*\UseVar{baselineskip},
114 openingwidth = 60,
115 openingheight = \UseVar{baselineskip},
116 bodyvpos = \UseVar{openingvpos}+\UseVar{openingheight}+\UseVar{baselineskip},
117 bodywidth = \UseVar{textwidth},
118 bodyheight = 6*\UseVar{baselineskip},
119 typeareabottom = \UseVar{firstfootvpos}-\UseVar{footskip},
120 sigvpos = \UseVar{bodyvpos}+\UseVar{bodyheight}+\UseVar{baselineskip},
121 sigwidth = 50,
122 sigheight = \UseVar{baselineskip},
123 locvpos = \UseVar{toaddrvpos},
124 locheight = \UseVar{toaddrheight},
125 sigindent = 10,
126 toaddrindent = 7,
127 }
128 \def\UseVar#1{
129 \fp_eval:n {\prop_item:Nn \l_this_plength_var_prop {#1}}
130 }
131
132 \def\UseDesc#1{
133 \desc
134 \prop_item:Nn \l_this_plength_description_prop {#1}
135 }
136
137 \ExplSyntaxOff
138
139 \def\desc{\itshape}
140
141 \providecommand*{\Multi}[1]{%
142 {\def\and{, }%
143 \begin{tabular}{@{}l@{}}
144 #1
145 \end{tabular}
146 }%
147 }
148
149 \pgfarrowsdeclare{measure}{measure}
150 {
151 \arrowsize=\pgflinewidth
152 \pgfarrowsleftextend{0\arrowsize}
153 \pgfarrowsrightextend{5\arrowsize}
154 }{
155 \arrowsize=\pgflinewidth
156 \pgfsetdash{}{0pt}
157 \pgfsetlinewidth{.5\arrowsize}
158 \pgfpathmoveto{\pgfpoint{4.75\arrowsize}{7\arrowsize}}
159 \pgfpathlineto{\pgfpoint{4.75\arrowsize}{-7\arrowsize}}
160 \pgfusepathqstroke
161 \pgfsetlinewidth{0.01pt}
162 \pgfpathmoveto{\pgfpoint{4.5\arrowsize}{0pt}}
163 \pgfpathlineto{\pgfpoint{-.5\arrowsize}{2\arrowsize}}
164 \pgfpathlineto{\pgfpoint{-.5\arrowsize}{-2\arrowsize}}
165 \pgfpathclose
166 \pgfusepathqfillstroke
167 }
168
169 \pgfdeclaredecoration{vmeasure}{measure begin}{%
170 \state{measure begin}[
171 width={\pgfmetadecoratedpathlength - \pgfdecorationsegmentlength},
172 next state=measure end,
173 ]
174 {
175 \pgfpathmoveto{\pgfqpoint{\dimexpr\pgfmetadecoratedpathlength - \pgfdecorationsegmentlength}{0pt}}
176 }%
177 \state{measure end}[width=0pt, next state=final]{
178 \pgfpathlineto{\pgfpointorigin}
179 }%
180 \state{final}
181 {
182 \pgfpathlineto{\pgfpointdecoratedpathlast}
183 }%
184 }%
185
186 \tikzset{
187 measure/.style={arrows=measure-measure,every node/.append style={font=\sffamily\strut}},
188 top hmeasure/.style={measure,
189 yshift=7\pgflinewidth,
190 every node/.append style={yshift=10\pgflinewidth},
191 },
192 bottom hmeasure/.style={measure,every node/.append style={below},yshift=-7\pgflinewidth,},
193 left double vmeasure/.style={
194 measure,
195 xshift=-7\pgflinewidth,
196 every node/.append style={rotate=90,above,},
197 },
198 right double vmeasure/.style={
199 measure,
200 xshift=7\pgflinewidth,
201 every node/.append style={rotate=90,below},
202 },
203 right vmeasure/.style={
204 measure,
205 xshift=7\pgflinewidth,
206 arrows=-measure,
207 decoration={vmeasure,post length=14\pgflinewidth,segment length=20\pgflinewidth},decorate,
208 every node/.append style={above=7\pgflinewidth},
209 },
210 left vmeasure/.style={
211 measure,
212 xshift=-7\pgflinewidth,
213 arrows=-measure,
214 decoration={vmeasure,post length=14\pgflinewidth,segment length=20\pgflinewidth},decorate,
215 every node/.append style={above=14\pgflinewidth},
216 },
217 hmeasure/.style={yshift=7\pgflinewidth},
218 measure right/.style={xshift=7\pgflinewidth},
219 measure left/.style={xshift=-7\pgflinewidth}
220 }
221
222 \begin{tikzpicture}[fill=black!20]
223 \draw (0,0)rectangle (\UseVar{paperwidth},\UseVar{paperheight});
224
225 \filldraw(\UseVar{firstheadhpos},\UseVar{firstheadvpos})rectangle node{\UseDesc{firsthead}}+(\UseVar{firstheadwidth},\UseVar{firstheadheight});
226
227 \filldraw(\UseVar{toaddrhpos},\UseVar{toaddrvpos}) rectangle
228 node {\UseDesc{backaddress}}
229 +(\UseVar{toaddrwidth},\UseVar{backaddrheight});
230
231 \filldraw(\UseVar{toaddrhpos}+.5*\UseVar{toaddrwidth}-\UseVar{specialmailrightindent},\UseVar{toaddrvpos}+\UseVar{backaddrheight}) rectangle
232 node {\UseDesc{specialmail}}
233 +(.5*\UseVar{toaddrwidth},\UseVar{specialmailheight});
234
235 \filldraw(\UseVar{toaddrhpos}+\UseVar{toaddrindent},\UseVar{toaddrvpos}+\UseVar{backaddrheight}+\UseVar{specialmailheight})
236 rectangle node {\UseDesc{toaddr}}
237 +(\UseVar{toaddrwidth}-2*\UseVar{toaddrindent},\UseVar{toaddrheight}-\UseVar{backaddrheight}-\UseVar{specialmailheight});
238
239 \draw(\UseVar{toaddrhpos},\UseVar{toaddrvpos})rectangle+(\UseVar{toaddrwidth},\UseVar{toaddrheight});
240
241 \filldraw (\UseVar{refhpos},\UseVar{refvpos})rectangle node{\UseDesc{refline}}
242 +(\UseVar{refwidth},\UseVar{refheight});
243
244 \filldraw (\UseVar{textcenter}-.5*\UseVar{titlewidth},\UseVar{titlevpos})rectangle node{\UseDesc{title}}
245 +(\UseVar{titlewidth},\UseVar{titleheight});
246
247 \filldraw (\UseVar{text},\UseVar{subjectvpos})rectangle node{\UseDesc{subject}}
248 +(\UseVar{subjectwidth},\UseVar{subjectheight});
249
250 \filldraw (\UseVar{text},\UseVar{openingvpos})rectangle node{\UseDesc{opening}}
251 +(\UseVar{openingwidth},\UseVar{openingheight});
252
253 \filldraw (\UseVar{text},\UseVar{bodyvpos})rectangle node{\UseDesc{body}}
254 +(\UseVar{bodywidth},\UseVar{bodyheight});
255
256 \filldraw (\UseVar{text}+\UseVar{sigindent},\UseVar{sigvpos})rectangle node{\UseDesc{closing}}
257 +(\UseVar{sigwidth},\UseVar{sigheight});
258
259 \filldraw (\UseVar{text}+\UseVar{sigindent}+.1*\UseVar{sigwidth},\UseVar{sigvpos}+\UseVar{sigheight}+\UseVar{sigbeforevskip})rectangle node{\UseDesc{signature}}
260 +(.8*\UseVar{sigwidth},\UseVar{sigheight});
261
262 \filldraw (\UseVar{lochpos},\UseVar{locvpos}) rectangle node{\UseDesc{location}}+(\UseVar{locwidth},\UseVar{locheight});
263
264 \filldraw (\UseVar{firstfoothpos},\UseVar{firstfootvpos}) rectangle node{\UseDesc{firstfoot}} +(\UseVar{firstfootwidth},\UseVar{firstfootheight});
265
266 \draw[thick] (\UseVar{foldmarkhpos},\UseVar{tfoldmarkvpos}) --+(\UseVar{tfoldmarklength},0);
267 \draw[thick] (\UseVar{foldmarkhpos},.5*\UseVar{paperheight}) --+(\UseVar{pfoldmarklength},0);
268 \draw[thick] (\UseVar{foldmarkhpos},\UseVar{bfoldmarkvpos}) --+(\UseVar{bfoldmarklength},0);
269 %%%%%%%%%%%%%%%%%%%%%%%%
270 \draw (\UseVar{text}+\UseVar{sigindent},\UseVar{sigvpos})rectangle +(\UseVar{sigwidth},2*\UseVar{sigheight}+\UseVar{sigbeforevskip});
271
272 \draw (\UseVar{text},\UseVar{titlevpos})rectangle (\UseVar{text}+\UseVar{textwidth},\UseVar{firstfootvpos}-\UseVar{footskip})
273 -- +(.5*\UseVar{firstfootwidth}-.5*\UseVar{textwidth},0);
274 %%%%%%%%%%%%%%%%%%%%%%%%
275
276 \draw[right vmeasure] (\UseVar{foldmarkhpos}+\UseVar{tfoldmarklength},0)--++(0,\UseVar{tfoldmarkvpos})+(0,\UseVar{ticksize})node[anchor=150]{\DescRef{scrlttr2.plength.tfoldmarkvpos}};
277 \draw[right vmeasure] (\UseVar{foldmarkhpos}+\UseVar{bfoldmarklength},0)--++(0,\UseVar{bfoldmarkvpos})+(0,-\UseVar{ticksize})node[anchor=-150]{\DescRef{scrlttr2.plength.bfoldmarkvpos}};
278
279 \draw[top hmeasure] (0,\UseVar{firstheadvpos}) node[right]{\DescRef{scrlttr2.plength.firstheadhpos}} -- +(\UseVar{firstheadhpos},0);
280 \draw[top hmeasure] (\UseVar{firstheadhpos},\UseVar{firstheadvpos})-- node{\DescRef{scrlttr2.plength.firstheadwidth}} +(\UseVar{firstheadwidth},0);
281 \draw[right vmeasure] (\UseVar{paperwidth}-\UseVar{firstheadhpos},0)--node[near end,anchor=base east]{\DescRef{scrlttr2.plength.firstheadvpos}}+(0,\UseVar{firstheadvpos});
282
283 \draw[right vmeasure] (\UseVar{toaddrhpos}+\UseVar{toaddrwidth},0)--+(0,\UseVar{toaddrvpos})node{\DescRef{scrlttr2.plength.toaddrvpos}};
284 \draw[right double vmeasure] (\UseVar{toaddrhpos}+\UseVar{toaddrwidth},\UseVar{toaddrvpos}) -- node[rotate=-90,right]{\DescRef{scrlttr2.plength.backaddrheight}} +(0,\UseVar{backaddrheight});
285 \draw[top hmeasure] (0,\UseVar{toaddrvpos}) node[right]{\DescRef{scrlttr2.plength.toaddrhpos}} --+(\UseVar{toaddrhpos},0);
286 \draw[top hmeasure] (\UseVar{toaddrhpos},\UseVar{toaddrvpos})-- node{\DescRef{scrlttr2.plength.toaddrwidth}} +(\UseVar{toaddrwidth},0);
287 \draw[measure] (\UseVar{toaddrhpos}+\UseVar{toaddrwidth},\UseVar{toaddrvpos}+1.5*\UseVar{backaddrheight})node[right] {\DescRef{scrlttr2.plength.specialmailindent}} --+(-\UseVar{specialmailrightindent},0);
288 \draw[top hmeasure] (\UseVar{toaddrhpos},\UseVar{toaddrvpos}+\UseVar{toaddrheight})-- +(\UseVar{toaddrindent},0) node[right]{\DescRef{scrlttr2.plength.toaddrindent}};
289 \draw[top hmeasure] (\UseVar{toaddrhpos}+\UseVar{toaddrwidth},\UseVar{toaddrvpos}+\UseVar{toaddrheight}) --+ (-\UseVar{toaddrindent},0) node[left]{\DescRef{scrlttr2.plength.toaddrindent}};
290 \draw[left double vmeasure] (\UseVar{toaddrhpos},\UseVar{toaddrvpos})--
291 node{\DescRef{scrlttr2.plength.toaddrheight}}
292 +(0,\UseVar{toaddrheight});
293
294 \draw[right double vmeasure] (\UseVar{lochpos}+\UseVar{locwidth},\UseVar{locvpos})--node{\DescRef{scrlttr2.plength.locheight}}+(0,\UseVar{locheight});
295 \draw[left vmeasure] (\UseVar{lochpos},0)--+(0,\UseVar{locvpos})node{\DescRef{scrlttr2.plength.locvpos}};
296 \draw[top hmeasure] (\UseVar{lochpos}+\UseVar{locwidth},\UseVar{locvpos})-- node{\DescRef{scrlttr2.plength.lochpos}} (\UseVar{paperwidth},\UseVar{locvpos});
297 \draw[top hmeasure] (\UseVar{lochpos},\UseVar{locvpos})-- node{\DescRef{scrlttr2.plength.locwidth}} +(\UseVar{locwidth},0);
298
299 \draw[right vmeasure] (\UseVar{refhpos}+\UseVar{refwidth},0)--+(0,\UseVar{refvpos})node[above=\baselineskip]{\DescRef{scrlttr2.plength.refvpos}};
300 \draw[top hmeasure](0,\UseVar{refvpos})--node{\DescRef{scrlttr2.plength.refhpos}}+(\UseVar{refhpos},0);
301 \draw[top hmeasure](\UseVar{refhpos},\UseVar{refvpos})--node{\DescRef{scrlttr2.plength.refwidth}}+(\UseVar{refwidth},0);
302
303 \draw[right double vmeasure] (\UseVar{refhpos}+\UseVar{refwidth},\UseVar{refvpos}+\UseVar{refheight})--
304 node[rotate=-90,right]{\DescRef{scrlttr2.plength.refaftervskip}}
305 +(0,\UseVar{refaftervskip});
306
307 \draw[right double vmeasure] (\UseVar{text}+\UseVar{openingwidth},\UseVar{titlevpos}+\UseVar{titleheight})--
308 node[rotate=-90,right]{\Length{baselineskip}+\DescRef{scrlttr2.plength.subjectbeforevskip}}
309 (\UseVar{text}+\UseVar{openingwidth},\UseVar{subjectvpos});
310
311 \draw[right double vmeasure] (\UseVar{text}+\UseVar{openingwidth},\UseVar{subjectvpos}+\UseVar{subjectheight})--
312 node[rotate=-90,right]{\DescRef{scrlttr2.plength.subjectaftervskip}}
313 (\UseVar{text}+\UseVar{openingwidth},\UseVar{openingvpos});
314
315 \draw[right double vmeasure] (\UseVar{text}+\UseVar{openingwidth},\UseVar{openingvpos}+\UseVar{openingheight})--
316 node[rotate=-90,right]{\Length{baselineskip}}
317 (\UseVar{text}+\UseVar{openingwidth},\UseVar{bodyvpos});
318
319 \draw[right double vmeasure] (\UseVar{text}+\UseVar{openingwidth},\UseVar{bodyvpos}+\UseVar{bodyheight})--
320 node[rotate=-90,right]{\Length{baselineskip}}
321 (\UseVar{text}+\UseVar{openingwidth},\UseVar{sigvpos});
322
323 \draw[bottom hmeasure](\UseVar{text},\UseVar{firstfootvpos}-\UseVar{footskip})--node{\Length{textwidth}} +(\UseVar{textwidth},0);
324
325 \draw[left double vmeasure] (\UseVar{text}+1.5*\UseVar{sigindent},\UseVar{sigvpos}+\UseVar{sigheight})--node[rotate=-90,right]{\DescRef{scrlttr2.plength.sigbeforevskip}}
326 +(0,\UseVar{sigbeforevskip});
327
328 \draw[left vmeasure] (\UseVar{firstfoothpos},0)--+(0,\UseVar{firstfootvpos})node{\DescRef{scrlttr2.plength.firstfootvpos}};
329 \draw[top hmeasure] (\UseVar{firstfoothpos},\UseVar{firstfootvpos}) -- node{\DescRef{scrlttr2.plength.firstfootwidth}} +(\UseVar{firstfootwidth},0);
330 \draw[bottom hmeasure] (0,\UseVar{firstfootvpos}+\UseVar{firstfootheight}) node[below right]{\DescRef{scrlttr2.plength.firstfoothpos}} -- +(\UseVar{firstfoothpos},0);
331 \draw[right double vmeasure] (\UseVar{firstfoothpos}+\UseVar{firstfootwidth},\UseVar{firstfootvpos}) -- node{$\geq$ \Length{footskip}} +(0,-\UseVar{footskip});
332 \end{tikzpicture}
333
334 \endinput
335
336 %%% Local Variables:
337 %%% mode: latex
338 %%% coding: utf-8
339 %%% End: