forked from adamhaapala/DND-5e-LaTeX-Template
-
Notifications
You must be signed in to change notification settings - Fork 1
/
wl.sty
175 lines (154 loc) · 4.97 KB
/
wl.sty
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
% wl 5e LaTeX Style File
% Created by Evan Bergeron
% Modified by Christopher Liu December 2015
% Modified by Yannic Meyer Feb 2016
\ProvidesPackage{wl}[2017/10/13 v0.6.0 Template for D&D 5e material]
%
% Prerequisite Packages
%
% Set a different geometry with \newgeometry
\usepackage[
bindingoffset=15pt, % .2in
hmargin=50pt, % .7in
top=40pt, % .55in
bottom=50pt, % .7in
footskip=30pt, % makes the footer text line up with the graphic
]{geometry}
\RequirePackage[table]{xcolor}
\RequirePackage{hang}
\RequirePackage{array}
\RequirePackage{tabularx}
\RequirePackage{longtable}
\RequirePackage{tabu}
\RequirePackage{tikz}
\RequirePackage{keycommand}
\RequirePackage[most]{tcolorbox} % used for some boxes
\RequirePackage{enumitem}
\RequirePackage{microtype} % Improve ragged2e hyphenation and overfull boxes
\RequirePackage{ragged2e}
\RequirePackage{xkeyval}
\RequirePackage{xparse}
\RequirePackage{calc}
\RequirePackage{arrayjob}
\RequirePackage{multido}
\RequirePackage{multicol}
\RequirePackage{wrapfig}
\RequirePackage[tableposition=bottom]{caption}
\RequirePackage{fmtcount} %used to format ranks
% \wl@deprecate{<command or environment>}{<version>}[<suggestion>]
\DeclareDocumentCommand{\wl@deprecate}{m m o}{%
\PackageWarning{wl}{#1 is deprecated and will be removed in version #2.\IfNoValueF{#3}{ #3}}
}
%
% Options
%
\newtoggle{bool-bg}
\newtoggle{bool-footer-scroll}
\DeclareOptionX{bg}[full]{%
% This macro call looks complicated, but simply sets up a case environment
% to process choices. Refer to the xkeyval documentation for details.
\XKV@cc*+[\val\index]{#1}{full,none,print}{%
\ifcase\index\relax
% full
\toggletrue{bool-bg}
\toggletrue{bool-footer-scroll}
\or
% none
\togglefalse{bool-bg}
\togglefalse{bool-footer-scroll}
\or
% print
\togglefalse{bool-bg}
\toggletrue{bool-footer-scroll}
\fi
}{%
\PackageWarning{wl}{\val\ is not a valid choice for bg and was ignored}
}
}
% Legacy bg option variants.
\DeclareOptionX{bg-full}{%
\wl@deprecate{bg-full}{0.7}[Use bg=full instead.]
\toggletrue{bool-bg}
\toggletrue{bool-footer-scroll}
}
\DeclareOptionX{bg-none}{%
\wl@deprecate{bg-none}{0.7}[Use bg=none instead.]
\togglefalse{bool-bg}
\togglefalse{bool-footer-scroll}
}
\DeclareOptionX{bg-print}{%
\wl@deprecate{bg-print}{0.7}[Use bg=print instead.]
\togglefalse{bool-bg}
\toggletrue{bool-footer-scroll}
}
\DeclareOptionX{bg-a4}{\wl@deprecate{bg-a4}{0.7}[Remove call to this package option.]}
\DeclareOptionX{bg-letter}{\wl@deprecate{bg-letter}{0.7}[Remove call to this package option.]}
% Toggle justification (official books are flush left).
\newtoggle{justified}
\DeclareOptionX{justified}{\toggletrue{justified}}
% Default Settings
\ExecuteOptionsX{bg=full}
\ProcessOptionsX\relax
% Load other modules of this package
\RequirePackage{lib/wlutils} % \wlutils definition
\RequirePackage{lib/wlcolors} % color definitions
\RequirePackage{lib/wlfonts} % font definitions
\RequirePackage{lib/wlcomment} % \commentbox definition
\RequirePackage{lib/wlheader} % fancy headers and footers
\RequirePackage{lib/wlmonster} % \monsterbox definition
\RequirePackage{lib/wlpaperbox} % \paperbox definition
\RequirePackage{lib/wlquote} % \quotebox definition
\RequirePackage{lib/wlsections} % section styling
\RequirePackage{lib/wlspell} % \spell definition
\RequirePackage{lib/wlpath} % \path definition
\RequirePackage{lib/wlmagicitem} % \magicitem definition
\RequirePackage{lib/wlstrings} % Load document strings
\RequirePackage{lib/wltable} % \wltable definition
\RequirePackage{lib/wldescription}% \wldescription definition
% Set paragraph and line spacing
\linespread{1.1}%
\setlength{\parindent}{1em}
\setlength{\RaggedRightRightskip}{0pt plus 1cm}
\setlength{\RaggedRightParindent}{\parindent}
\hyphenpenalty=1000 % Fewer hyphens
% Set left justification if not justified
%\nottoggle{justified}{\RaggedRight}
%
% Style Parameters
%
% Disable space between paragraphs.
\setlength{\parskip}{0pt}
% Font environment
\newenvironment{lmss}{%
\wl@deprecate{lmss}{0.7}
\fontfamily{lmss}\selectfont
}{}
% Columns setup
\setlength{\columnsep}{25pt} % .35in
% Customize itemize environment.
\setlist{leftmargin=1em}
\setitemize{noitemsep,topsep=0.5ex}
\renewcommand{\labelitemi}{\raisebox{0.25ex}{\tiny{\( \bullet \)}}}
% Fancy wl 5e-style hline
\renewcommand{\hline}{
\noindent
\begin{tikzpicture}[]
\draw [rulered, fill=rulered] (0, 0) --(0,0.1) -- (\textwidth, 0.05);
\end{tikzpicture}
\\
}
% Either hilariously, or infuriatingly, the \ifcommandkey
% implementation is buggy. Here is a re-implementation
% from tex.stackexchange.
\begingroup
\makeatletter
\catcode`\/=8 %
\@firstofone
{
\endgroup
\renewcommand{\ifcommandkey}[1]{%
\csname @\expandafter \expandafter \expandafter
\expandafter \expandafter \expandafter \expandafter
\kcmd@nbk \commandkey {#1}//{first}{second}//oftwo\endcsname
}
}