Debian Codegraph @

texmf-dist/source/latex/vexillology/vexillology.dtx

raw
1 % \iffalse meta-comment
2 % File: vexillology.dtx Copyright (C) 2026 Karl D. Hammond
3 %
4 % Karl D. Hammond
5 % CTAN and TeX StackExchange user karlh
6 %
7 % This work may be distributed and/or modified under the
8 % conditions of the LaTeX Project Public License, either version 1.3
9 % of this license or (at your option) any later version.
10 % The latest version of this license is in
11 % http://www.latex-project.org/lppl.txt
12 % and version 1.3 or later is part of all distributions of LaTeX
13 % version 2005/12/01 or later.
14 %
15 % This work has the LPPL maintenance status `maintained'.
16 %
17 % The Current Maintainer of this work is K. D. Hammond.
18 %
19 % This work consists of the files vexillology.dtx and vexillology.ins
20 % and the derived files vexillology.sty and vexillology.pdf.
21 % \fi
22 %
23 % \iffalse
24 %<*driver>
25 \ProvidesFile{vexillology.dtx}
26 %</driver>
27 %
28 %<package>\NeedsTeXFormat{LaTeX2e}
29 %<package>\RequirePackage{tikz}
30 %<package>\ProvidesPackage{vexillology}
31 %<*package>
32 [2026/01/15 v1.0.0 vexillogical symbols]
33 %</package>
34 %<*driver>
35 \documentclass[12pt,letterpaper]{ltxdoc}
36 \usepackage[margin=1in]{geometry}
37 \usepackage[T1]{fontenc}
38 \usepackage{newpxtext,newpxmath}
39 \usepackage{booktabs}
40 \usepackage{listings}
41 \usepackage[svgnames]{xcolor}
42 \usepackage{tikz}
43 \usepackage[labelfont=bf,labelsep=period,font=small]{caption}
44 \usepackage{worldflags}
45 \GetFileInfo{vexillology.dtx}
46 \usepackage{vexillology}[\filedate\space\fileversion]
47 \DisableCrossrefs
48 \CodelineIndex
49 \PageIndex
50 \CodelineNumbered
51 \RecordChanges
52 \let\env\texttt
53 \let\pkg\textsf
54 \IndexPrologue{\section*{Index}%
55 \markboth{Index}{Index}%
56 Numbers written in italics refer to the page
57 where the corresponding entry is described;
58 numbers underlined refer to the code line
59 of the definition.}
60 \begin{document}
61 \DocInput{vexillology.dtx}
62 \end{document}
63 %</driver>
64 % \fi
65 %
66 %^^A \CheckSum{}
67 %
68 % \CharacterTable
69 % {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
70 % Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
71 % Digits \0\1\2\3\4\5\6\7\8\9
72 % Exclamation \! Double quote \" Hash (number) \#
73 % Dollar \$ Percent \% Ampersand \&
74 % Acute accent \' Left paren \( Right paren \)
75 % Asterisk \* Plus \+ Comma \,
76 % Minus \- Point \. Solidus \/
77 % Colon \: Semicolon \; Less than \<
78 % Equals \= Greater than \> Question mark \?
79 % Commercial at \@ Left bracket \[ Backslash \\
80 % Right bracket \] Circumflex \^ Underscore \_
81 % Grave accent \` Left brace \{ Vertical bar \|
82 % Right brace \} Tilde \~}
83 %
84 % \changes{v1.0.0}{2026/01/15}{Initial public release}
85 %
86 % \providecommand*{\TikZ}{Ti\emph{k}Z}
87 % \hypersetup{urlcolor=DarkBlue,linkcolor=DarkRed}
88 %
89 % \lstset{%
90 % basicstyle=\ttfamily\footnotesize,
91 %^^A columns=flexible,
92 % language={[LaTeX2e]TeX},
93 %^^A texcsstyle=*\bfseries\color{emphcolor},
94 % keywordstyle=[2]\color{mathcolor},
95 % keywordstyle=[3]\color{red},
96 % commentstyle=\color{gray},
97 % moretexcs={worldflag,vexcivilflag,vexstateflag,vexwarflag,%
98 % vexcivilensign,vexstateensign,vexwarensign,vexusage,%
99 % vexgrid,vexgridextended,%
100 % vexnormal,vexproposed,vexreconstruction,vexreverse,vexvariant,%
101 % vexalternative,vexdefacto,vexreverseisdifferent,vexsinisterhoist,%
102 % vexauthorized,vexhistorical,vexreverseismirror,vexreverseiscongruent,%
103 % vexnormalvertical,vexobversevertical,vexrotatevertical,%
104 % vexunknownvertical,vexonlyvertical,vexnorotating,vexunauthorized,},%
105 % }
106 % \newcommand\command{\lstinline[basicstyle=\ttfamily,texcsstyle=*\bfseries\color{MidnightBlue}]}
107 % \newcommand\docstripworldflag[2][]%
108 % {\bgroup\catcode`\%=14\worldflag[#1]{#2}\egroup}
109 %
110 % \GetFileInfo{vexillology.dtx}
111 % \title{The \textsf{vexillology} package\thanks{This document corresponds to
112 % \pkg{vexillology}~\fileversion, dated \filedate.}}
113 % \author{Karl D. Hammond}
114 % \date{\filedate}
115 % \maketitle
116 %
117 % \begin{abstract}
118 % This package implements symbols used by vexillologists (people who study
119 % flags) to indicate certain aspects of flags, such as where they are used,
120 % who uses them, and what they look like. The package uses \TikZ\ to draw the
121 % symbols, whose heights scale with the font size.
122 % \end{abstract}
123 %
124 % \section{Introduction}
125 % In the 1970s, Dr.~Whitney Smith, vexillologist and founder of the North
126 % American Vexillogical Association, created a series of symbols for use in
127 % his books on flags that identify how flags are used. These symbols include
128 % whether the particular image being shown is used as the civilian flag
129 % rather than for state or military purposes, as well as whether they are
130 % officially designed by law or other government policy or simply commonly
131 % used, how they appear when hung vertically, and whether the flag is
132 % currently used or has been/was officially adopted.
133 %
134 % The symbols were proposed (though never officially adopted) by the
135 % International Federation of Vexillogical Associations (FIAV) in the late
136 % 1970s, and the symbol set has been supplemented on occasion.
137 % In particular, \v Zeljko Heimer added the symbols \vexnormal\ and
138 % \vexhistorical\ to differentiate flags that were currently in use from
139 % historical, no-longer-in-use flags. The package author also added the
140 % \vexobversevertical\ symbol for clarity.\footnote{The author has asked
141 % in various places what the difference between \vexrotatevertical\ and
142 % \vexnorotating\ is, but it is not entirely clear. The
143 % interpretations herein represent his understanding at the time of the
144 % most recent update.}
145 %
146 % A proposal exists [A.~Pandey, ``Proposal to Encode Vexillology Symbols in
147 % UNICODE,''
148 % \url{https://www.unicode.org/L2/L2024/24245-vexillology-symbols.pdf},
149 % 2024] to encode the symbols in this document in UNICODE\@. However, at
150 % the time of writing, this has not been done. If this proposal is accetped,
151 % a package option will be introduced to use the UNICODE characters directly.
152 %
153 % \section{Status and Design Symbols} \label{sec:design}
154 % The first set of symbols describes the state of recognition for a flag and
155 % its design. The symbols are included in Table~\ref{table:design}.
156 % \begin{table}
157 % \caption{Symbols used to denote the design and/or official status of
158 % a flag or ensign.}
159 % \label{table:design}
160 % \leavevmode
161 % \SpecialMacroIndex{\vexnormal}\relax
162 % \SpecialMacroIndex{\vexproposed}\relax
163 % \SpecialMacroIndex{\vexreconstruction}\relax
164 % \SpecialMacroIndex{\vexreverse}\relax
165 % \SpecialMacroIndex{\vexvariant}\relax
166 % \SpecialMacroIndex{\vexvexalternative}\relax
167 % \SpecialMacroIndex{\vexdefacto}\relax
168 % \SpecialMacroIndex{\vexreverseisdifferent}\relax
169 % \SpecialMacroIndex{\vexsinisterhoist}\relax
170 % \SpecialMacroIndex{\vexauthorized}\relax
171 % \SpecialMacroIndex{\vexhistorical}\relax
172 % \SpecialMacroIndex{\vexreverseismirror}\relax
173 % \SpecialMacroIndex{\vexreverseiscongruent}\relax
174 % \SpecialMacroIndex{\vexnormalvertical}\relax
175 % \SpecialMacroIndex{\vexobversevertical}\relax
176 % \SpecialMacroIndex{\vexrotatevertical}\relax
177 % \SpecialMacroIndex{\vexunknownvertical}\relax
178 % \SpecialMacroIndex{\vexonlyvertical}\relax
179 % \SpecialMacroIndex{\vexnorotating}\relax
180 % \SpecialMacroIndex{\vexunauthorized}\relax
181 % \centering\small
182 % \begin{minipage}{\linewidth}\renewcommand*{\footnoterule}{\vskip-1ex}\relax
183 % \centering
184 % \begin{tabular}{l l p{8.4cm}}
185 % \toprule
186 % \textbf{Symbol} & \textbf{Macro}
187 % & \multicolumn{1}{l}{\textbf{Meaning}} \\
188 % \midrule
189 % \vexnormal & \command"\vexnormal"
190 % & Ordinary (\emph{de jure}) version of the flag, obverse side \\
191 % \vexproposed & \command"\vexproposed" & Design was proposed, but
192 % was never officially adopted \\
193 % \vexreconstruction & \command"\vexreconstruction"
194 % & Design is a reconstruction based on observations or descriptions \\
195 % \vexreverse & \command"\vexreverse"
196 % & Design shown is the reverse side \\
197 % \vexvariant & \command"\vexvariant"
198 % & Design shown is an acceptable variant of the ordinary design \\
199 % \vexalternative & \command"\vexalternative"
200 % & Design shown is one of several alternative versions that can be
201 % displayed \\
202 % \vexdefacto & \command"\vexdefacto"
203 % & Design shown is the \emph{de facto} flag, widely used but not
204 % officially adopted \\
205 % \vexreverseisdifferent & \command"\vexreverseisdifferent"
206 % & Flag has different designs on the obverse and the reverse sides \\
207 % \vexsinisterhoist & \command"\vexsinisterhoist"
208 % & Obverse side is meant to be hoisted with the pole on the observer's
209 % right. \\
210 % \vexauthorized & \command"\vexauthorized"
211 % & Design is officially authorized by the applicable government
212 % (unnecessary when \vexnormal\ is used) \\
213 % \vexhistorical & \command"\vexhistorical"
214 % & Design was used in the past, but is now abandoned. \\
215 % \vexreverseismirror & \command"\vexreverseismirror"
216 % & Reverse side is a mirror image of the obverse \\
217 % \vexreverseiscongruent & \command"\vexreverseiscongruent"
218 % & Reverse side is identical to the obverse \\
219 % \vexnormalvertical & \command"\vexnormalvertical"
220 % & Flag can be hung vertically by hanging with an ordinary pole, then
221 % rotating 90\textdegree\ counterclockwise (reverse is face-up) \\
222 % \vexobversevertical & \command"\vexobversevertical"
223 % & Flag can be hung vertically by hanging with an ordinary pole, then
224 % rotating 90\textdegree\ clockwise (obverse is face-up)\footnote{This
225 % symbol is non-standard, but it is used here to differentiate, for
226 % example, the flags of Canada and the United States, which show
227 % their reverse when hung vertically, from Brazil or Nicaragua,
228 % which show the obverse.} \\
229 % \vexrotatevertical & \command"\vexrotatevertical"
230 % & Design does not rotate with the flag when hanging vertically \\
231 % \vexunknownvertical & \command"\vexunknownvertical"
232 % & Information is not given or is not known for vertical display \\
233 % \vexonlyvertical & \command"\vexonlyvertical"
234 % & Flag [as shown] can only be hoisted vertically \\
235 % \vexnorotating & \command"\vexnorotating"
236 % & Design has no elements that can be rotated \\
237 % \vexunauthorized & \command"\vexunauthorized"
238 % & Flag is not officially authorized to represent the group or country
239 % \\
240 % \bottomrule
241 % \end{tabular}
242 % \end{minipage}
243 % \end{table}
244 % These symbols are typically used in tandem with the symbols in
245 % section~\ref{sec:usage}, so further discussion of them will be given in a
246 % later section for those that are not explained adequately in the table.
247 %
248 % \section{Usage Symbols} \label{sec:usage}
249 % In a second set of symbols, dots in a $3 \times 2$ grid denote the use of a
250 % flag. The top row represents land-based use, while the bottom shows maritime
251 % use. The first column denotes civilian (``civil'') use, the second column
252 % government (``state'') use, and the final column military (``war'') use;
253 % that is,
254 % \begin{center}
255 % \begin{tikzpicture}
256 % \begin{scope}[every node/.style={font=\tiny\color{white},
257 % minimum size=0.75cm,circle,draw,fill,text width=0.7cm,inner sep=0pt,
258 % align=center}]
259 % \vexgrid
260 % \node at (0.5,0.5) {civil flag};
261 % \node at (1.5,0.5) {gov't flag};
262 % \node at (2.5,0.5) {military flag};
263 % \node at (0.5,-0.5) {civil ensign};
264 % \node at (1.5,-0.5) {gov't ensign};
265 % \node at (2.5,-0.5) {naval ensign};
266 % \end{scope}
267 % \begin{scope}[overlay]
268 % \node [anchor=west] at (3.5, 0.5) {\emph{used on land}};
269 % \node [anchor=west] at (3.5,-0.5) {\emph{used on water}};
270 % \end{scope}
271 % \end{tikzpicture}
272 % \end{center}
273 % Occasionally, an ``extended'' usage symbol is used, which has three rows:
274 % air, land, and water:
275 % \begin{center}
276 % \begin{tikzpicture}
277 % \begin{scope}[every node/.style={font=\tiny\color{white},
278 % minimum size=0.75cm,circle,draw,fill,text width=0.7cm,inner sep=0pt,
279 % align=center}]
280 % \vexgridextended
281 % \node at (0.5,1.5) {civil air ens.};
282 % \node at (1.5,1.5) {state air ens.};
283 % \node at (2.5,1.5) {war air ensign};
284 % \node at (0.5,0.5) {civil flag};
285 % \node at (1.5,0.5) {state flag};
286 % \node at (2.5,0.5) {war flag};
287 % \node at (0.5,-0.5) {civil ensign};
288 % \node at (1.5,-0.5) {state ensign};
289 % \node at (2.5,-0.5) {war ensign};
290 % \end{scope}
291 % \begin{scope}[overlay]
292 % \node [anchor=west] at (3.5, 1.5) {\emph{used in the air}};
293 % \node [anchor=west] at (3.5, 0.5) {\emph{used on land}};
294 % \node [anchor=west] at (3.5,-0.5) {\emph{used on water}};
295 % \end{scope}
296 % \end{tikzpicture}
297 % \end{center}
298 % \DescribeMacro{\vexusage}
299 % These symbols are generated by the \command"\vexusage" command.
300 % The argument to \command"\vexusage" is a six-bit whole number (or, in the
301 % case of the extended usage symbol, a nine-bit whole number), with the
302 % least-significant bit denoting use as the civil flag. In the extended
303 % symbol, the three most significant bits are the air usage bits.
304 %
305 % For example, \command"\vexusage{23}" expands to
306 % \vexusage{23}, which indicates a flag used as the civil flag (bit~0, or
307 % $2^0=1$), the state flag (bit~1, or $2^1 = 2$), the war flag (bit~2,
308 % or $2^2 = 4$), and the state ensign (bit~5, or $2^5 = 16$), for a total of
309 % $2^0 + 2^1 + 2^2 + 2^5 = 23$.
310 %
311 % If the argument to \command"\vexusage" is 64 (i.e., $2^6$) or more, the
312 % extended symbol is assumed. For example, \command"\smash{\vexusage{66}}" produces
313 % \smash{\vexusage{66}}. To force a three-row symbol for an argument of 63 or
314 % less, use the starred form: \command"\smash{\vexusage*{23}}" expands to
315 % \smash{\vexusage*{23}}.
316 %
317 % The argument to \command"\vexusage" is parsed for addition and other
318 % operations, so it is valid to say \command"\vexusage{1+2+4+16}" instead of
319 % \command"\vexusage{23}". To avoid having to remember which bit is
320 % which---or do powers of 2\ in one's head---several macros are defined to
321 % make it easy to set only one or two bits. These macros are listed in
322 % Table~\ref{table:shortcuts}. Using those macros,
323 % \command"\vexusage{\vexcivilensign+\vexstateensign}", equivalent to
324 % \command"\vexusage{24}", yields \vexusage{\vexcivilensign+\vexstateensign}.
325 %
326 % \newcommand{\makearow}[1]{\texttt{\bfseries\color{MidnightBlue}\string #1} & #1 & \vexusage{#1}}
327 % \begin{table}
328 % \caption{Shortcut macros to represent each bit in the
329 % \texttt{\bfseries\color{MidnightBlue}\textbackslash vexusage} command
330 % argument.}
331 % \label{table:shortcuts}
332 % \leavevmode
333 % \SpecialMacroIndex{\vexcivilflag}\relax
334 % \SpecialMacroIndex{\vexstateflag}\relax
335 % \SpecialMacroIndex{\vexwarflag}\relax
336 % \SpecialMacroIndex{\vexcivilensign}\relax
337 % \SpecialMacroIndex{\vexstateensign}\relax
338 % \SpecialMacroIndex{\vexwarensign}\relax
339 % \SpecialMacroIndex{\vexcivilairensign}\relax
340 % \SpecialMacroIndex{\vexstateairensign}\relax
341 % \SpecialMacroIndex{\vexwarairensign}\relax
342 % \SpecialMacroIndex{\vexnationalflag}\relax
343 % \SpecialMacroIndex{\vexnationalensign}\relax
344 % \SpecialMacroIndex{\vexnationalflagandensign}\relax
345 % \SpecialMacroIndex{\vexnationaleverything}\relax
346 % \centering\small
347 % \begin{tabular}{l l l}
348 % \toprule
349 % \textbf{Macro} & \textbf{Expansion}
350 % & \textbf{Result of} \command"\vexusage"\{\emph{macro}\} \\
351 % \midrule
352 % \multicolumn{3}{l}{\textbf{Single-Bit Shortcuts}} \\
353 % \midrule
354 % \makearow{\vexcivilflag} \\
355 % \makearow{\vexstateflag} \\
356 % \makearow{\vexwarflag} \\
357 % \makearow{\vexcivilensign} \\
358 % \makearow{\vexstateensign} \\
359 % \makearow{\vexwarensign} \\
360 % \makearow{\vexcivilairensign} \\
361 % \makearow{\vexstateairensign} \\
362 % \makearow{\vexwarairensign} \\
363 % \midrule
364 % \multicolumn{3}{l}{\textbf{Multi-Bit Shortcuts}} \\
365 % \midrule
366 % \makearow{\vexnationalflag} \\
367 % \makearow{\vexnationalensign} \\
368 % \makearow{\vexnationalflagandensign} \\
369 % \makearow{\vexnationaleverything} \\
370 % \bottomrule
371 % \end{tabular}
372 % \end{table}
373 %
374 % \clearpage
375 % \section{Using the Symbols}
376 %^^A NOTE: The flags used in this section may or may not be implemented in
377 %^^A published version of worldflags and likely require either the use
378 %^^A of images included via \includegraphics or the author's personal
379 %^^A (unpublished) flag description files.
380 % \flagsdefault[width=2cm]
381 % As an example of the use of these symbols, the flags of Barbados, China, and
382 % the Dominican Republic are shown below:
383 % \begin{center}
384 % \begin{minipage}[t]{0.25\linewidth}\centering
385 % \worldflag{BB} \\
386 % Barbados \vexusage{31} \vexnormal\ \vexnormalvertical
387 % \end{minipage}
388 % \begin{minipage}[t]{0.25\linewidth}\centering
389 % \worldflag{CN} \\
390 % China \vexusage{27} \vexnormal\ \vexreverseismirror\ \vexobversevertical
391 % \end{minipage}
392 % \begin{minipage}[t]{0.4\linewidth}\centering
393 % \worldflag{DO} \\
394 % Dominican Republic \vexusage{54}
395 % \vexnormal\ \vexreverseismirror\ \vexrotatevertical
396 % \end{minipage}
397 % \end{center}
398 % The symbols indicate that Barbados uses the flag variant shown for all
399 % purposes except its navy; China uses this flag variant for all civilian and
400 % state purposes, but not for military purposes; and the Dominican Republic
401 % uses the design shown for state and military use but \emph{not} for
402 % civilian use (the civil flag and ensign lack the emblem).
403 %
404 % The flag of Barbados has mirror symmetry, so the reverse is both a mirror
405 % image of the obverse \emph{and} congruent to it. China and the Dominican
406 % Republic, in contrast, look different on the reverse, so the symbol
407 % \vexreverseismirror\ specifies that the reverse of the flag looks like the
408 % mirror image of the obverse:
409 % \begin{center}
410 % \vexreverse\space\vexauthorized\space\worldflag[turn=180]{BB}
411 % \quad
412 % \vexreverse\space\vexauthorized\space\worldflag[turn=180]{CN}
413 % \quad
414 % \vexreverse\space\vexauthorized\space\worldflag[turn=180]{DO}
415 % \end{center}
416 % where \vexreverse{} indicates that the back side of the flag is being shown.
417 %
418 % These three flags all have different specifications for \emph{vertical}
419 % display: Barbados uses ``normal'' vertical display, meaning the flag pole
420 % is rotated 90\textdegree\ and the flag then flips down and the reverse is
421 % shown; China rotates the flag 270\textdegree, meaning the \emph{obverse} of
422 % the flag is shown in the vertical orientation. The Dominican Republic,
423 % in contrast, adopts a modified design for vertical banners, in this case
424 % with the base design displayed normally but the emblem rotated so it
425 % remains upright.
426 %
427 % \begin{center}
428 % \vexonlyvertical\space\worldflag[vertical]{BB}
429 % \quad\vexonlyvertical\space\worldflag[obversevertical]{CN}
430 % \quad\vexonlyvertical\space\worldflag[vertical]{DO}
431 % \end{center}
432 % Another example would be a listing for Paraguay, which might look something
433 % like this:
434 % \begin{center}
435 % \begin{minipage}[t]{0.3\linewidth}\centering
436 % \worldflag{PY} \\
437 % Paraguay \vexusage{\vexnationalflagandensign} \vexnormal\ \vexreverseisdifferent\ \vexrotatevertical
438 % \end{minipage}
439 % \quad
440 % \begin{minipage}[t]{0.3\linewidth}\centering
441 % \worldflag[turn=180]{PY} \\
442 % Paraguay (reverse) \vexreverse\ \vexauthorized\ \vexrotatevertical
443 % \end{minipage}
444 % \end{center}
445 % The symbols on the left-hand image indicate that the flag is used both as
446 % the national flag and the national ensign (i.e., for all uses on both land
447 % and sea). The \vexnormal\ symbol indicates that the flag is established by
448 % law and the view shown is the obverse. The symbol \vexreverseisdifferent\
449 % indicates that the reverse side has a different design, which is the image
450 % on the right-hand side. On the right side, the symbol \vexreverse\ indicates
451 % that the image shown is the reverse side of the flag; the symbol
452 % \vexauthorized\ is used here to denote that the image shows is part of the
453 % statutory description of the flag\footnote{The symbol \vexnormal\ implies
454 % that the flag is established by law and/or officially adopted somehow,
455 % so the \vexauthorized\ symbol is not needed if \vexnormal\ is present.}
456 %
457 % The symbol \vexrotatevertical\ indicates that part---but not all---of the
458 % design should be rotated when displaying the flag vertically. In this case,
459 % it dictates that the correct vertical display of Paraguay's flag is the
460 % image on the right, \emph{not} the image on the left:
461 % \begin{center}
462 % \vexunauthorized\
463 % \tikz{\pic [country=PY,rotate=270] {worldflag};}
464 % \qquad
465 % \vexonlyvertical\ \vexauthorized\
466 % \worldflag[vertical]{PY}
467 % \end{center}
468 % The difference between \vexnormalvertical\ and \vexobversevertical\ is
469 % the difference between the two images below:
470 % \begin{center}
471 % \vexonlyvertical\ \vexauthorized\
472 % \worldflag[vertical]{US}
473 % \qquad
474 % \vexunauthorized\
475 % \worldflag[obversevertical]{US}
476 % \end{center}
477 % The \emph{correct} way to hang the flag of the USA vertically is the version
478 % on the left, meaning the base design would have the symbol
479 % \vexnormalvertical:
480 % \begin{center}
481 % \worldflag{US} \\
482 % USA \vexusage{63} \vexreverseismirror\ \vexnormalvertical
483 % \end{center}
484 % If the correct vertical version was the one on the right, the symbol
485 % \vexobversevertical\ would be used instead (as it is for the flag of China
486 % earlier in this section).
487 %
488 % \section{Symbol Size}
489 % The vexillogical symbols should scale properly with font size:
490 % \begin{quote}
491 % {\tiny \command"\tiny" text N\vexusage{1} \vexnormal} \\
492 % {\scriptsize \command"\scriptsize" text N\vexusage{2} \vexhistorical} \\
493 % {\footnotesize \command"\footnotesize" text N\vexusage{3} \vexdefacto} \\
494 % {\small \command"\small" text N\vexusage{4} \vexproposed} \\
495 % {\normalsize \command"\normalsize" text N\vexusage{5} \vexalternative} \\[0.5ex]
496 % {\large \command"\large" text N\vexusage{6} \vexauthorized} \\[1ex]
497 % {\Large \command"\Large" text N\vexusage{7} \vexreverseismirror} \\[1.5ex]
498 % {\LARGE \command"\LARGE" text N\vexusage{8} \vexreverseiscongruent} \\[1.5ex]
499 % {\huge \command"\huge" text N\vexusage{9} \vexnormalvertical} \\[1.5ex]
500 % {\Huge \command"\Huge" text N\vexusage{10} \vexrotatevertical}
501 % \end{quote}
502 %
503 % \StopEventually{\PrintChanges\PrintIndex}
504 %
505 % \iffalse
506 %<*package>
507 % \fi
508 %
509 % \section{Implementation}
510 % The |extended| option causes \emph{all} \command"\vexusage" commands to
511 % produce an ``extended'' symbol ($3 \times 3$ grid).
512 % \begin{macrocode}
513 \newif\ifvexallextended
514 \DeclareOption{extended}{\vexallextendedtrue}
515 \ProcessOptions
516 % \end{macrocode}
517 % This package requires \TikZ\ and its |arrows.meta| library.
518 % \begin{macrocode}
519 \RequirePackage{tikz}
520 \usetikzlibrary{arrows.meta}
521 % \end{macrocode}
522 % We scale each symbol relative to the height of the letter $x$ in the current
523 % font so they scale with text size. The height of the $2 \times 3$ grid is
524 % intended to match the height of the baseline--capline distance (the height
525 % of most capital letters).
526 % \begin{macrocode}
527 \newcommand*{\vexxscale}{0.8ex}
528 \newcommand*{\vexyscale}{0.8ex}
529 % \end{macrocode}
530 % The \command"\vexgrid" macro draws the ordinary $2 \times 3$ grid; the
531 % \command"\vexgridextended" macro draws the ``extended'' grid ($3\times 3$).
532 % \begin{macrocode}
533 \newcommand*{\vexgrid}{%
534 \draw (0,0) -- (3,0)
535 (1,-1) -- (1,1)
536 (2,-1) -- (2,1);
537 }
538 \newcommand*{\vexgridextended}{%
539 \draw (0,0) -- (3,0)
540 (0,1) -- (3,1)
541 (1,-1) -- (1,2)
542 (2,-1) -- (2,2);
543 }
544 % \end{macrocode}
545 % These commands actually draw the dots.
546 % \begin{macrocode}
547 \newcommand*{\vexdotone}{%
548 \fill (0.5,0.5) circle (0.35);
549 }
550 \newcommand*{\vexdottwo}{%
551 \fill (1.5,0.5) circle (0.35);
552 }
553 \newcommand*{\vexdotthree}{%
554 \fill (2.5,0.5) circle (0.35);
555 }
556 \newcommand*{\vexdotfour}{%
557 \fill (0.5,-0.5) circle (0.35);
558 }
559 \newcommand*{\vexdotfive}{%
560 \fill (1.5,-0.5) circle (0.35);
561 }
562 \newcommand*{\vexdotsix}{%
563 \fill (2.5,-0.5) circle (0.35);
564 }
565 \newcommand*{\vexdotseven}{%
566 \fill (0.5,1.5) circle (0.35);
567 }
568 \newcommand*{\vexdoteight}{%
569 \fill (1.5,1.5) circle (0.35);
570 }
571 \newcommand*{\vexdotnine}{%
572 \fill (2.5,1.5) circle (0.35);
573 }
574 % \end{macrocode}
575 % The \command"\vexusage" takes a whole-number argument ($0,1,\dotsc$).
576 % Numbers will be interpreted modulo 512 (e.g., if 513 is passed to this
577 % function, it will be interpreted as $513\mod{512} = 1$), which is
578 % accomplished by repeated integer division modulo~2.
579 % \begin{macrocode}
580 \NewDocumentCommand{\vexusage}{s m}{%
581 \begin{tikzpicture}[x=\vexxscale,y=\vexyscale]
582 \IfBooleanTF {#1}
583 {\vexgridextended}
584 {
585 \ifvexallextended
586 \vexgridextended
587 \else
588 \pgfmathparse{int(#2)}
589 \ifnum\pgfmathresult>63\relax
590 \vexgridextended
591 \else
592 \vexgrid
593 \fi
594 \fi
595 }
596 \pgfmathparse{int(mod(#2,2))}
597 \ifnum\pgfmathresult=1\relax
598 \vexdotone
599 \fi
600 \pgfmathparse{int(mod(div(#2,2),2))}
601 \ifnum\pgfmathresult=1\relax
602 \vexdottwo
603 \fi
604 \pgfmathparse{int(mod(div(#2,4),2))}
605 \ifnum\pgfmathresult=1\relax
606 \vexdotthree
607 \fi
608 \pgfmathparse{int(mod(div(#2,8),2))}
609 \ifnum\pgfmathresult=1\relax
610 \vexdotfour
611 \fi
612 \pgfmathparse{int(mod(div(#2,16),2))}
613 \ifnum\pgfmathresult=1\relax
614 \vexdotfive
615 \fi
616 \pgfmathparse{int(mod(div(#2,32),2))}
617 \ifnum\pgfmathresult=1\relax
618 \vexdotsix
619 \fi
620 \pgfmathparse{int(mod(div(#2,64),2))}
621 \ifnum\pgfmathresult=1\relax
622 \vexdotseven
623 \fi
624 \pgfmathparse{int(mod(div(#2,128),2))}
625 \ifnum\pgfmathresult=1\relax
626 \vexdoteight
627 \fi
628 \pgfmathparse{int(mod(div(#2,256),2))}
629 \ifnum\pgfmathresult=1\relax
630 \vexdotnine
631 \fi
632 \end{tikzpicture}}
633 % \end{macrocode}
634 % These user-facing macros are intended as arguments to the
635 % \command"\vexusage" macro. Ideally, we would bit-wise AND the argument,
636 % but because most of these do not share bits, it is sufficient to add them.
637 % \begin{macrocode}
638 \newcommand*{\vexcivilflag}{1}
639 \newcommand*{\vexstateflag}{2}
640 \newcommand*{\vexwarflag}{4}
641 \newcommand*{\vexcivilensign}{8}
642 \newcommand*{\vexstateensign}{16}
643 \newcommand*{\vexwarensign}{32}
644 \newcommand*{\vexcivilairensign}{64}
645 \newcommand*{\vexstateairensign}{128}
646 \newcommand*{\vexwarairensign}{256}
647 \newcommand*{\vexnationalflag}{7}
648 \newcommand*{\vexnationalensign}{56}
649 \newcommand*{\vexnationalflagandensign}{63}
650 \newcommand*{\vexnationaleverything}{511}
651 % \end{macrocode}
652 % These are drawn based on the images in Smith's book as well as the images
653 % on the Wikipedia.
654 % \begin{macrocode}
655 \newcommand*{\vexnormal}{%
656 \begin{tikzpicture}[x=\vexxscale,y=\vexyscale]
657 \draw (0,-0.4) -- (0,1) -- (2,1) -- (2,0) -- (0,0);
658 \end{tikzpicture}}
659 \newcommand*{\vexproposed}{%
660 \begin{tikzpicture}[x=\vexxscale,y=\vexyscale]
661 \draw (0,-0.4) -- (0,1) -- (2,1) (2,0) -- (0,0);
662 \end{tikzpicture}}
663 \newcommand*{\vexreconstruction}{%
664 \begin{tikzpicture}[x=\vexxscale,y=\vexyscale]
665 \draw (0,-0.4) -- (0,1) -- (2,1) -- (2,0) -- (0,0);
666 % \node at (1,0.5) {\resizebox{!}{0.5ex}{?}};% FIXME?
667 \fill (0.9875,0.2) circle (0.075*\vexxscale);
668 \draw [line width=0.125*\vexyscale,line cap=round]
669 (0.9875,0.381) .. controls +(0,0.25) and +(0,-0.12) .. (1.125,0.70)
670 .. controls +(0,0.09) and +(0.05,0) .. (1,0.8125)
671 .. controls +(-0.09,0) and +(0,0.065) .. (0.85,0.702);
672 \end{tikzpicture}}
673 \newcommand*{\vexreverse}{%
674 \begin{tikzpicture}[x=\vexxscale,y=\vexyscale]
675 \draw (0,-0.4) -- (0,1) -- (2,1) -- (2,0) -- (0,0);
676 \draw [-{Straight Barb[length=0.25ex,width=0.25ex]}] (1,0.5) -- (2.75,0.5);
677 \end{tikzpicture}}
678 \newcommand*{\vexvariant}{%
679 \begin{tikzpicture}[x=\vexxscale,y=\vexyscale]
680 \draw (0,-0.4) -- (0,1) -- (2,1) -- (2,0) -- (0,0);
681 \draw (-0.2,-0.5) .. controls +(-0.4,0.3) and +(-0.4,-0.3) .. (-0.2,1.1);
682 \draw (2.2,-0.5) .. controls +(0.4,0.3) and +(0.4,-0.3) .. (2.2,1.1);
683 \end{tikzpicture}}
684 \newcommand*{\vexalternative}{%
685 \begin{tikzpicture}[x=\vexxscale,y=\vexyscale]
686 %\draw[green] (0,-0.4) -- (0,1) -- (2,1) -- (2,0) -- (0,0);
687 \draw (0,-0.4) -- (0,1) -- (2,1) -- (2,0.5)
688 (0.5,0) -- (0,0);
689 \draw [xshift=0.4ex,yshift=-0.4ex]
690 (0,-0.4) -- (0,1) -- (2,1) -- (2,0) -- (0,0);
691 \end{tikzpicture}}
692 \newcommand*{\vexdefacto}{%
693 \begin{tikzpicture}[x=\vexxscale,y=\vexyscale]
694 \draw (0,-0.4) -- (0,1) -- (2,1) -- (2,0) -- (0,0);
695 \draw (0.5,-0.2) -- (1.5,1.2);
696 \end{tikzpicture}}
697 \newcommand*{\vexreverseisdifferent}{%
698 \begin{tikzpicture}[x=\vexxscale,y=\vexyscale,
699 >={Straight Barb[length=0.25ex,width=0.25ex]}]
700 \draw [->] (0,0) -- (2,0);
701 \draw [->] (1.5,0.5) -- (-0.5,0.5);
702 \draw (0.25,-0.5) -- (1.25,1);
703 \end{tikzpicture}}
704 \newcommand*{\vexsinisterhoist}{%
705 \begin{tikzpicture}[x=\vexxscale,y=\vexyscale]
706 \draw (0,0) -- (0,1) -- (2,1) -- (2,-0.4) -- (2,0) -- cycle;
707 \end{tikzpicture}}
708 \newcommand*{\vexhistorical}{%
709 \begin{tikzpicture}[x=\vexxscale,y=\vexyscale,line cap=rect]
710 \draw (0,-0.4) -- (0,1) -- (1.2,1) -- (0.6,0) -- (0,0);
711 \draw (2,-0.4) -- (2,0.7) -- (1.5,0.7) -- (0.8,-0.4) -- cycle;
712 \end{tikzpicture}}
713 \newcommand*{\vexreverseismirror}{%
714 \begin{tikzpicture}[x=\vexxscale,y=\vexyscale,line cap=rect,
715 >={Straight Barb[length=0.25ex,width=0.35ex]}]
716 \draw (2,-0.5) -- (2,1) -- (0,1) -- (0,0) -- (2,0);
717 \draw [->] (0.25,-0.125) .. controls +(0.25,-0.20) and +(-0.25,0) .. (1.75,-0.25);
718 \draw [line cap=round] (0.75,0.15) -- ++(0.25,0.35)
719 (1.25,0.15) -- (1.25,0.85)
720 -- (0.85,0.85) .. controls (0.70,0.8) and (0.70,0.6) .. (0.85,0.5)
721 -- (1.25,0.5);
722 \end{tikzpicture}}
723 \newcommand*{\vexreverseiscongruent}{%
724 \begin{tikzpicture}[x=\vexxscale,y=\vexyscale,line cap=rect,
725 >={Straight Barb[length=0.25ex,width=0.35ex]}]
726 \draw (2,-0.5) -- (2,1) -- (0,1) -- (0,0) -- (2,0);
727 \draw [->] (0.25,-0.125) .. controls +(0.25,-0.20) and +(-0.25,0) .. (1.75,-0.25);
728 \draw (1.25,0.15) -- (0.75,0.15) -- (0.75,0.85) -- (1.25,0.85)
729 (0.75,0.5) -- (1.15,0.5);
730 \end{tikzpicture}}
731 \newcommand*{\vexnormalvertical}{%
732 \begin{tikzpicture}[x=\vexxscale,y=\vexyscale,line cap=rect]
733 \draw (2.125,1.25) -- (-0.125,1.25) -- (-0.125,-0.25)
734 -- (1.125,-0.25) -- (1.125,1.25);
735 \begin{scope}
736 \clip (0.1,0.1) rectangle (0.9,0.9);
737 \draw (0.85,0.15) -- (0.15,0.15) -- (0.85,0.85) -- (0.15,0.85);
738 \end{scope}
739 \end{tikzpicture}}
740 \newcommand*{\vexobversevertical}{%
741 \begin{tikzpicture}[x=\vexxscale,y=\vexyscale,line cap=rect]
742 \draw (-0.125,1.25) -- (-0.125,-0.25)
743 -- (1.125,-0.25) -- (1.125,1.25) -- (-1.125,1.25);
744 \begin{scope}
745 \clip (0.1,0.1) rectangle (0.9,0.9);
746 \draw (0.85,0.15) -- (0.15,0.15) -- (0.85,0.85) -- (0.15,0.85);
747 \end{scope}
748 \end{tikzpicture}}
749 \newcommand*{\vexrotatevertical}{%
750 \begin{tikzpicture}[x=\vexxscale,y=\vexyscale,line cap=rect]
751 \draw (2.125,1.25) -- (-0.125,1.25) -- (-0.125,-0.25)
752 -- (1.125,-0.25) -- (1.125,1.25);
753 \draw [line cap=round] (0.20,0.1) -- (0.20,0.9) -- (0.75,0.9)
754 .. controls (0.90,0.7625) and (0.90,0.5875) .. (0.75,0.5) -- (0.20,0.5)
755 (0.55,0.5) -- (0.82,0.1);
756 \end{tikzpicture}}
757 \newcommand*{\vexunknownvertical}{%
758 \begin{tikzpicture}[x=\vexxscale,y=\vexyscale,line cap=rect]
759 \draw (2.125,1.25) -- (-0.125,1.25) -- (-0.125,-0.25)
760 -- (1.125,-0.25) -- (1.125,1.25);
761 % \node at (0.5,0.5) {\resizebox{!}{0.5ex}{?}};% FIXME?
762 \fill (0.49375,0.2) circle (0.075*\vexxscale);
763 \draw [line width=0.125*\vexyscale,line cap=round]
764 (0.49375,0.381) .. controls +(0,0.25) and +(0,-0.12) .. (0.64125,0.70)
765 .. controls +(0,0.09) and +(0.05,0) .. (0.50625,0.8125)
766 .. controls +(-0.09,0) and +(0,0.065) .. (0.35625,0.702);
767 \end{tikzpicture}}
768 \newcommand*{\vexnorotating}{%
769 \begin{tikzpicture}[x=\vexxscale,y=\vexyscale,line cap=rect]
770 %\draw (2,1) -- (0,1) -- (0,0) -- (1,0) -- (1,1);
771 \draw (2.125,1.25) -- (-0.125,1.25) -- (-0.125,-0.25)
772 -- (1.125,-0.25) -- (1.125,1.25);
773 \end{tikzpicture}}
774 \newcommand*{\vexunauthorized}{%
775 \begin{tikzpicture}[x=\vexxscale,y=\vexyscale]
776 \draw (0,-0.4) -- (0,1) -- (2,1) -- (2,0) -- (0,0);
777 \draw (0.5,-0.2) -- (1.5,1.2);
778 \draw (1.5,-0.2) -- (0.5,1.2);
779 \end{tikzpicture}}
780 \newcommand*{\vexonlyvertical}{%
781 \begin{tikzpicture}[x=\vexxscale,y=\vexyscale]
782 \draw (0,0) rectangle (1.5,1.5);
783 \draw (0.75,0) -- ++(0,-0.4);
784 \draw (0.75,1.5) -- ++(0,0.2);
785 \end{tikzpicture}}
786 \newcommand*{\vexauthorized}{%
787 \begin{tikzpicture}[x=\vexxscale,y=\vexyscale]
788 \draw (0,0) circle (0.75);
789 \draw (0,0) ellipse (0.25 and 0.375);
790 \end{tikzpicture}}
791 % \end{macrocode}
792 % \iffalse
793 %</package>
794 % \fi
795 %
796 % \Finale
797 \endinput