Debian Codegraph @

texmf-dist/doc/latex/rpgicons/rpgicons-doc.tex

raw
1 % File: rpgicons-doc.tex
2 % Copyright 2024-2026 Jasper Habicht (mail(at)jasperhabicht.de).
3 %
4 % This work may be distributed and/or modified under the
5 % conditions of the LaTeX Project Public License version 1.3c,
6 % available at http://www.latex-project.org/lppl/.
7 %
8 % This file is part of the `rpgicons' package (The Work in LPPL)
9 % and all files in that bundle must be distributed together.
10 %
11 % This work has the LPPL maintenance status `maintained'.
12 %
13 \documentclass[a4paper]{article}
14 \def\rpgiconsfileversion{2.9.0}
15 \def\rpgiconsfiledate{30 April 2026}
16
17 \usepackage[T1]{fontenc}
18 \usepackage{Alegreya}
19 \usepackage{AlegreyaSans}
20 \usepackage{FiraMono}
21
22 \usepackage{geometry, collcell, longtable, booktabs, tcolorbox, hyperref}
23 \geometry{margin=25mm, left=45mm}
24 \urlstyle{same}
25
26 \usepackage{fancyhdr}
27 \pagestyle{fancy}
28 \fancyhf{}
29 \renewcommand{\headrulewidth}{0pt}
30 \fancyfoot[R]{\thepage}
31
32 \linespread{1.1}\selectfont
33 \addtolength{\skip\footins}{1em plus 5pt}
34 \makeatletter
35 \renewcommand{\@makefntext}[1]{%
36 \noindent\hbox to 0.75em{\normalfont\@thefnmark\hss}~#1%
37 }
38 \makeatother
39
40 \tcbuselibrary{listings}
41 \lstdefinestyle{rpgiconsdocmacro}{
42 basicstyle=\small\ttfamily,
43 literate={<}{{{\color{black!50}\guilsinglleft}}}{1}
44 {>}{{{\color{black!50}\guilsinglright}}}{1}
45 {<<}{{{\bfseries\color{black!50}\guilsinglleft}}}{1}
46 {>>}{{{\bfseries\color{black!50}\guilsinglright}}}{1},
47 keywords={},
48 moredelim=[is][\bfseries]{|}{|},
49 moredelim=[is][\color{black!50}]{!}{!},
50 }
51 \lstdefinestyle{rpgiconsdoccodeexample}{
52 basicstyle=\small\ttfamily,
53 literate={\%}{{{\color{black!50}\%}}}{1},
54 keywords={},
55 }
56
57 \hypersetup{colorlinks}
58
59 \ExplSyntaxOn
60 \int_new:N \l_rpgicons_doc_change_int
61 \NewDocumentCommand{\changes}{ m m m }{
62 \int_incr:N \l_rpgicons_doc_change_int
63 \prop_new:c { l_rpgicons_doc_change_
64 \int_to_roman:n { \l_rpgicons_doc_change_int } _prop }
65 \prop_put:cnn { l_rpgicons_doc_change_
66 \int_to_roman:n { \l_rpgicons_doc_change_int } _prop } { version } {#1}
67 \prop_put:cnn { l_rpgicons_doc_change_
68 \int_to_roman:n { \l_rpgicons_doc_change_int } _prop } { date } {#2}
69 \prop_put:cnn { l_rpgicons_doc_change_
70 \int_to_roman:n { \l_rpgicons_doc_change_int } _prop } { changes } {#3}
71 }
72 \NewDocumentCommand{\printchanges}{ }{
73 \section{Changes}
74 \begin{description}
75 \setlength\itemsep{0pt}
76 \int_step_inline:nn { \l_rpgicons_doc_change_int } {
77 \item[
78 \prop_item:cn {
79 l_rpgicons_doc_change_ \int_to_roman:n { ##1 } _prop
80 } { version } ~
81 \normalfont{ (
82 \prop_item:cn { l_rpgicons_doc_change_
83 \int_to_roman:n { ##1 } _prop } { date }
84 ) }
85 ]
86 \prop_item:cn {
87 l_rpgicons_doc_change_ \int_to_roman:n { ##1 } _prop
88 } { changes }
89 }
90 \end{description}
91 }
92
93 \makeatletter
94 \tl_new:N \l_rpgicons_doc_doctitle_tl
95 \NewExpandableDocumentCommand{\makedoctitle}{ o m o m m o m }{
96 \hypersetup{
97 pdfauthor={#5},
98 pdftitle={\IfValueTF{#1}{#1}{#2}},
99 pdfsubject={\IfValueTF{#3}{#3}{#4}}
100 }
101 \tl_set:Nn \l_rpgicons_doc_doctitle_tl {
102 \group_begin:
103 \renewcommand*{\thefootnote}{\fnsymbol{footnote}}
104 \renewcommand{\@makefnmark}{\normalfont\@thefnmark}
105 \tcbset{
106 title ~ style ~ hook/.style={
107 boxrule=2pt,
108 fontupper=\huge\ttfamily
109 }
110 }
111 \setlength{\parindent}{0pt}\sffamily
112 \Huge{\bfseries #2}\par\bigskip
113 \Large #4\par\bigskip
114 \large #5
115 \IfValueT{#6}{
116 \,\footnote{#6}\par\bigskip
117 }
118 #7\par\bigskip
119 \rule{\textwidth}{.08em}
120 \group_end:
121 \setcounter{footnote}{0}
122 }
123 }
124 \makeatother
125
126 \NewExpandableDocumentCommand{\printdoctitle}{ }{
127 \tl_use:N \l_rpgicons_doc_doctitle_tl
128 }
129 \ExplSyntaxOff
130
131 \tcbset{
132 size=small,
133 arc=2.5pt,
134 outer arc=2.5pt,
135 colframe=black!10,
136 colback=black!10,
137 title style hook/.style={}
138 }
139
140 \NewTCBListing{macrodef}{ }{
141 listing only,
142 listing style={rpgiconsdocmacro},
143 grow to left by=2cm,
144 boxrule=0pt,
145 after={\par\smallskip\noindent}
146 }
147
148 \NewTCBListing{codeexample}{ }{
149 listing only,
150 listing style={rpgiconsdoccodeexample},
151 after={\par\smallskip\noindent}
152 }
153
154 \NewTCBListing{codeexamplecolumns}{ }{
155 text side listing,
156 lefthand width=4.5cm,
157 listing style={rpgiconsdoccodeexample},
158 after={\par\smallskip\noindent}
159 }
160
161 \NewTotalTCBox{\macro}{ O{} v }{
162 verbatim,
163 size=tight,
164 arc=1pt,
165 outer arc=1pt,
166 top=0.5pt,
167 bottom=0.5pt,
168 left=2pt,
169 right=2pt,
170 boxrule=0pt,
171 colframe=black!10,
172 colback=black!10,
173 fontupper=\small\ttfamily,
174 #1
175 }{\vphantom{/g}\lstinline^#2^}
176
177 \NewTotalTCBox{\titlemacro}{ s O{} m }{
178 verbatim,
179 size=tight,
180 arc=1pt,
181 outer arc=1pt,
182 top=0.5pt,
183 bottom=0.5pt,
184 left=2pt,
185 right=2pt,
186 boxrule=0pt,
187 colframe=black!10,
188 colback=black!10,
189 fontupper=\small\ttfamily,
190 title style hook,
191 #2
192 }{\vphantom{/g}\IfBooleanT{#1}{\textbackslash}#3}
193
194 \usepackage{rpgicons-l3}
195 \usepackage[pics]{rpgicons-pgf}
196
197 \ExplSyntaxOn
198 \clist_new:N \l_rpgicons_doc_logo_icons_clist
199 \clist_new:N \l_rpgicons_doc_logo_colors_clist
200 \cs_generate_variant:Nn { \color_set:nnn } { nne }
201
202 \clist_set:Nn \l_rpgicons_doc_logo_colors_clist {
203 264653 , 287271 , 2a9d8f , e9c46a , f4a261 , e76f51
204 }
205 \int_step_inline:nn { \clist_count:N \l_rpgicons_doc_logo_colors_clist } {
206 \color_set:nne { rpgiconslogo \int_to_roman:n {#1} } { HTML } {
207 \clist_item:Nn \l_rpgicons_doc_logo_colors_clist {#1}
208 }
209 }
210 \clist_set:Nn \l_rpgicons_doc_logo_icons_clist {
211 twentyside , charisma , armour , buff , ranged , proficiency
212 }
213
214 \NewDocumentCommand{\rpgiconslogo}{ O{1} }{
215 \draw_begin:
216 \draw_transform_scale:n {#1}
217 \int_step_inline:nn { \clist_count:N \l_rpgicons_doc_logo_icons_clist } {
218 \hcoffin_set:Nn \l_tmpa_coffin {
219 \draw_suspend_begin:
220 \RPGIconsAbility[negative]{
221 \clist_item:Nn \l_rpgicons_doc_logo_icons_clist {##1}
222 }[color=rpgiconslogo \int_to_roman:n {##1} ]
223 \draw_suspend_end:
224 }
225 \draw_scope_begin:
226 \draw_transform_shift:n {
227 % fix bug in older l3draw version
228 \cs_if_exist:NTF \__draw_transform_shift:nnnn {
229 \draw_point_polar:nn { 0.33cm } { 60 * ##1 + 10 }
230 } {
231 \draw_point_transform:n { \draw_point_polar:nn { 0.33cm } { 60 * ##1 + 10 } }
232 }
233 }
234 \draw_coffin_use:Nnn \l_tmpa_coffin { hc } { vc }
235 \draw_scope_end:
236 }
237 \draw_end:
238 }
239 \ExplSyntaxOff
240
241 \ExplSyntaxOn
242 \cs_generate_variant:Nn \property_record:nn { e }
243 \cs_generate_variant:Nn \property_ref:nn { e }
244
245 \int_new:N \g_rpgicons_doc_iconlist_rowc_int
246 \tl_new:N \l_rpgicons_doc_iconlist_this_tl
247 \tl_new:N \g_rpgicons_doc_iconlist_last_tl
248 \NewDocumentCommand { \FirstRowOnly } { O{} m } {
249 \mode_leave_vertical:
250 \int_gincr:N \g_rpgicons_doc_iconlist_rowc_int
251 \tl_analysis_log:N \g_rpgicons_doc_iconlist_last_tl
252 \tl_set:Nn \l_rpgicons_doc_iconlist_this_tl {#2}
253 \tl_if_head_eq_meaning:VNT \l_rpgicons_doc_iconlist_this_tl \relax {
254 \tl_remove_once:Nn \l_rpgicons_doc_iconlist_this_tl { \relax }
255 }
256 \tl_if_head_eq_meaning:VNF \l_rpgicons_doc_iconlist_this_tl \FirstRowOnlySkip {
257 \property_record:en { rpgicons.iconlist.row. \int_use:N \g_rpgicons_doc_iconlist_rowc_int } { page }
258 }
259 \bool_lazy_or:nnTF {
260 \tl_if_blank_p:V \l_rpgicons_doc_iconlist_this_tl
261 } {
262 \tl_if_eq_p:NN \g_rpgicons_doc_iconlist_last_tl \l_rpgicons_doc_iconlist_this_tl
263 } {
264 \int_compare:nNnF {
265 \property_ref:en { rpgicons.iconlist.row. \int_use:N \g_rpgicons_doc_iconlist_rowc_int } { page }
266 } = {
267 \property_ref:en { rpgicons.iconlist.row. \int_eval:n { \g_rpgicons_doc_iconlist_rowc_int - 1 } } { page }
268 } { \tl_use:N \g_rpgicons_doc_iconlist_last_tl #1 }
269 } {
270 #2
271 }
272 \tl_if_blank:VF \l_rpgicons_doc_iconlist_this_tl {
273 \tl_gset:Nn \g_rpgicons_doc_iconlist_last_tl {#2}
274 }
275 }
276 \NewDocumentCommand { \FirstRowOnlySkip } { } { }
277 \ExplSyntaxOff
278
279 \NewDocumentEnvironment{rpgiconsiconlist}{ }{
280 \begin{longtable}{
281 @{}
282 >{\collectcell{\FirstRowOnly[ (cont.)]}} p{20em} <{\endcollectcell}
283 p{2.5em}
284 >{\raggedright\arraybackslash} p{\dimexpr\linewidth-27.5em-6\tabcolsep}
285 p{5em}
286 @{}
287 }
288 \toprule
289 \FirstRowOnlySkip\textbf{Command} & \textbf{Icon} & \textbf{Shape} & \textbf{Variant} \\
290 \midrule\endhead
291 }{
292 \bottomrule
293 \end{longtable}
294 }
295
296 \makedoctitle
297 [The rpgicons package]
298 {The \titlemacro{rpgicons} package}
299 {A set of high-quality icons for use in notes for tabletop role-playing games}
300 {Jasper Habicht}[E-mail: \href{mailto:[email protected]}{[email protected]}. I am grateful to Joseph Wright who fixes bugs at an astonishing speed, to Ulrike Fischer and David Carlisle for their help in adding tagging support to this package, to Max Chernoff for inspiring and guiding me in using Lua and to all other contributors to this package.]
301 {Version \rpgiconsfileversion, released on \rpgiconsfiledate}
302
303 \changes{v1.1.0}{2023/08/15}{First public release.}
304 \changes{v1.1.1}{2023/11/15}{Fudge dice icon added.}
305 \changes{v1.1.2}{2023/11/16}{Bug fixed that caused wrong spacing when using dice icons without quantifier.}
306 \changes{v1.2.0}{2023/11/20}{Corrections in the manual. Icons for six-sided dice with one to nine pips, plus sign and minus sign added.}
307 %\changes{v1.2.1}{2023/11/20}{Documentation of lengths for spacing added.}
308 %\changes{v1.2.2}{2023/11/21}{Corrections in the manual.}
309 \changes{v1.3.0}{2023/11/21}{Option to set background color added. Renamed global option.}
310 \changes{v1.3.1}{2024/02/18}{Correction of initializing code. Correction of default value of after sep. Addition of pics.}
311 %\changes{v1.3.2}{2024/02/19}{Reformatting of the manual.}
312 %\changes{v1.3.4}{2024/02/20}{Minor corrections of some shapes.}
313 \changes{v1.4.0}{2024/02/21}{L3 variant added.}
314 %\changes{v1.4.1}{2024/02/21}{Corrections in L3 variant.}
315 \changes{v1.4.2}{2024/02/21}{Alternative set of commands in L3 variant defined.}
316 %\changes{v1.4.3}{2024/02/22}{Added option to L3 variant to enable upward compatibility.}
317 \changes{v1.4.4}{2024/02/24}{Added styles for every instance of command or shape, implementation of recent changes to \titlemacro{l3draw} code.}
318 \changes{v1.5.0}{2024/02/25}{Alternative set of commands defined, added support of styles in pics.}
319 \changes{v1.5.1}{2024/02/28}{Addition of opacity to L3 variant.}
320 %\changes{v1.5.2}{2024/02/29}{Unification of scaling, minor corrections.}
321 %\changes{v1.5.3}{2024/03/03}{Optimisation of code in L3 variant.}
322 \changes{v1.5.4}{2024/03/06}{Correction of baseline settings in L3 variant, added accessibililty support for L3 variant.}
323 %\changes{v1.5.5}{2024/03/07}{Optimsation of accessibililty support for L3 variant.}
324 \changes{v1.6.0}{2024/03/15}{Four attribute icons added, minor correction of styles.}
325 \changes{v1.6.1}{2024/03/16}{Unified size of negative attribute icon.}
326 \changes{v1.7.0}{2024/03/16}{Macro for easy typesetting using roll dice syntax added in L3 variant, compatibility mode updated.}
327 \changes{v1.8.0}{2024/03/24}{Unified wrapper to load either package variant.}
328 \changes{v1.8.2}{2024/04/28}{Roll dice syntax for PGF variant.}
329 %\changes{v1.8.3}{2024/05/15}{Minor compatibility fix. Example of how to use pics added to documentation.}
330 \changes{v1.8.4}{2024/08/08}{Bug fix in evocation spellschool shape. Unification of frames in PGF and L3 variants.}
331 %\changes{v1.8.6}{2024/11/13}{Fixes in the documentation.}
332 \changes{v1.8.8}{2025/06/15}{Adjustments to support next release of \titlemacro{l3draw} package.}
333 \changes{v1.9.0}{2025/06/30}{Improve check for PDF management, deprecate compatibility mode, improve accessibility support.}
334 \changes{v2.0.0}{2025/09/25}{Change accessibility support to automatic tagging support.}
335 %\changes{v2.0.1}{2025/10/05}{Fixes of bugs related to tagging support in PGF variant, added key to customize replacement text in L3 variant.}
336 %\changes{v2.0.2}{2025/10/10}{Improvements and fixes of PGF shapes.}
337 %\changes{v2.0.3}{2025/10/13}{Fixes of bugs related to tagging support in L3 variant.}
338 \changes{v2.0.4}{2025/10/21}{Added key to append styles for every shape or type.}
339 \changes{v2.1.0}{2025/10/27}{Added alignment and currency shapes.}
340 \changes{v2.2.0}{2025/11/05}{Added shapes for ritual spell, gems and jewellery as well as for classes. Fixes in alignment shapes and in pic definitions.}
341 \changes{v2.2.1}{2025/11/06}{Added alternative shapes for cleric, druid, sorcerer and necrotic. Update of class and alignment frames. Fixes in transformation keys in L3 variant.}
342 \changes{v2.3.0}{2025/11/16}{Added key to define custom keys in L3 variant. Added shape for emanation.}
343 %\changes{v2.3.1}{2025/11/25}{Updated shapes and frame for alignment.}
344 %\changes{v2.3.2}{2025/12/10}{Added explanation about how to combine frames and shapes.}
345 \changes{v2.3.3}{2025/12/15}{Added variant for wisdom shape.}
346 \changes{v2.4.0}{2026/01/15}{Added key to access variants for class shapes.}
347 \changes{v2.4.1}{2026/01/21}{Added variant for psion shape.}
348 \changes{v2.5.0}{2026/01/27}{Added variants for paladin, monk and wizard shapes. Standardization of key names.}
349 \changes{v2.5.1}{2026/02/06}{Added key to generate alias for shapes in L3 variant. Update documentation.}
350 \changes{v2.5.2}{2026/02/15}{Added variant for melee, bard and jewellery shape. Update documentation.}
351 \changes{v2.6.0}{2026/02/25}{Added functionality to precompose icons in L3 variant. Update accessibility support.}
352 \changes{v2.7.0}{2026/03/30}{Added default replacement text provided if tagging is active in PGF variant. Added alias names for dice shapes.}
353 %\changes{v2.7.1}{2026/03/31}{Minor fix.}
354 %\changes{v2.7.2}{2026/04/10}{Bug fix.}
355 \changes{v2.8.0}{2026/04/15}{Added movement shapes.}
356 \changes{v2.9.0}{2026/04/30}{Added line cap and line join options for L3 variant.}
357
358 \begin{document}
359
360 \vspace*{-1cm}
361 \noindent\rpgiconslogo[4]
362
363 \bigskip
364
365 \printdoctitle
366
367 \bigskip
368
369 \section{Introduction}
370
371 The \macro{rpgicons} package provides a set of high-quality icons for use in notes for tabletop role-playing games. The icons are meant to be used in the body text, but they can also be used in other contexts such as graphics or diagrams.
372
373 The package comes in two variants, a L3 variant based on the \macro{l3draw} package which is loaded per default and a PGF variant based on PGF/Ti\emph{k}Z.
374
375 \section{Loading the package}
376
377 To install the package, copy the relevant package files \macro{rpgicons.sty}, \macro{rpgicons-l3.sty} and \macro{rpgicons-pgf.sty} as well as \macro{rpgicons.lua} into the working directory or into the \macro{texmf} directory. You may want to use a TeX package manager for this. After the package has been installed, the \macro{rpgicons} package is loaded by calling \macro{\usepackage{rpgicons}} in the preamble of the document.
378
379 The file \macro{rpgicons.sty} acts as a wrapper that loads either the file \macro{rpgicons-l3.sty} or \macro{rpgicons-pgf.sty} depending on the variant of the package that is used. Therefore, if only one of the variants should be used, technically speaking it is sufficient to only install on of these two files and load the package using \macro{\usepackage{rpgicons-l3}} or \macro{\usepackage{rpgicons-pgf}} respectively. Note, however, that the file \macro{rpgicons.lua} needs to be installed if the L3 variant is used with LuaLaTeX.
380
381 The package can be loaded with one of the following options.
382
383 \begin{macrodef}
384 |l3|
385 \end{macrodef}
386 The L3 variant of the package is loaded by default. To load it explicitly, the package can be loaded using the option \macro{l3}.
387
388 \begin{macrodef}
389 |pgf|
390 \end{macrodef}
391 To load the PGF variant of the package the package needs to be loaded with the option \macro{pgf}.
392
393 \subsection{Dependencies}
394
395 The L3 variant of the package loads the \macro{l3draw} package. When compiled with LuaLaTeX, the file \macro{rpgicons.lua} needs to be installed.
396
397 The PGF variant of the package loads the \macro{tikz} package which in turn loads the \macro{xcolor} package. To make use of specific options these packages provide, you need to load the packages with the relevant options beforehand or explicitly pass the relevant options to the package using a command such as \macro{\PassOptionsToPackage{svgnames}{xcolor}}.
398
399 \subsection{Generating SVG icons}
400
401 To generate an SVG from the LaTeX source, use \macro{\documentclass[dvisvgm]{standalone}} and compile with \macro{latex} and then run \macro{dvisvgm -b papersize} on the compiled DVI file.
402
403 The below code example can be compiled with \macro{latex} and \macro{dvisvgm -b papersize -p 1-} applied to the resulting DVI file to generate one SVG file for each graphic inside the \macro{icon} environment:
404
405 \begin{codeexample}
406 \documentclass[dvisvgm, multi=icon]{standalone}
407 \usepackage{rpgicons}
408
409 \begin{document}
410 \begin{icon}%
411 \ability{charisma}%
412 \end{icon}
413 \begin{icon}%
414 \class{barbarian}%
415 \end{icon}
416 \end{document}
417 \end{codeexample}
418
419 \section{Main user commands}
420
421 Regardless of the variant of the package, a set of user commands is always available. These are described in the following. Depending on the use of the L3 or the PGF variant, certain specific commands or options are available that are explained in the following sections in further detail.
422
423 Because of the way the package defines the icons, each of the user commands below described can actually be used together with every shape. However, the combinations of shapes and commands as described in the following subsections are preferable.
424
425 Note that shape names ending with \macro{alt} have been deprecated. Instead, use the \macro{variant} key to select variants of icon shapes as described below.
426
427 \subsection[Command \textbackslash die]{Command \titlemacro*{die}}
428
429 \begin{macrodef}
430 |\die|[<style>]{<shape>}[<options>]{<integer>}
431 \end{macrodef}
432 The command \macro{\die} typesets an icon to depict a die with a certain number of sides.\footnote{The code for the dice shapes is based on the idea of John Kormylo (see: \url{https://tex.stackexchange.com/a/144474/47927}).} Additionally, icons exist for a two-sided die (which would be equivalent to a coin) and for a hundred-sided die (which typically comes in the shape of a sphere). There is also a special icon for a fudge die.
433
434 For the six-sided die, nine additional shapes exist representing the values one to nine as pips. Also, additional shapes exist representing the plus or minus side of a fudge die.
435
436 The command takes two mandatory arguments, the first of which describes the shape (see the lists below) and the second taking an integer that is placed in front of the shape. For example, \macro{\die{eightside}{2}} results in \die{eightside}{2} (meaning that two eight-sided dice are rolled). If tagging is enabled, the default replacement text of this command is ``2 eightside''.
437
438 The command also takes two optional arguments, the second of which can take additional options to style the icon or to select different variants of the icon shape. The options affect the shape, but not the integer when it is typeset before the icon. The usable options differ depending on the package variant. See the relevant sections below.
439
440 The first optional argument can take the value \macro{normal} or \macro{large}, \macro{normal} being the default value. With \macro{large} given as argument, the icon is drawn larger and the integer is typeset inside the shape. As an example, \macro{\die[large]{eightside}{2}} results in \die[large]{eightside}{2}. Note that the integer will always be placed on top of the shape, even if the shape does not have an open center which is the case with the \macro{fudge} shapes or the shapes featuring pips.
441
442 \begin{rpgiconsiconlist}
443 \titlemacro*{die}
444 & \die{twoside}{} & \macro{twoside} or \newline \macro{d2} \\
445 & \die{fourside}{} & \macro{fourside} or \newline \macro{d4} \\
446 & \die{sixside}{} & \macro{sixside} or \newline \macro{d6} \\
447 & \die{eightside}{} & \macro{eightside} or \newline \macro{d8} \\
448 & \die{tenside}{} & \macro{tenside} or \newline \macro{d10} \\
449 & \die{twelveside}{} & \macro{twelveside} or \newline \macro{d12} \\
450 & \die{twentyside}{} & \macro{twentyside} or \newline \macro{d20} \\
451 & \die{hundredside}{} & \macro{hundredside} or \newline \macro{d100} \\
452 & \die{fudge}{} & \macro{fudge} \\
453 & \die{sixside one}{} & \macro{sixside one} \\
454 & \die{sixside two}{} & \macro{sixside two} \\
455 & \die{sixside three}{} & \macro{sixside three} \\
456 & \die{sixside four}{} & \macro{sixside four} \\
457 & \die{sixside five}{} & \macro{sixside five} \\
458 & \die{sixside six}{} & \macro{sixside six} \\
459 & \die{sixside seven}{} & \macro{sixside seven} \\
460 & \die{sixside eight}{} & \macro{sixside eight} \\
461 & \die{sixside nine}{} & \macro{sixside nine} \\
462 & \die{fudge plus}{} & \macro{fudge plus} \\
463 & \die{fudge minus}{} & \macro{fudge minus} \\
464 \end{rpgiconsiconlist}
465
466 \subsection[Commands \textbackslash ability and \textbackslash saving]{Commands \titlemacro*{ability} and \titlemacro*{saving}}
467
468 \begin{macrodef}
469 |\ability|[<style>]{<shape>}[<options>]
470 \end{macrodef}
471 The command \macro{\ability} typesets an icon depicting an ability of a character. The abilities are represented by animal-like shapes. The relevant shape should be given as mandatory argument to the command. The second optional argument can take additional options to style the icon.
472
473 The first optional argument can take the value \macro{positive} or \macro{negative}, \macro{positive} being the default value. With \macro{negative} given as argument, the icon is drawn negative inside a circle. As an example, \macro{\ability[negative]{charisma}} results in \ability[negative]{charisma}.
474
475 \begin{macrodef}
476 |\saving|[<style>]{<shape>}[<options>]
477 \end{macrodef}
478 The command \macro{\saving} typesets an icon with the relevant \macro{\ability} icon inside a small shield. It can take the same values for the mandatory argument as the \macro{\ability} command. The optional argument can take additional options to style the icon.
479
480 The first optional argument can take the value \macro{normal} or \macro{empty}, \macro{normal} being the default value. With \macro{empty} given as argument, the icon inside the shield is not typeset. In this case, the mandatory argument can be left empty. As an example, \macro{\saving[empty]{}} results in \saving[empty]{}.
481
482 \begin{rpgiconsiconlist}
483 \titlemacro*{ability}
484 & \ability{strength} & \macro{strength} \\
485 & \ability{dexterity} & \macro{dexterity} \\
486 & \ability{dexterity}[variant=1] & \macro{dexterity} & 1 \\
487 & \ability{constitution} & \macro{constitution} \\
488 & \ability{intelligence} & \macro{intelligence} \\
489 & \ability{wisdom} & \macro{wisdom} \\
490 & \ability{wisdom}[variant=1] & \macro{wisdom} & 1 \\
491 & \ability{charisma} & \macro{charisma} \\
492 & \ability{resilience} & \macro{resilience} \\
493 & \ability{sanity} & \macro{sanity} \\
494 & \ability{perception} & \macro{perception} \\
495 & \ability{luck} & \macro{luck} \\
496 & \ability{armour} & \macro{armour} or \newline \macro{armor} \\
497 & \ability{proficiency} & \macro{proficiency} \\
498 \midrule
499 \titlemacro*{saving}
500 & \saving{strength} & \macro{strength} \\
501 & \saving{dexterity} & \macro{dexterity} \\
502 & \saving{dexterity}[variant=1] & \macro{dexterity} & 1 \\
503 & \saving{constitution} & \macro{constitution} \\
504 & \saving{intelligence} & \macro{intelligence} \\
505 & \saving{wisdom} & \macro{wisdom} \\
506 & \saving{wisdom}[variant=1] & \macro{wisdom} & 1 \\
507 & \saving{charisma} & \macro{charisma} \\
508 & \saving{resilience} & \macro{resilience} \\
509 & \saving{sanity} & \macro{sanity} \\
510 & \saving{perception} & \macro{perception} \\
511 & \saving{luck} & \macro{luck} \\
512 & \saving{armour} & \macro{armour} or \newline \macro{armor} \\
513 & \saving{proficiency} & \macro{proficiency} \\
514 \end{rpgiconsiconlist}
515
516 \subsection[Command \textbackslash spell]{Command \titlemacro*{spell}}
517
518 \begin{macrodef}
519 |\spell|{<shape>}[<options>]
520 \end{macrodef}
521 The command \macro{\spell} typesets an icon depicting the effect of a spell or how it is to be effected. The optional argument can take additional options to style the icon.
522
523 \begin{rpgiconsiconlist}
524 \titlemacro*{spell}
525 & \spell{linear} & \macro{linear} \\
526 & \spell{conic} & \macro{conic} \\
527 & \spell{quadratic} & \macro{quadratic} \\
528 & \spell{cubic} & \macro{cubic} \\
529 & \spell{spheric} & \macro{spheric} \\
530 & \spell{cylindric} & \macro{cylindric} \\
531 & \spell{emanation} & \macro{emanation} \\
532 & \spell{verbal} & \macro{verbal} \\
533 & \spell{somatic} & \macro{somatic} \\
534 & \spell{material} & \macro{material} \\
535 & \spell{ritual} & \macro{ritual} \\
536 & \spell{focus} & \macro{focus} \\
537 \end{rpgiconsiconlist}
538
539 \subsection[Command \textbackslash spellschool]{Command \titlemacro*{spellschool}}
540
541 \begin{macrodef}
542 |\spellschool|[<style>]{<shape>}[<options>]
543 \end{macrodef}
544 The command \macro{\spellschool} typesets an icon that represents the school a spell belongs to. The second optional argument can take additional options to style the icon.
545
546 The first optional argument can take the value \macro{negative} or \macro{positive}, \macro{negative} being the default value. Per default the icon is drawn in white inside a filled escutcheon. With \macro{positive} given as argument, the icon as well as the escutcheon are drawn in the currently selected color. As an example, \macro{\spellschool[positive]{evocation}} results in \spellschool[positive]{evocation}.
547
548 \begin{rpgiconsiconlist}
549 \titlemacro*{spellschool}
550 & \spellschool{abjuration} & \macro{abjuration} \\
551 & \spellschool{conjuration} & \macro{conjuration} \\
552 & \spellschool{divination} & \macro{divination} \\
553 & \spellschool{enchantment} & \macro{enchantment} \\
554 & \spellschool{evocation} & \macro{evocation} \\
555 & \spellschool{illusion} & \macro{illusion} \\
556 & \spellschool{necromancy} & \macro{necromancy} \\
557 & \spellschool{transmutation} & \macro{transmutation} \\
558 \end{rpgiconsiconlist}
559
560 \subsection[Commands \textbackslash damage, \textbackslash attack and \textbackslash condition]{Commands \titlemacro*{damage}, \titlemacro*{attack} and \titlemacro*{condition}}
561
562 \begin{macrodef}
563 |\damage|{<shape>}[<options>]
564 \end{macrodef}
565 The command \macro{\damage} typesets an icon depicting the damage of an attack. The icon is printed inside a circle. The optional argument can take additional options to style the icon.
566
567 \begin{macrodef}
568 |\attack|{<shape>}[<options>]
569 \end{macrodef}
570 The command \macro{\attack} typesets an icon depicting the kind of an attack. The optional argument can take additional options to style the icon.
571
572 \begin{macrodef}
573 |\condition|{<shape>}[<options>]
574 \end{macrodef}
575 The command \macro{\condition} typesets an icon depicting a condition of a character. The optional argument can take additional options to style the icon.
576
577 \begin{rpgiconsiconlist}
578 \titlemacro*{damage}
579 & \damage{acid} & \macro{acid} \\
580 & \damage{bludgeoning} & \macro{bludgeoning} \\
581 & \damage{cold} & \macro{cold} \\
582 & \damage{fire} & \macro{fire} \\
583 & \damage{force} & \macro{force} \\
584 & \damage{lightning} & \macro{lightning} \\
585 & \damage{necrotic} & \macro{necrotic} \\
586 & \damage{necrotic}[variant=1] & \macro{necrotic} & 1 \\
587 & \damage{piercing} & \macro{piercing} \\
588 & \damage{poison} & \macro{poison} \\
589 & \damage{psychic} & \macro{psychic} \\
590 & \damage{radiant} & \macro{radiant} \\
591 & \damage{slashing} & \macro{slashing} \\
592 & \damage{thunder} & \macro{thunder} \\
593 & \damage{healing} & \macro{healing} \\
594 \midrule
595 \titlemacro*{attack}
596 & \attack{melee} & \macro{melee} \\
597 & \attack{melee}[variant=1] & \macro{melee} & 1 \\
598 & \attack{ranged} & \macro{ranged} \\
599 & \attack{magic} & \macro{magic} \\
600 & \attack{singlehanded} & \macro{singlehanded} \\
601 & \attack{doublehanded} & \macro{doublehanded} \\
602 \midrule
603 \titlemacro*{condition}
604 & \condition{buff} & \macro{buff} \\
605 & \condition{blinded} & \macro{blinded} \\
606 & \condition{charmed} & \macro{charmed} \\
607 & \condition{deafened} & \macro{deafened} \\
608 & \condition{exhausted} & \macro{exhausted} \\
609 & \condition{frightened} & \macro{frightened} \\
610 & \condition{grappled} & \macro{grappled} \\
611 & \condition{incapacitated} & \macro{incapacitated} \\
612 & \condition{invisible} & \macro{invisible} \\
613 & \condition{paralyzed} & \macro{paralyzed} \\
614 & \condition{petrified} & \macro{petrified} \\
615 & \condition{poisoned} & \macro{poisoned} \\
616 & \condition{prone} & \macro{prone} \\
617 & \condition{restrained} & \macro{restrained} \\
618 & \condition{restrained}[variant=1] & \macro{restrained} & 1 \\
619 & \condition{stunned} & \macro{stunned} \\
620 & \condition{unconscious} & \macro{unconscious} \\
621 & \condition{hearing} & \macro{hearing} \\
622 & \condition{seeing} & \macro{seeing} \\
623 \end{rpgiconsiconlist}
624
625 \subsection[Commands \textbackslash class and \textbackslash alignment]{Commands \titlemacro*{class} and \titlemacro*{alignment}}
626
627 \begin{macrodef}
628 |\class|[<style>]{<shape>}[<options>]
629 \end{macrodef}
630 The command \macro{\class} typesets an icon depicting a class of a character. The optional argument of the command can take additional options to style the icon.
631
632 The first optional argument can take the value \macro{negative} or \macro{positive}, \macro{positive} being the default value. With \macro{positive} given as argument, the icon is drawn in white inside a filled frame. As an example, \macro{\class[negative]{barbarian}} results in \class[negative]{barbarian}.
633
634 \begin{macrodef}
635 |\alignment|[<style>]{<shape>}[<options>]
636 \end{macrodef}
637 The command \macro{\alignment} typesets an icon depicting an alignment of a character. The optional argument of the command can take additional options to style the icon.
638
639 The first optional argument can take the value \macro{negative} or \macro{positive}, \macro{positive} being the default value. With \macro{positive} given as argument, the icon is drawn in white inside a filled frame. As an example, \macro{\alignment[negative]{lawful good}} results in \alignment[negative]{lawful good}.
640
641 \begin{rpgiconsiconlist}
642 \titlemacro*{class}
643 & \class{artificer} & \macro{artificer} \\
644 & \class{artificer}[variant=1] & \macro{artificer} & 1 \\
645 & \class{barbarian} & \macro{barbarian} \\
646 & \class{bard} & \macro{bard} \\
647 & \class{bard}[variant=1] & \macro{bard} & 1 \\
648 & \class{cleric} & \macro{cleric} \\
649 & \class{cleric}[variant=1] & \macro{cleric} & 1\\
650 & \class{cleric}[variant=2] & \macro{cleric} & 2 \\
651 & \class{druid} & \macro{druid} \\
652 & \class{druid}[variant=1] & \macro{druid} & 1 \\
653 & \class{druid}[variant=2] & \macro{druid} & 2 \\
654 & \class{fighter} & \macro{fighter} \\
655 & \class{gunslinger} & \macro{gunslinger} \\
656 & \class{monk} & \macro{monk} \\
657 & \class{monk}[variant=1] & \macro{monk} & 1 \\
658 & \class{paladin} & \macro{paladin} \\
659 & \class{paladin}[variant=1] & \macro{paladin} & 1 \\
660 & \class{psion} & \macro{psion} \\
661 & \class{psion}[variant=1] & \macro{psion} & 1 \\
662 & \class{ranger} & \macro{ranger} \\
663 & \class{ranger}[variant=1] & \macro{ranger} & 1 \\
664 & \class{rogue} & \macro{rogue} \\
665 & \class{rogue}[variant=1] & \macro{rogue} & 1 \\
666 & \class{sorcerer} & \macro{sorcerer} \\
667 & \class{sorcerer}[variant=1] & \macro{sorcerer} & 1 \\
668 & \class{warlock} & \macro{warlock} \\
669 & \class{wizard} & \macro{wizard} \\
670 & \class{wizard}[variant=1] & \macro{wizard} & 1 \\
671 \midrule
672 \titlemacro*{alignment}
673 & \alignment{lawful good} & \macro{lawful good} \\
674 & \alignment{neutral good} & \macro{neutral good} \\
675 & \alignment{chaotic good} & \macro{chaotic good} \\
676 & \alignment{lawful neutral} & \macro{lawful neutral} \\
677 & \alignment{true neutral} & \macro{true neutral} \\
678 & \alignment{chaotic neutral} & \macro{chaotic neutral} \\
679 & \alignment{lawful evil} & \macro{lawful evil} \\
680 & \alignment{neutral evil} & \macro{neutral evil} \\
681 & \alignment{chaotic evil} & \macro{chaotic evil} \\
682 \end{rpgiconsiconlist}
683
684 \subsection[Command \textbackslash currency]{Command \titlemacro*{currency}}
685
686 \begin{macrodef}
687 |\currency|{<shape>}[<options>]{<integer>}
688 \end{macrodef}
689 The command \macro{\currency} typesets an icon depicting a value of a coin. The optional argument can take additional options to style the icon.
690
691 The command provides a second mandatory argument that accepts an integer that is placed in front of the shape. For example, \macro{\currency{gold}{7}} results in \currency{gold}{7}. If tagging is enabled, the default replacement text of this command is ``7 gold''.
692
693 \begin{rpgiconsiconlist}
694 \titlemacro*{currency}
695 & \currency{copper}{} & \macro{copper} \\
696 & \currency{silver}{} & \macro{silver} \\
697 & \currency{gold}{} & \macro{gold} \\
698 & \currency{electrum}{} & \macro{electrum} \\
699 & \currency{platinum}{} & \macro{platinum} \\
700 & \currency{gem}{} & \macro{gem} \\
701 & \currency{jewellery}{} & \macro{jewellery} or \newline \macro{jewelry} \\
702 & \currency{jewellery}[variant=1]{} & \macro{jewellery} or \newline \macro{jewelry} & 1 \\
703 \end{rpgiconsiconlist}
704
705 \subsection[Command \textbackslash movement]{Command \titlemacro*{movement}}
706
707 \begin{macrodef}
708 |\movement|[<style>]{<shape>}[<options>]{<integer>}
709 \end{macrodef}
710 The command \macro{\movement} typesets an icon depicting a direction of movement.
711
712 The command takes two mandatory arguments, the first of which describes the shape (see the lists below) and the second taking an integer that is placed in front of the shape. For example, \macro{\movement{forward}{5}} results in \movement{forward}{5}. If tagging is enabled, the default replacement text of this command is ``5 forward''.
713
714 The command also takes two optional arguments, the second of which can take additional options to style the icon or to select different variants of the icon shape. The options affect the shape, but not the integer when it is typeset before the icon. The usable options differ depending on the package variant. See the relevant sections below.
715
716 The first optional argument can take the value \macro{normal} or \macro{large}, \macro{normal} being the default value. With \macro{large} given as argument, the icon is drawn larger and the integer is typeset inside the shape. As an example, \macro{\movement[large]{forward}{5}} results in \movement[large]{forward}{5}.
717
718 \begin{rpgiconsiconlist}
719 \titlemacro*{movement}
720 & \movement{upward}{} & \macro{upward} \\
721 & \movement{downward}{} & \macro{downward} \\
722 & \movement{leftward}{} & \macro{leftward} \\
723 & \movement{rightward}{} & \macro{rightward} \\
724 & \movement{forward}{} & \macro{forward} \\
725 & \movement{backward}{} & \macro{backward} \\
726 \end{rpgiconsiconlist}
727
728 % l3 variant
729
730 \section{Specifics of the L3 package variant}
731
732 The L3 variant of the package which uses the \macro{l3draw} package is loaded by default or explicitly by either calling \macro{\usepackage[l3]{rpgicons}} or \macro{\usepackage{rpgicons-l3}} in the preamble of the document after having installed the files \macro{rpgicons.sty} and \macro{rpgicons-l3.sty}. The \macro{l3draw} package is an experimental package that provides only basic drawing functionality. The L3 variant thus only supports a certain set of options for styling the icons.
733
734 The L3 variant of the package does not load the \macro{xcolor} package but makes use of the \macro{l3color} module which uses a similar syntax like the \macro{xcolor} package. Color definitions made using the \macro{l3color} module are not directly usable via commands provided by the \macro{xcolor} package. Therefore, setting a color using the \macro{\color} macro provided by the \macro{xcolor} package won't affect the color of the icons.
735
736 It is possible, however, to call \macro{\DocumentMetadata{}} before \macro{\documentclass} and then use \macro{\definecolor} provided by the \macro{xcolor} package to define a color which can then be used by the L3 variant of the package.
737
738 Transparency requires the management of certain PDF settings. Therefore, it is necessary to call \macro{\DocumentMetadata{}} before \macro{\documentclass} when using the L3 variant of the package.
739
740 It is also possible to call \macro{\RequirePackage{pdfmanagement}} before \macro{\documentclass} instead of \macro{\DocumentMetadata{}} to enable the above described color and transparency management.
741
742 \subsection{Icon commands}
743
744 \begin{macrodef}
745 |variant|
746 |variant|={<integer>}
747 \end{macrodef}
748 The main user commands (as well as the underlying commands on which these commands are based as described below) accept as option the key \macro{variant} which accepts an integer as value to select variants for the relevant shape. See the icon lists above for the respective variants. For example, the command \macro{\ability{dexterity}[variant=1]} results in \ability{dexterity}[variant=1].
749
750 Setting the key \macro{variant} without value is equivalent to setting its value to \macro{1}. Selecting a non-existent variant selects the default shape.
751
752 With the following setting, all occurrences of the \macro{necrotic} shape are set to the relevant variant.
753
754 \begin{codeexample}
755 \rpgiconsset{
756 every necrotic={
757 variant=1
758 }
759 }
760 \end{codeexample}
761
762 \begin{macrodef}
763 |\RPGIconsUseIcon|[<options>][<integer>]{<shape>}
764 |\RPGIconsUseIcon*|[<options>][<integer>]{<shape>}
765 \end{macrodef}
766 \macro{\RPGIconsUseIcon} is the primary command to typeset icons using the L3 variant of the package. The commands \macro{\die}, \macro{\ability}, \macro{\saving}, \macro{\spell}, \macro{\spellschool}, \macro{\damage}, \macro{\attack}, \macro{\condition}, \macro{\class}, \macro{\alignment}, \macro{\currency} and \macro{\direction} are based on this command. This command allows to combine all shapes with all frames and with either a positive or a negative color scheme.
767
768 For example, \macro{\RPGIconsUseIcon[scale=.675, stroke=blue][2]{tenside}} is equivalent to and thus results in the same output as \macro{\die[large]{tenside}[stroke=blue]{2}} and \macro{\RPGIconsUseIcon*[frame=ability, scale=.333, fill=red]{charisma}} results in the same output as \macro{\ability[negative]{charisma}[fill=red]}. On the other hand, it is also possible to create icons that can't be typeset using the above standard commands, such as \macro{\RPGIconsUseIcon*[frame=saving, scale=.333, fill=blue]{barbarian}} which will result in \RPGIconsUseIcon*[frame=saving, scale=.333, fill=blue]{barbarian}.
769
770 The \macro{\RPGIconsUseIcon} command has a starred version and two optional arguments as well as one mandatory argument. The mandatory argument holds the shape of the icon. The second optional argument can be used to add an integer (or any text) that is placed on top of the icon, for example when used with shapes for dice.
771
772 The starred version of the command is used to fill a frame with color instead of drawing its outline. Frames can be put around the shape via the relevant \macro{frame} option.
773
774 The \macro{\RPGIconsUseIcon} command supports PDF tagging. If tagging is activated by using \macro{\DocumentMetadata{tagging=on}}, a replacement text is automatically added to the relevant icon which can be copied to the clipboard and can be read by screen readers. Note that tagging support depends on the used PDF reader.
775
776 \begin{macrodef}
777 |\RPGIconsDie|[<style>]{<shape>}[<options>]{<integer>}
778 |\RPGIconsAbility|[<style>]{<shape>}[<options>]
779 |\RPGIconsSaving|[<style>]{<shape>}[<options>]
780 |\RPGIconsSpell|{<shape>}[<options>]
781 |\RPGIconsSpellschool|[<style>]{<shape>}[<options>]
782 |\RPGIconsDamage|{<shape>}[<options>]
783 |\RPGIconsAttack|{<shape>}[<options>]
784 |\RPGIconsCondition|{<shape>}[<options>]
785 |\RPGIconsClass|[<style>]{<shape>}[<options>]
786 |\RPGIconsAlignment|[<style>]{<shape>}[<options>]
787 |\RPGIconsCurrency|{<shape>}[<options>]{<integer>}
788 |\RPGIconsDirection|{<shape>}[<options>]{<integer>}
789 \end{macrodef}
790 This set of commands are the basic commands defined by the L3 variant of the package on which the commands \macro{\die}, \macro{\ability}, \macro{\saving}, \macro{\spell}, \macro{\spellschool}, \macro{\damage}, \macro{\attack}, \macro{\condition}, \macro{\class}, \macro{\alignment}, \macro{\currency} as well as \macro{\direction} are based. This set of commands can be used in cases where another package defines one of these user commands. These user commands are exact copies of this set of commands.
791
792 \subsection{Icon options}
793
794 The \macro{\RPGIconsUseIcon} command and the commands \macro{\die}, \macro{\ability}, \macro{\saving}, \macro{\spell}, \macro{\spellschool}, \macro{\damage}, \macro{\attack}, \macro{\condition}, \macro{\class}, \macro{\alignment}, \macro{\currency} as well as \macro{\direction} can be used with certain options that each consist of a key-value pair and can be combined. These options should be used directly without wrapping them inside the \macro{style} option, when used with the \macro{\RPGIconsUseIcon} command or the other commands based on this command.
795
796 For example, \macro{\die{eightside}[color=blue, line width=0.8pt]{2}} would result in \die{eightside}[color=blue, line width=0.8pt]{2}.
797
798 \begin{macrodef}
799 |frame|={<string>}
800 \end{macrodef}
801 With the \macro{frame} option, one of six different frames can be selected that are drawn around the shape of the icon. The values \macro{ability} and \macro{damage} draw a circle around the shape. The value \macro{saving} draws a rounded shield and the value \macro{spellschool} draws an angular shield around the shape. The value \macro{class} dtaws a square and the value \macro{alignment} a hexagon around the shape. The commands \macro{\ability}, \macro{\saving}, \macro{\spellschool}, \macro{\damage}, \macro{\class} and \macro{\alignment} make use of the relevant frame. Because the regular commands already implicitly select the relevant frame (or no frame), using the \macro{frame} option is only recommended together with the \macro{\RPGIconsUseIcon} command.
802
803 For example, \macro{\RPGIconsUseIcon[frame=class, scale=0.333]{charisma}} would result in \RPGIconsUseIcon[frame=class, scale=0.333]{charisma}.
804
805 \begin{macrodef}
806 |color|={<color>}
807 |stroke|={<color>}
808 |fill|={<color>}
809 |text|={<color>}
810 |background|={<color>}
811 \end{macrodef}
812 \begin{macrodef}
813 |opacity|={<float>}
814 |stroke opacity|={<float>}
815 |fill opacity|={<float>}
816 |text opacity|={<float>}
817 |background opacity|={<float>}
818 \end{macrodef}
819 The \macro{color} option sets the color of strokes, fills and text in general while the \macro{stroke} option, the \macro{fill} option and the \macro{text} option set the color only for strokes, fills or text respectively.
820
821 Similarly, the \macro{opacity} macro sets the opacity generally, while the options \macro{stroke opacity}, \macro{fill opacity} and \macro{text opacity} allow for setting the opacity of strokes, fill and text separately.
822
823 Some icons can be used with a negative color scheme where the icon is drawn negatively inside a filled shape. Per default, the icons are drawn in white in such cases, but it might be desirable that the icons are in the same color as the background. To this end, the \macro{background} option sets the color of the shape when it is printed over a filled frame which can be achieved by setting the \macro{negative} option for the \macro{\ability}, \macro{\spellschool}, \macro{\class} or the \macro{\alignment} command or using the starred version of the \macro{\RPGIconsUseIcon} command.
824
825 \begin{codeexamplecolumns}
826 \colorbox{blue!50}{%
827 \ability[negative]{charisma}
828 [scale=2]%
829 }
830
831 \colorbox{blue!50}{%
832 \ability[negative]{charisma}
833 [scale=2, background=blue!50]%
834 }
835 \end{codeexamplecolumns}
836
837 \begin{macrodef}
838 |line width|={<dimension>}
839 |line cap|={<string>}
840 |line join|={<string>}
841 |miter limit|={<float>}
842 \end{macrodef}
843 The option \macro{line width} sets the line width for strokes. The default line width is the default line width of Ti\emph{k}Z or the \macro{l3draw} package respectively which in both cases is 0.4\,pt.
844
845 The option \macro{line cap} takes as value one of \macro{butt}, \macro{rectangle} or \macro{round} and sets the style of stroke terminals to butt caps, rectangle caps (projecting square caps) or round caps respectively. Per default, round caps are set.
846
847 The option \macro{line join} takes as value one of \macro{bevel}, \macro{miter} or \macro{round} and sets the style of stroke joins to bevel joins, miter joins or round joins respectively. Per default, round line joins are set.
848
849 The option \macro{miter limit} takes as value floating point number and sets the miter factor of lines joined as a miter. The default factor is 10.
850
851 \begin{macrodef}
852 |scale|={<float>}
853 |scale inner|={<float>}
854 |rotate|={<float>}
855 \end{macrodef}
856 Using the \macro{scale} and \macro{rotate} options, the shape can be scaled and rotated (in degrees).
857
858 The \macro{scale inner} option can be used to change the scaling of the icon placed inside a frame when using the \macro{\ability}, \macro{\saving}, \macro{\spellschool}, \macro{\damage}, \macro{\class} and \macro{\alignment} macros. The default value is 0.675.
859
860 \begin{codeexamplecolumns}
861 \damage{petrified}
862 [scale=2]
863
864 \damage{petrified}
865 [scale=2, scale inner=0.5]
866 \end{codeexamplecolumns}
867
868 Note that the keys related to transformation, that is \macro{scale}, \macro{scale inner} and \macro{rotate}, add to the current value and do not replace it. For example, \macro{scale=0.5, scale=0.5} results in a scale factor of 0.25 and \macro{rotate=10, rotate=10} results in a rotation of 20~degrees.
869
870 \begin{macrodef}
871 |every die|={<options>}
872 |every ability|={<options>}
873 |every saving|={<options>}
874 |every spell|={<options>}
875 |every spellschool|={<options>}
876 |every damage|={<options>}
877 |every attack|={<options>}
878 |every condition|={<options>}
879 |every class|={<options>}
880 |every alignment|={<options>}
881 |every currency|={<options>}
882 |every direction|={<options>}
883 |every <<shape>>|={<options>}
884 \end{macrodef}
885 Styles following the pattern \macro{every} followed by a space and the name of the command or the shape can be used to apply styles to every instance of this command or shape.
886
887 For example, \macro{\rpgiconsset{every die={color={red}}}} can be used to draw in red all icons created using the \macro{\die} command.
888
889 Calling \macro{\rpgiconsset{every charisma={color={red}}}} will draw every instance of the \macro{charisma} shape in red.
890
891 \begin{macrodef}
892 |every die add|={<options>}
893 |every ability add|={<options>}
894 |every saving add|={<options>}
895 |every spell add|={<options>}
896 |every spellschool add|={<options>}
897 |every damage add|={<options>}
898 |every attack add|={<options>}
899 |every condition add|={<options>}
900 |every class add|={<options>}
901 |every alignment add|={<options>}
902 |every currency add|={<options>}
903 |every direction add|={<options>}
904 |every <<shape>> add|={<options>}
905 \end{macrodef}
906 Styles following the pattern \macro{every} followed by a space and the name of the command or the shape followed by another space and \macro{add} work in the same way as the styles described above, but instead of overwriting existing styles, they append the relevant styles.
907
908 \subsection{Setting options globally}
909
910 \begin{macrodef}
911 |\rpgiconsset|
912 \end{macrodef}
913 Apart from setting the options to the commands directly, it is also possible to set them globally using the \macro{\rpgiconsset} command. Globally set options are overridden by options that are set directly.
914
915 \begin{codeexamplecolumns}
916 \rpgiconsset{
917 color=blue
918 }
919
920 \ability{charisma}
921 \ability{charisma}[color=red]
922 \ability{charisma}
923 \end{codeexamplecolumns}
924
925 \begin{macrodef}
926 |style set|={<options>}
927 |style add|={<options>}
928 \end{macrodef}
929 To simplify styling, custom keys can be defined via the keys \macro{style set} and \macro{style add}. Both keys accept as value a key-value list consisting of one or multiple custom keys whose relevant value consists of another key-value list describing the relevant style. It is possible to use \macro{#1} as placeholder for one argument. It is also possible to reference to an already define custom key in the definition of another custom key.
930
931 The key \macro{style set} defines custom keys and sets their values. The key \macro{style add} appends the relevant key-value list to the existing custom key as defined by \macro{style set}. Note that it is not checked whether a custom key already exists and its definition will be overwritten without a warning.
932
933 \begin{codeexamplecolumns}
934 \rpgiconsset{
935 style set={
936 foo={rotate=45, fill=blue},
937 bar={foo, fill=red, scale=#1}
938 }
939 }
940
941 \ability[negative]{charisma}[foo]
942 \class[negative]{warlock}[bar=2]
943 \end{codeexamplecolumns}
944
945 Note that the key \macro{style appemd} has been deprecated and the key \macro{style add} should be used instead.
946
947 \begin{macrodef}
948 |alias|={<string>}{<string>}
949 \end{macrodef}
950 The key \macro{alias} accepts exactly two (braced) arguments that represent names of shapes. A shape with the name given in the first argument is created as an exact copy of the shape with the name given in the second argument. If a shape with the name given in the first argument already exists, it will become a copy of the other shape without warning.
951
952 \begin{macrodef}
953 |before sep|={<dimension>}
954 |after sep|={<dimension>}
955 |baseline|={<dimension>}
956 \end{macrodef}
957 The spacing before and after the icons can be set using the options \macro{before sep} and \macro{after sep}. The option \macro{baseline} can be used to adjust the baseline of the icons. These options can also be applied to the icon commands directly. The default value of \macro{before sep} and \macro{after sep} is 0.05\,em. The default value of \macro{baseline} is \textminus 3.5\,pt.
958
959 \begin{codeexamplecolumns}
960 Roll\die{eightside}{}a die!
961
962 \rpgiconsset{
963 before sep={1cm}
964 }
965 Roll\die{eightside}{}a die!
966 \end{codeexamplecolumns}
967
968 \begin{macrodef}
969 |actualtext|={<string>}
970 \end{macrodef}
971 The option \macro{actualtext} can be used to change the default replacement text that is used for example by screen readers in a tagged PDF. It expects as string that represents the relevant replacement text.
972
973 It is possible to change the replacement texts for specific icon types. For example, by setting \macro{every saving={every charisma={actualtext={charisma saving}}}}, the replacement text for every instance of \macro{\saving{charisma}} will be set to \macro{charisma saving}.
974
975 Note that the possibility to provide a key-value list to \macro{actualtext} taking shape names as keys and the relevant replacement texts as values has been removed. Instead, use the keys to set the style for all macros or shapes as shown in the previous paragraph.
976
977 \subsection{Precompose icons}
978
979 A lot of icons in a document can affect compilation time. If one or several icons are used several times, compilation time can be increased by precomposing these icons. In the precomposing process, the relevant icons are compiled into an external PDF file from which they are then loaded into the document. This not only decreases compilation time, because every icon is only created once, but it also reduces the file size, because every icon is only embedded into the file once and further uses just reference to the first embedded instance.
980
981 In order to be able to compile an external PDF file during compilation (which required LaTeX to call another instance of LaTeX), the compilation needs to run with enabled shell escape.
982
983 In order to be able to include the external PDF file into the document, a backend that supports PDF inclusion (such as PDFLaTeX, LuaLaTeX or XeLaTeX) needs to be used.
984
985 \begin{macrodef}
986 |\RPGIconsPrecomposeIcon|[<options>][<reference>]{<shape>}
987 |\RPGIconsPrecomposeIcon*|[<options>][<reference>]{<shape>}
988 \end{macrodef}
989
990 Using the macro \macro{\RPGIconsPrecomposeIcon} icons can be precomposed. This macro should be used in the preamble of the document. It takes one mandatory argument that expects as string the name of the shape of the icon. The first optional argument can be used to provide options for styling the icon. The second optional argument can be used to define a reference for this comcrete styled icon. If no reference is defined, the name of the shape is used as reference. The starred version of the command is used to fill a frame with color instead of drawing its outline (see the macros \macro{\RPGIconsUseIcon} and \macro{\RPGIconsUseIcon*} for comparison).
991
992 For example, to precompose an icon that uses the \macro{charisma} shape in black and another icon with the \macro{charisma} shape in red with the reference \macro{charisma-red}, the following two lines can be placed in the preamble of the document:
993
994 \begin{codeexample}
995 \RPGIconsPrecomposeIcon[scale=.333]{charisma}
996 \RPGIconsPrecomposeIcon[scale=.333, color=red][charisma-red]{charisma}
997 \end{codeexample}
998
999 \begin{macrodef}
1000 |precompose|
1001 |precompose|={<string>}
1002 \end{macrodef}
1003
1004 Once an icon has been precomposed, it can be called by adding the \macro{precompose} option to the relevant macro. For example, \macro{\ability{charisma}[precompose]} would load the shape from the external PDF that has been generated using the shape name as reference. To call an icon using a specific reference, this reference can be given as value to the \macro{precompose} option. For example, the above described red variant of the \macro{\ability{charisma}} shape could be called using \macro{\ability{charisma}[precomppse=charisma-red]}.
1005
1006 Due to the fact that options that set colors, transformations or other styles have already been applied when the external PDF was generated, they won't have any effect when used together with the option \macro{precompose}.
1007
1008 \subsection{Roll dice syntax}\label{sec:roll-dice-syntax}
1009
1010 \begin{macrodef}
1011 |\roll|{<roll syntax>}
1012 |\RPGIconsRoll|{<roll syntax>}
1013 \end{macrodef}
1014 The \macro{\roll} macro can be used to quickly typeset dice rolls with the relevant icons using the established dice rolling syntax. This syntax consists of a sequence of dice and numbers concatenated by mathematical operators (plus, minus or times). Typically, the letter \macro{d} is used to denote a die with a certain number of sides. For example \macro{d6} denotes a six-sided die. A number can be added to specify the number of such dice that are rolled together. The letter to denote the die can be changed using the option \macro{roll syntax}.
1015
1016 For example, \macro{2d6 + 3d4 - 1} means ``roll two six-sided dice and three four-sided dice and subtract one from the result''. The command \macro{\roll{2d6 + 3d4 - 1}} results in \roll{2d6 + 3d4 - 1}.
1017
1018 The die notations \macro{d2}, \macro{d4}, \macro{d6}, \macro{d8}, \macro{d10}, \macro{d12}, \macro{d20} and \macro{d100} are defined. To denote a fudge die, \macro{dF} can be used. To denote that the lowest or highest die should be removed from the result, the letters \macro{L} and \macro{H} can be used. The syntax \macro{2d6 x 2} or \macro{2d6 * 2} can be used to denote several rolls with the same set of dice.
1019
1020 If the \macro{rpgicons} package is to be loaded together with some other package that defines the command \macro{\roll}, the command \macro{\RPGIconsRoll} can be used. This alternative command is an exact copy of the \macro{\roll} command.
1021
1022 \begin{macrodef}
1023 |roll syntax|={<comma-separated list>}
1024 \end{macrodef}
1025 The option \macro{roll syntax} can be used to change the character that denotes a die in the dice rolling syntax. Multiple characters can be given using a comma separated list. The default setting is \macro{d,D} which allows notations such as \macro{2d6} or \macro{2D6}.
1026
1027 With \macro{\rpgiconsset{roll syntax={w,W}}}, for example, notations such as \macro{2w6} or \macro{2W6} could be used.
1028
1029 % PGF variant
1030
1031 \RenewCommandCopy\die\rpgiconsdie
1032 \RenewCommandCopy\ability\rpgiconsability
1033
1034 \section{Specifics of the PGF package variant}
1035
1036 The PGF variant of the package is loaded by either calling \macro{\usepackage[pgf]{rpgicons}} or \macro{\usepackage{rpgicons-pgf}} in the preamble of the document after having installed the files \macro{rpgicons.sty} and \macro{rpgicons-pgf.sty}.
1037
1038 Since the commands to typeset the icons with the PGF variant of the package use \macro{tikzpicture} environments, these commands should not be used inside another \macro{tikzpicture}. However, because the package defines the icons as Ti\emph{k}Z shapes, it is possible to use the icons in \macro{tikzpicture} environments directly.
1039
1040 Apart from that, the PGF variant of the package provides a way to define custom commands to typeset the icons as boxed material which is safe to use in a \macro{tikzpicture} context. Furthermore, the icons can be used as Ti\emph{k}Z pics.
1041
1042 Once loaded, the PGF variant of the package defines a set of node shapes that can be used inside a \macro{tikzpicture} environment.
1043
1044 \begin{macrodef}
1045 |pics|
1046 \end{macrodef}
1047 The PGF variant of the package provides the option \macro{pics}. If the package is loaded with this option, every icon is also available as Ti\emph{k}Z pic. On the use of pics, see section \ref{sec:pics} below.
1048
1049 \subsection{Icon commands}
1050
1051 \begin{macrodef}
1052 !rpg icons/!|variant|
1053 !rpg icons/!|variant|={<integer>}
1054 \end{macrodef}
1055 The main user commands (as well as the underlying commands on which these commands are based as described below) accept as option the key \macro{rpg icons/variant} which accepts an integer as value to select variants for the relevant shape. See the icon lists above for the respective variants. For example, the command \macro{\ability{dexterity}[rpg icons/variant=1]} results in \ability{dexterity}[rpg icons/variant=1].
1056
1057 Setting the key \macro{rpg icons/variant} without value is equivalent to setting its value to \macro{1}. Selecting a non-existent variant selects the default shape.
1058
1059 With the following setting, all occurrences of the \macro{necrotic} shape are set to the relevant variant.
1060
1061 \begin{codeexample}
1062 \tikzset{
1063 rpg icons/every necrotic/.append style={
1064 rpg icons/variant=1
1065 }
1066 }
1067 \end{codeexample}
1068
1069 \begin{macrodef}
1070 |\rpgiconsdie|[<style>]{<shape>}[<options>]{<integer>}
1071 |\rpgiconsability|[<style>]{<shape>}[<options>]
1072 |\rpgiconssaving|[<style>]{<shape>}[<options>]
1073 |\rpgiconsspell|{<shape>}[<options>]
1074 |\rpgiconsspellschool|[<style>]{<shape>}[<options>]
1075 |\rpgiconsdamage|{<shape>}[<options>]
1076 |\rpgiconsattack|{<shape>}[<options>]
1077 |\rpgiconscondition|{<shape>}[<options>]
1078 |\rpgiconsclass|[<style>]{<shape>}[<options>]
1079 |\rpgiconsalignment|[<style>]{<shape>}[<options>]
1080 |\rpgiconscurrency|{<shape>}[<options>]
1081 |\rpgiconsdirection|[<style>]{<shape>}[<options>]{<integer>}
1082 \end{macrodef}
1083 This set of commands are the basic commands defined by the PGF variant of the package on which the commands \macro{\die}, \macro{\ability}, \macro{\saving}, \macro{\spell}, \macro{\spellschool}, \macro{\damage}, \macro{\attack}, \macro{\condition}, \macro{\class}, \macro{\alignment}, \macro{\currency} as well as \macro{\direction} are based. This set of commands can be used in cases where another package defines one of these user commands. These user commands are exact copies of this set of commands.
1084
1085 \subsection{Icon styles}
1086
1087 Using the PGF variant of the package, all icons can by styled using arbitrary Ti\emph{k}Z styles in general. As an example, \macro{\die{eightside}[blue, thick]{2}} results in \die{eightside}[blue, thick]{2}.
1088
1089 If PDF tagging is activated by using \macro{\DocumentMetadata{tagging=on}}, a replacement text is automatically added to the relevant icon which can be copied to the clipboard and can be read by screen readers. Note that tagging support depends on the used PDF reader. It is possible to add a replacement text to an icon using the \macro{actualtext} key.
1090
1091 \begin{macrodef}
1092 !rpg icons/!|every die|/.style={<options>}
1093 !rpg icons/!|every ability|/.style={<options>}
1094 !rpg icons/!|every saving|/.style={<options>}
1095 !rpg icons/!|every spell|/.style={<options>}
1096 !rpg icons/!|every spellschool|/.style={<options>}
1097 !rpg icons/!|every damage|/.style={<options>}
1098 !rpg icons/!|every attack|/.style={<options>}
1099 !rpg icons/!|every condition|/.style={<options>}
1100 !rpg icons/!|every class|/.style={<options>}
1101 !rpg icons/!|every alignment|/.style={<options>}
1102 !rpg icons/!|every currency|/.style={<options>}
1103 !rpg icons/!|every direction|/.style={<options>}
1104 !rpg icons/!|every <<shape>>|/.style={<options>}
1105 \end{macrodef}
1106 Using Ti\emph{k}Z styles, all instances of a certain command or a certain shape can be styled at once. These styles all follow the pattern \macro{rpg icons/every} followed by a space and the name of the command or the shape. For example, \macro{\tikzset{rpg icons/every die/.append style={red}}} can be used to draw in red all icons created using the \macro{\die} command. To draw every instance of the \macro{charisma} shape in red, \macro{\tikzset{rpg icons/every charisma/.append style={red}}} can be used.
1107
1108 \subsection{Setting styles globally}
1109
1110 \begin{macrodef}
1111 |rpg icons|/.style={<options>}
1112 \end{macrodef}
1113 All icons share the Ti\emph{k}Z style \macro{rpg icons} that is empty per default but can be used to style all icons at once. For example, if \macro{\tikzset{rpg icons/.append style={draw=red}}} is placed at the beginning of the document, all icons will be drawn in red. Per default, the icons are drawn in the color of the surrounding text. Per default, the Ti\emph{k}Z keys \macro{line cap} and \macro{line join} are set to \macro{round}.
1114
1115 Note that it may be necessary to add the Ti\emph{k}Z option \macro{transform shape} when applying transformations to the icons, because the icons are constructed as Ti\emph{k}Z nodes which are not affected by some transformations per default.
1116
1117 \begin{macrodef}
1118 !rpg icons/!|background|={<color>}
1119 \end{macrodef}
1120 Some icons can be used with a negative color scheme where the icon is drawn negatively inside a filled shape. Per default, the icons are drawn in white in such cases, but it might be desirable that the icons are in the same color as the background. To this end, the color can be changed using the Ti\emph{k}Z option \macro{rpg icons/background} in the following way:
1121
1122 \begin{codeexamplecolumns}
1123 \colorbox{blue!50}{%
1124 \ability[negative]{charisma}
1125 [scale=2, transform shape]%
1126 }
1127
1128 \tikzset{
1129 rpg icons/background={blue!50}
1130 }
1131 \colorbox{blue!50}{%
1132 \ability[negative]{charisma}
1133 [scale=2, transform shape]%
1134 }
1135 \end{codeexamplecolumns}
1136 This feature can, of course, also be used to change the color of the icon independently from the color of the background.
1137
1138 Note that the key \macro{rpg icons/background color} has been deprecated and the key \newline \macro{rpg icons/background} should be used instead.
1139
1140 \begin{macrodef}
1141 !rpg icons/!|before sep|={<dimension>}
1142 !rpg icons/!|after sep|={<dimension>}
1143 !rpg icons/!|baseline|={<dimension>}
1144 \end{macrodef}
1145 The Ti\emph{k}Z options \macro{rpg icons/before sep} and \macro{rpg icons/after sep} are used to define the width of the space that is added before and after the icons respectively. The default value of both lengths is 0.05\,em. For example, setting the space before icons to 1\,cm can be achieved as follows:
1146
1147 \begin{codeexamplecolumns}
1148 Roll\die{eightside}{}a die!
1149
1150 \tikzset{
1151 rpg icons/before sep={1cm}
1152 }
1153 Roll\die{eightside}{}a die!
1154 \end{codeexamplecolumns}
1155
1156 The option \macro{baseline} can be used to adjust the baseline of the icons. A larger value for the baseline will shift the icon downwards relative to the baseline of the surrounding text. The default value of the baseline is \textminus 3.5\,pt.
1157
1158 \subsection{Direct use of shapes}
1159
1160 Because the icons are defined as Ti\emph{k}Z shapes, they can directly be applied to Ti\emph{k}Z nodes. However, the shapes don't have a shape border and no anchors defined, except for the \macro{center} anchor that sits exactly in the center of the shape. Therefore, if nodes with these shapes are connected using edges, the \macro{center} anchor will be used to connect the nodes. If nodes with these shapes are being positioned, only the \macro{center} anchor is available. Text content of these nodes is simply printed on top of the center of the node. Compare the following example.
1161
1162 \begin{codeexamplecolumns}
1163 \begin{tikzpicture}
1164 \node[eightside, draw, blue, thick]
1165 at (0,0) (A) {A};
1166 \node[charisma, draw]
1167 at (2,0) (B) {B};
1168 \draw[red] (A) -- (B);
1169 \end{tikzpicture}
1170 \end{codeexamplecolumns}
1171
1172 The variant shapes are accessible by adding the variant number as small roman numeral to the shape name. For example, to access the second variant of the \macro{druid} shape, use \macro{druid ii}. This is also possible for boxed icons and icons as pics as described below.
1173
1174 \subsection{Boxing of icons}
1175
1176 Because the icons cannot simply be used inside \macro{tikzpicture} environments, the PGF variant of the package provides a workaround to place icons inside boxes for later use. Icons that are boxed this way can safely used inside \macro{tikzpicture} environments. This might be necessary, if an icon should be used in inline text that sits inside a node.
1177
1178 \begin{macrodef}
1179 |\provideprotectedrpgicon|{<command>}[<style>]{<shape>}[<options>]{<box name>}
1180 \end{macrodef}
1181 The command \macro{\provideprotectedrpgicon} creates a box containing the icon that would be created using one of the regular commands this package provides.
1182
1183 \macro{\provideprotectedrpgicon{die}[large]{eightside}[blue, thick]{mybox}}, for example, stores the icon of an eight-sided die with the relevant style and Ti\emph{k}Z options in a new box named \macro{mybox}. Note that no integer can be added to the macros \macro{die}, \macro{currency} or \macro{direction} in this context.
1184
1185 \provideprotectedrpgicon{die}[large]{eightside}[blue, thick]{mybox}
1186
1187 \begin{macrodef}
1188 |\useprotectedrpgicon|{<box name>}
1189 \end{macrodef}
1190 Using the command \macro{\useprotectedrpgicon}, the previously defined box can be used to place the relevant icon. With the above definition, \macro{\useprotectedrpgicon{mybox}} would result in \useprotectedrpgicon{mybox}.
1191
1192 Having created a boxed icon, it is safe to use it, for example, inside a Ti\emph{k}Z node:
1193
1194 \begin{codeexamplecolumns}
1195 \begin{tikzpicture}
1196 \node[circle, draw, align=center] {
1197 \useprotectedrpgicon{mybox} \\
1198 Roll a die!
1199 };
1200 \end{tikzpicture}
1201 \end{codeexamplecolumns}
1202
1203 \subsection{Icons as pics}\label{sec:pics}
1204
1205 If the PGF variant of the package is loaded with the option \macro{pics}, every icon is also available as Ti\emph{k}Z pic. The names of the pics always start with \macro{rpg icons} followed by a space and the name of the relevant icon (see the lists above). For abilities, savings, spellschools, damages, classes and alignments, additional pics containing the relevant frame exist where the name has the suffixes \macro{ability}, \macro{saving}, \macro{spellschool}, \macro{damage}, \macro{class}, and \macro{alignment} respectively.
1206
1207 The icon is embedded as a node in the pic which has the name \macro{-node}. Thus, it is possible to name the pic and refer to the node inside. Due to the fact that the icon is a node, the option \macro{transform shape} has to be used if transformations on the pic should affect the node as well. It is possible to apply styles to the node using the Ti\emph{k}Z option \macro{every node} as shown in the following example.
1208
1209 \begin{codeexamplecolumns}
1210 \begin{tikzpicture}
1211 \pic[
1212 transform shape,
1213 scale=2,
1214 fill=blue,
1215 draw=red,
1216 every node/.append style={
1217 white,
1218 thick
1219 }
1220 ] (p) {rpg icons charisma ability};
1221 \draw[red] (p-node) -- +(2,0);
1222 \end{tikzpicture}
1223 \end{codeexamplecolumns}
1224
1225 \begin{macrodef}
1226 !rpg icons/!|create pic from shape|={<string>}
1227 !rpg icons/!|create pic from ability shape|={<string>}
1228 !rpg icons/!|create pic from saving shape|={<string>}
1229 !rpg icons/!|create pic from spellschool shape|={<string>}
1230 !rpg icons/!|create pic from damage shape|={<string>}
1231 !rpg icons/!|create pic from class shape|={<string>}
1232 !rpg icons/!|create pic from alignment shape|={<string>}
1233 !rpg icons/!|create every style|={<string>}
1234 \end{macrodef}
1235 The PGF variant of the package defines five Ti\emph{k}Z keys that are used to create pics using the relevant node shapes. Another key is defined to create keys that can be used to style all instances of a command or shape. In normal circumstances, it is not necessary to use these keys. They are mentioned here only for reference. These keys expect as value a string representing the relevnat shape name. It is possible to use the \macro{/.list} handler provided by PGF to apply the key to multiple values at once.
1236
1237 The following example shows how to create the drawing on the first page of this documentation using Ti\emph{k}Z pics. We need to call \macro{rpg icons/create pic from ability shape} for the shapes \macro{twentyside}, \macro{buff} and \macro{ranged}, because per default no pics are defined for these shapes in combination with ability. Note the use of \macro{\space} to ensure correct use of spaces in the pic name as spaces are gobbled after commands in TeX.
1238
1239 \begin{codeexamplecolumns}
1240 \tikzset{
1241 rpg icons%
1242 /create pic from ability shape%
1243 /.list={
1244 twentyside,
1245 buff,
1246 ranged
1247 },
1248 rpg icons/every ability/.style={
1249 ultra thick,
1250 draw=white,
1251 line join=round,
1252 line cap=round
1253 }
1254 }
1255
1256 \begin{tikzpicture}[scale=4]
1257 \foreach \x/\c [count=\i] in {
1258 twentyside/264653,
1259 charisma/287271,
1260 armour/2a9d8f,
1261 buff/e9c46a,
1262 ranged/f4a261,
1263 proficiency/e76f51
1264 } {
1265 \definecolor{color}{HTML}{\c}
1266 \pic[
1267 fill=color,
1268 draw=none,
1269 transform shape
1270 ] at ({60*\i+10}:{0.33cm})
1271 {rpg icons \x\space ability};
1272 }
1273 \end{tikzpicture}
1274 \end{codeexamplecolumns}
1275
1276 \subsection{Roll dice syntax}
1277
1278 \begin{macrodef}
1279 |\roll|{<roll syntax>}
1280 |\rpgiconsroll|{<roll syntax>}
1281 \end{macrodef}
1282 Please refer to section \ref{sec:roll-dice-syntax} about how to use the \macro{\roll} macro in general. Differences to the L3 variant of the package are described in the following.
1283
1284 The letter to denote the die can be changed using the Ti\emph{k}Z style \macro{rpg icons/roll syntax}.
1285
1286 If the \macro{rpgicons} package is to be loaded together with some other package that defines the command \macro{\roll}, the command \macro{\rpgiconsroll} can be used. This alternative command is an exact copy of the \macro{\roll} command.
1287
1288 \begin{macrodef}
1289 !rpg icons/!|roll syntax|={<comma-separated list>!}
1290 \end{macrodef}
1291 The Ti\emph{k}Z style \macro{rpg icons/roll syntax} can be used to change the character that denotes a die in the dice rolling syntax. Multiple characters can be given using a comma separated list. The default setting is \macro{d,D}.
1292
1293 % =====
1294
1295 \section{L3 token variables and commands}
1296
1297 The L3 variant of the package provides the following token variables and commands for defining user functions by package authors.
1298
1299 \begin{macrodef}
1300 |\rpgicons_draw_shape_<<shape>>:|
1301 \end{macrodef}
1302 These commands contain the definitions of the shapes of the icons. If the shape name contains a space, this is substituted by an underscore in the command name. For example, the command \macro{\rpgicons_draw_shape_charisma:} contains the definition of the charisma shape, the command \macro{\rpgicons_draw_shape_psion_i:} contains the definition of variant one of the psion shape (\macro{psion i}).
1303
1304 The definition of a shape consists of a row of commands to describe one or more paths. The definition should be a valid code snippet that can be placed between the commands \macro{\draw_begin:} and \macro{\draw_path_use:n { stroke } \draw_end:}. The shape \macro{lawful neutral}, for example, has the following definition:
1305
1306 \begin{codeexample}
1307 \cs_new_protected:Npn \rpgicons_draw_shape_lawful_neutral: {
1308 \draw_path_circle:nn { 0cm , 0cm } { .2cm }
1309 \draw_path_moveto:n { .4cm , 0cm }
1310 \draw_path_lineto:n { -.4cm , 0cm }
1311 }
1312 \end{codeexample}
1313
1314 \begin{macrodef}
1315 |\rpgicons_draw_shape_sixside_pips:n| {<integer>}
1316 \end{macrodef}
1317 The command \macro{\rpgicons_draw_shape_sixside_pips:n} takes as argument an integer from one to nine and outputs the definition of paths representing the relevant number and arrangement of pips inside the shape of a sixside die.
1318
1319 \begin{macrodef}
1320 |\rpgicons_draw_frame_ability:|
1321 |\rpgicons_draw_frame_saving:|
1322 |\rpgicons_draw_frame_spellschool:|
1323 |\rpgicons_draw_frame_damage:|
1324 |\rpgicons_draw_frame_class:|
1325 |\rpgicons_draw_frame_alignment:|
1326 \end{macrodef}
1327 These commands contain the definitions of the relevant frames that are used by the relevant icon commands.
1328
1329 \begin{macrodef}
1330 |\l_rpgicons_icon_before_sep_dim|
1331 |\l_rpgicons_icon_after_sep_dim|
1332 |\l_rpgicons_icon_baseline_dim|
1333 |\l_rpgicons_icon_linewidth_dim|
1334 \end{macrodef}
1335
1336 \begin{macrodef}
1337 |\l_rpgicons_icon_frame_tl|
1338 |\l_rpgicons_icon_color_stroke_tl|
1339 |\l_rpgicons_icon_color_fill_tl|
1340 |\l_rpgicons_icon_color_text_tl|
1341 |\l_rpgicons_icon_color_background_tl|
1342 \end{macrodef}
1343
1344 \begin{macrodef}
1345 |\l_rpgicons_icon_variant_int|
1346 \end{macrodef}
1347
1348 \begin{macrodef}
1349 |\l_rpgicons_icon_opacity_stroke_fp|
1350 |\l_rpgicons_icon_opacity_fill_fp|
1351 |\l_rpgicons_icon_opacity_text_fp|
1352 |\l_rpgicons_icon_opacity_background_fp|
1353 |\l_rpgicons_icon_transform_scale_fp|
1354 |\l_rpgicons_icon_transform_scale_inner_fp|
1355 |\l_rpgicons_icon_transform_rotate_fp|
1356 \end{macrodef}
1357
1358 \begin{macrodef}
1359 |\l_rpgicons_icon_actualtext_str|
1360 \end{macrodef}
1361 These token lists contain the values set by the ueer via the relevant options. The floating point token lists \macro{\l_rpgicons_icon_opacity_stroke_fp}, \macro{\l_rpgicons_icon_opacity_fill_fp}, \newline \macro{\l_rpgicons_icon_opacity_text_fp}, \macro{\l_rpgicons_icon_opacity_background_fp}, \newline as well as \macro{\l_rpgicons_icon_transform_scale_fp} and \newline \macro{\l_rpgicons_icon_transform_scale_inner_fp} are initialised with the value 1.0.
1362
1363 \begin{macrodef}
1364 |\l_rpgicons_icon_precompose_ref_str|
1365 |\l_rpgicons_precompose_output_str|
1366 \end{macrodef}
1367 The token list \macro{\l_rpgicons_icon_precompose_ref_str} contain the values set by the ueer via the option \macro{precompose}.
1368
1369 The token list \macro{\l_rpgicons_precompose_output_str} contains the value set by the user via the option \macro{precompose output}. Its default value is \macro{\c_sys_jobname_str _rpgicons} which is the name of the current file with the suffix \macro{_rpgicons} added.
1370
1371 \begin{macrodef}
1372 |\rpgicons_shape_set_eq:nn| {<shape>} {<shape>}
1373 \end{macrodef}
1374 The command \macro{\rpgicons_shape_set_eq:nn} sets the definition of the shape given in the first argument equal to that given in the second argument. If either shape name contains spaces, these are replaced by underscores. The relevant internal command is then set to contain the relevant shape definition. For example, \macro{\rpgicons_shape_set_eq:nn {foo} {charisma}} will create the command \macro{\rpgicons_draw_shape_foo:} as copy of \macro{\rpgicons_draw_shape_charisma:}. If the shape given in the first argument already exits, its definition will be replaced.
1375
1376 % ===
1377
1378 \printchanges
1379
1380 \end{document}
1381
1382 %% End of file `rpgicons-doc.tex`.