This repository has been archived by the owner on Mar 9, 2020. It is now read-only.
forked from rpgtex/DND-5e-LaTeX-Template
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdnd.sty
175 lines (152 loc) · 5.26 KB
/
dnd.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
% DND 5e LaTeX Style File
% Created by Evan Bergeron
% Modified by Christopher Liu December 2015
% Modified by Yannic Meyer Feb 2016
\ProvidesPackage{dnd}[2016/03/13]
%
% Prerequisite Packages
%
\RequirePackage{lipsum} % Filler text
\RequirePackage[cm]{fullpage} % Small margins
%\RequirePackage{bookman} % Closest built-in font I could find
%\RequirePackage[T1]{fontenc}
\RequirePackage[table]{xcolor}
\RequirePackage{array}
\RequirePackage{tabularx}
\RequirePackage{tikz}
\RequirePackage{keycommand}
\RequirePackage{fancyhdr} % Adaptation of the footers
\RequirePackage[most]{tcolorbox} % used for some boxes
\RequirePackage{iftex}
% Load other modules of this package
\usepackage{lib/dndmonster}
\usepackage{lib/dndsections}
\usepackage{lib/dndcomment}
\usepackage{lib/dnditemtable}
\usepackage{lib/dndtable}
\usepackage{lib/dndquote}
\usepackage{lib/dndpaperbox}
%
% Options
%
% 'bg-letter-img','bg-letter-print' and 'bg-none' options
\newtoggle{bool-bg-a4}
\newtoggle{bool-bg-print}
\newtoggle{bool-bg-none}
\DeclareOption{bg-none}{\toggletrue{bool-bg-none}}
\DeclareOption{bg-a4}{\toggletrue{bool-bg-a4}}
\DeclareOption{bg-letter}{\togglefalse{bool-bg-a4}}
\DeclareOption{bg-print}{\toggletrue{bool-bg-print}}
\DeclareOption{bg-full}{\togglefalse{bool-bg-print}}
% Default Settings
\ExecuteOptions{bg-letter, bg-full}
\ProcessOptions\relax
\nottoggle{bool-bg-none}{
% Determine background image
\iftoggle{bool-bg-a4}{% % Check if A4 option is selected
\iftoggle{bool-bg-print}{% % Check if print option is selected
\RequirePackage[a4,print]{lib/dndbackgroundimg}
}{%
\RequirePackage[a4,full]{lib/dndbackgroundimg}
}
}{%
\iftoggle{bool-bg-print}{% % Check if print option is selected
\RequirePackage[letter,print]{lib/dndbackgroundimg}
}{%
\RequirePackage[letter,full]{lib/dndbackgroundimg}
}
}
}
%
% Style Parameters
%
% Font environment
%\newenvironment{lmss}{\fontfamily{lmss}\selectfont}{}
\ifPDFTeX
\RequirePackage{bookman}
\RequirePackage[T1]{fontenc}
\newcommand\bookinsanity{\fontfamily{pbk}}
\newcommand\mreaves{\fontfamily{pbk}}
\newcommand\scalysans{\fontfamily{lmss}}
\newcommand\solbera{\fontfamily{pbk}}
\else
\RequirePackage{fontspec}
\newfontfamily\bookinsanity{Bookinsanity}[
Path = font/ ,
Extension = .otf ,
BoldFont = *_Bold ,
ItalicFont = *_Italic ,
BoldItalicFont = *_Bold_Italic
]
%\newfontface\mreaves{Mr_Eaves_Small_Caps.otf}[Path=font/] % This font file can't be used yet
\newcommand\mreaves{\fontfamily{lmr}}
\newfontfamily\scalysans{Scaly_Sans}[
Path = font/ ,
Extension = .otf ,
BoldFont = *_Bold ,
ItalicFont = *_Italic ,
BoldItalicFont = *_Bold_Italic ,
SmallCapsFont = *_Caps ,
BoldFeatures = {SmallCapsFont = *_Caps_Bold} ,
ItalicFeatures = {SmallCapsFont = *_Caps_Italic} ,
BoldItalicFeatures = {SmallCapsFont = *_Caps_Bold_Italic}
]
\newfontface\solbera{Solbera_Imitation.otf}[Path=font/]
\fi
% Columns setup
\setlength{\columnsep}{1cm}
% Define colors, sampled from the books.
\usepackage{color}
\definecolor{bgtan}{HTML}{F7F2E5} % e.g. used for background and quotebox
\definecolor{titlered}{HTML}{58180D} % e.g. used for titles
\definecolor{undergold}{HTML}{C9AD6A} % e.g. used for titlerules
\definecolor{uppergold}{HTML}{B89A67} %e.g. used for pagenumbers and footer
\definecolor{puregold}{HTML}{E69A28} %e.g. used for top line in newer monsterbox
\definecolor{monstertan}{HTML}{FDF1DC} %e.g. used for newer monsterblock
\definecolor{monstertandark}{HTML}{F0DBB5} %e.g. used for older monsterbox
\definecolor{commentgreen}{HTML}{E0E5C1} % e.g. used in table and green commentbox
\definecolor{itemtablepink}{HTML}{E9CDC2} % e.g. used in item tables instead of the green
\definecolor{rulered}{HTML}{9C2B1B} %e.g. used for triangular rule in statsblock
% Setup for custom footer
\pagestyle{fancy}
\footskip = 48pt %push the footer down so it fits with the decal from the bg-img
\fancyhfoffset[LE]{28pt} % push the footer left on even pages so it fits the decal
\fancyhfoffset[RO]{30pt} % push the footer right on odd pages so it fits the decalbg-img
\renewcommand{\headrulewidth}{0.0pt} %no rule for header
\renewcommand{\footrulewidth}{0.0pt} %no rule for footer
\fancyhead{} % clear all header fields
\fancyfoot{} % clear all footer fields
\fancyfoot[LE]{
\textcolor{uppergold}{\thepage}
\hspace*{0.9cm}
\raisebox{12pt}{\textsc{\textcolor{uppergold}{\nouppercase\leftmark}}}
}
\fancyfoot[RO]{
\raisebox{12pt}{\textsc{\textcolor{uppergold}{\nouppercase\leftmark}}}
\hspace*{1cm}
\textcolor{uppergold}{\thepage}
}
\renewcommand{\chaptermark}[1]{\markboth{#1}{}} % Don not write word "chapter"
\fancypagestyle{plain}{}
% Fancy DnD 5e-style hline
\renewcommand{\hline}{
\noindent
\begin{tikzpicture}[]
\draw [rulered, fill=rulered] (0, 0) --(0,0.1) -- (\textwidth, 0.08);
\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
}
}