This repository has been archived by the owner on Jul 30, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
dsa.cls
327 lines (282 loc) · 11.4 KB
/
dsa.cls
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
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
%% dsa.cls
%% Copyright 2014 Felix Krause <[email protected]>
%
% This work may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either version 1.3
% 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.3 or later is part of all distributions of LaTeX
% version 2005/12/01 or later.
%
% This work has the LPPL maintenance status `maintained'.
%
% The Current Maintainer of this work is Felix Krause
%
% This work consists of the dsa.cls, fanpaket-setup.sh and fanpaket-setup.ps1.
% Other accompanying files may have different licenses, see their source code
% for details
\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{dsa}[2016/06/27 v0.2.1]
\usepackage{iftex}
\ifLuaTeX
\RequirePackage{luatex85}
\fi
\newif\if@wallpaper\@wallpapertrue
\DeclareOption{nowallpaper}{
\@wallpaperfalse
}
\DeclareOption*{
\PassOptionsToClass{\CurrentOption}{scrartcl}
}
\ProcessOptions
\LoadClass[a4paper, fontsize=11pt]{scrartcl}
\usepackage[top=1.69cm, bottom=1.5cm, left=2.1cm, right=1.5cm]{geometry}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Package imports
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% language stuff
\usepackage{polyglossia}
\setdefaultlanguage{german}
% font stuff
% Note: If math packages are ever required, fontspec should
% be loaded after them in order to load fonts correctly.
\usepackage{fontspec}
\setlength{\parindent}{0pt}
\setlength{\parskip}{7pt}
% coloring, drawing, picturing
\usepackage[table]{xcolor}
\usepackage{pgf}
\usepackage{wallpaper}
\usepackage{graphicx}
% eforms (optional)
\usepackage[hidelinks, unicode]{hyperref}
\IfFileExists{eforms.sty}{
\usepackage[useui]{eforms}
\everyTextField{\textFont{GaramondNo8}\textSize{12}\W{0}}
\everyComboBox{\textFont{GaramondNo8}\textSize{12}\W{0}}
\newcommand{\dsaTextInput}[3][12]{\textField[\ui{textsize={##1}}]{##2}{##3}{18pt}}
}{}
% font in TOC
\usepackage{tocloft}
\renewcommand{\cfttoctitlefont}{\dsaHeadingFont}
\renewcommand{\cftsecfont}{\dsaHeadingFont}
% misc
\usepackage{environ}
\usepackage{multicol}
% tabulars
\usepackage{makecell}
\usepackage{tabu}
% graphics
\usepackage{tikz}
\usepackage{calc}
\usetikzlibrary{positioning,fit,calc}
% default side images
\newcommand{\dsaSetDefaultPageBorders}{
\ULCornerWallPaper{}{fanpaket/balken-links.png}
\URCornerWallPaper{}{fanpaket/balken-rechts.png}
}
\dsaSetDefaultPageBorders
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% font selection
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newcommand{\dsaSectionStyle}{\Huge\bfseries}
\newcommand{\dsaSubsectionStyle}{\Large\bfseries}
\newcommand{\dsaSetHeadingFont}[1]{
\newfontfamily\dsaHeadingFont{#1}
\setkomafont{section}{\dsaHeadingFont\dsaSectionStyle}
\setkomafont{subsection}{\dsaHeadingFont\dsaSubsectionStyle}
\RedeclareSectionCommand[ beforeskip = 10pt plus 1pt minus 1pt, % allow for 1pt resp. 2pt of ‘glue’ in either direction
afterskip = 18pt plus 2pt minus 2pt ]{section}
\RedeclareSectionCommand[ beforeskip = 14pt plus 1pt minus 1pt,
afterskip = 7pt plus 1pt minus 1pt ]{subsection}
}
\setmainfont{GaramondNo8}
\dsaSetHeadingFont{Manson}
\newfontfamily{\mansontt}{Manson}
\DeclareTextFontCommand{\textmansontt}{\mansontt}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% environments
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newlength\dsaOldParindent
\newenvironment{dsaCharacterSheet}{
\pagebreak
\onecolumn
\dsaHeadingFont\bfseries
\newgeometry{top=1.0cm, bottom=0.5cm, left=1cm, right=1cm}
\setlength{\dsaOldParindent}{\parindent}
\setlength{\parindent}{0pt}
\ClearWallPaper
\if@wallpaper%
\IfFileExists{fanpaket/wallpaper.png}{
% wallpaper image is bigger than actual page
\setlength{\wpXoffset}{-0.3cm}
\setlength{\wpYoffset}{-0.1cm}
\ThisCenterWallPaper{1.0275}{fanpaket/wallpaper.png}
}{}
\fi
\setkomafont{section}{\dsaHeadingFont\dsaSectionStyle\centering}
\setkomafont{subsection}{\dsaHeadingFont\dsaSubsectionStyle\centering}
\RedeclareSectionCommand[ beforeskip = 15pt plus 2pt minus 2pt, % allow for 1pt resp. 2pt of ‘glue’ in either direction
afterskip = 22pt plus 2pt minus 2pt ]{section}
\RedeclareSectionCommand[ beforeskip = 15pt plus 2pt minus 2pt,
afterskip = 8pt plus 1pt minus 1pt ]{subsection}
}{
\newpage
\restoregeometry
\normalfont
\dsaSetDefaultPageBorders
\setlength{\parindent}{\dsaOldParindent}
}
% Set default value for border spacing within character sheet boxes
\setlength{\fboxsep}{3mm}
\newsavebox\blockbox
\NewEnviron{dsaSheetBox}[1][\textwidth]{%
\begin{lrbox}{\blockbox}%
\noindent\hspace{\fboxsep}\begin{minipage}{#1-2\fboxsep}
\vspace{\fboxsep}%
\BODY%
\vspace{.66\fboxsep}%
\end{minipage}%
\end{lrbox}
\noindent
\begin{tikzpicture}
\node[text width=#1,fill=white,fill opacity=0.4,text opacity=1,outer sep=0pt,inner sep=0pt](textwidth){\usebox\blockbox};
% Rahmen oben
\fill[black!60] (textwidth.north west) -- ($(textwidth.north west) + (0.02,-0.02)$) -- ($(textwidth.north east) - (0.02,0.02)$) -- (textwidth.north east) -- cycle;
\fill[black!80] ($(textwidth.north west) + (0.02,-0.02)$) -- ($(textwidth.north west) + (0.08, -0.08)$) -- ($(textwidth.north east) - (0.08, 0.08)$) -- ($(textwidth.north east) - (0.02, 0.02)$) -- cycle;
\fill[black!90] ($(textwidth.north west) + (0.08,-0.08)$) -- ($(textwidth.north west) + (0.1, -0.1)$) -- ($(textwidth.north east) - (0.1, 0.1)$) -- ($(textwidth.north east) - (0.08, 0.08)$) -- cycle;
% Rahmen links
\fill[black!60] (textwidth.north west) -- ($(textwidth.north west) + (0.02,-0.02)$) -- ($(textwidth.south west) + (0.02,0.02)$) -- (textwidth.south west) -- cycle;
\fill[black!80] ($(textwidth.north west) + (0.02,-0.02)$) -- ($(textwidth.north west) + (0.08, -0.08)$) -- ($(textwidth.south west) + (0.08, 0.08)$) -- ($(textwidth.south west) + (0.02, 0.02)$) -- cycle;
\fill[black!90] ($(textwidth.north west) + (0.08,-0.08)$) -- ($(textwidth.north west) + (0.1, -0.1)$) -- ($(textwidth.south west) + (0.1, 0.1)$) -- ($(textwidth.south west) + (0.08, 0.08)$) -- cycle;
% Rahmen rechts
\fill[black!90] (textwidth.south east) -- ($(textwidth.south east) - (0.02,-0.02)$) -- ($(textwidth.north east) - (0.02,0.02)$) -- (textwidth.north east) -- cycle;
\fill[black!80] ($(textwidth.south east) - (0.02,-0.02)$) -- ($(textwidth.south east) - (0.08, -0.08)$) -- ($(textwidth.north east) - (0.08, 0.08)$) -- ($(textwidth.north east) - (0.02, 0.02)$) -- cycle;
\fill[black!60] ($(textwidth.south east) - (0.08,-0.08)$) -- ($(textwidth.south east) - (0.1, -0.1)$) -- ($(textwidth.north east) - (0.1, 0.1)$) -- ($(textwidth.north east) - (0.08, 0.08)$) -- cycle;
% Rahmen unten
\fill[black!90] (textwidth.south east) -- ($(textwidth.south east) - (0.02,-0.02)$) -- ($(textwidth.south west) + (0.02,0.02)$) -- (textwidth.south west) -- cycle;
\fill[black!80] ($(textwidth.south east) - (0.02,-0.02)$) -- ($(textwidth.south east) - (0.08, -0.08)$) -- ($(textwidth.south west) + (0.08, 0.08)$) -- ($(textwidth.south west) + (0.02, 0.02)$) -- cycle;
\fill[black!60] ($(textwidth.south east) - (0.08,-0.08)$) -- ($(textwidth.south east) - (0.1, -0.1)$) -- ($(textwidth.south west) + (0.1, 0.1)$) -- ($(textwidth.south west) + (0.08, 0.08)$) -- cycle;
\end{tikzpicture}
}
\newenvironment{dsaTitlePage}{
\onecolumn
\ClearWallPaper
\ThisULCornerWallPaper{}{fanpaket/balken-symbole-links.png}
\ThisURCornerWallPaper{}{fanpaket/balken-symbole-rechts.png}
\centering
\includegraphics[width=12cm]{fanpaket/logo-fanprodukt.png}
\vfill
\dsaHeadingFont
}{
\vfill
\normalfont{\tiny Dieses Dokument verwendet Grafiken aus dem DSA-Fanpaket der Ulisses Medien \& Spiel Distribution GmbH.}
\newpage
\dsaSetDefaultPageBorders
}
\newlength{\dsaBoxLeftPadding}
\newlength{\dsaBoxRightPadding}
\newlength{\dsaBoxTopPadding}
\newlength{\dsaBoxBottomPadding}
\setlength{\dsaBoxLeftPadding}{12pt}
\setlength{\dsaBoxRightPadding}{14pt}
\setlength{\dsaBoxTopPadding}{7pt}
\setlength{\dsaBoxBottomPadding}{14pt}
\newcommand{\dsaBoxPadding}{\dsaBoxLeftPadding+\dsaBoxRightPadding}
\newsavebox\langscapeSafebox
\newenvironment{dsaBoxLandscape}[1][\linewidth]{%
\vspace{4pt}
\def\imgcmd{%
\includegraphics[
width=\dimexpr\wd\langscapeSafebox+\dsaBoxPadding\relax,
height=\dimexpr\ht\langscapeSafebox+\dp\langscapeSafebox+\dsaBoxTopPadding+\dsaBoxBottomPadding\relax
]{fanpaket/kasten-halbseiter.png}}%
\begin{lrbox}{\langscapeSafebox}%
\begin{minipage}{#1 - \dsaBoxLeftPadding - \dsaBoxRightPadding}
\vspace{4pt}
}{%
\centering%
\end{minipage}
\end{lrbox}%
\noindent
\makebox[0pt][l]{%
\raisebox{\dimexpr-\dp\langscapeSafebox-\dsaBoxBottomPadding}{\imgcmd}%
}%
\hspace{\dsaBoxLeftPadding}
\usebox\langscapeSafebox
}
\newsavebox\langscapeSmallSafebox
\newenvironment{dsaBoxLandscapeSmall}[1][\linewidth]{%
\vspace{4pt}
\def\imgcmd{%
\includegraphics[
width=\dimexpr\wd\langscapeSmallSafebox+\dsaBoxPadding\relax,
height=\dimexpr\ht\langscapeSmallSafebox+\dp\langscapeSmallSafebox+\dsaBoxTopPadding+\dsaBoxBottomPadding\relax
]{fanpaket/kasten-achtelseiter.png}}%
\begin{lrbox}{\langscapeSmallSafebox}%
\begin{minipage}{#1 - \dsaBoxLeftPadding - \dsaBoxRightPadding}
\vspace{4pt}
}{%
\centering%
\end{minipage}
\end{lrbox}%
\noindent
\makebox[0pt][l]{%
\raisebox{\dimexpr-\dp\langscapeSmallSafebox-\dsaBoxBottomPadding}{\imgcmd}%
}%
\hspace{\dsaBoxLeftPadding}
\usebox\langscapeSmallSafebox
}
\newsavebox\portraitSafebox
\newenvironment{dsaBoxPortrait}[1][\linewidth]{%
\vspace{4pt}%
\def\imgcmd{%
\includegraphics[
width=\dimexpr\wd\portraitSafebox+\dsaBoxPadding\relax,
height=\dimexpr\ht\portraitSafebox+\dp\portraitSafebox+\dsaBoxTopPadding+\dsaBoxBottomPadding\relax
]{fanpaket/kasten-viertelseiter.png}}%
\centering%
\begin{lrbox}{\portraitSafebox}%
\begin{minipage}{#1 - \dsaBoxLeftPadding - \dsaBoxRightPadding}
\vspace{4pt}
}{%
\end{minipage}
\end{lrbox}%
\noindent
\makebox[0pt][l]{%
\raisebox{\dimexpr-\dp\portraitSafebox-\dsaBoxBottomPadding}{\imgcmd}%
}%
\hspace{\dsaBoxLeftPadding}
\usebox\portraitSafebox
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Character sheet macros
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Internal - for making tiny rows in tables
\makeatletter
\newsavebox\saved@arstrutbox
\newcommand*{\setarstrut}[1]{%
\noalign{%
\begingroup
\global\setbox\saved@arstrutbox\copy\@arstrutbox
#1%
\global\setbox\@arstrutbox\hbox{%
\vrule \@height\arraystretch\ht\strutbox
\@depth\arraystretch \dp\strutbox
\@width\z@
}%
\endgroup
}%
}
\newcommand*{\restorearstrut}{%
\noalign{%
\global\setbox\@arstrutbox\copy\saved@arstrutbox
}%
}
\makeatother
\newcommand{\dsaRow}[3]{\setarstrut{#1}\rowfont{#2}#3\\ \restorearstrut}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% misc
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newcommand{\dsaBar}[1]{\includegraphics[width=#1, height=0.5em]{images/bar.png}}