Debian Codegraph @

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

raw
1 % \iffalse
2 %
3 % Copyright 2008-2023, Boris Veytsman
4 % This work may be distributed and/or modified under the
5 % conditions of the LaTeX Project Public License, either
6 % version 1.3 of this license or (at your option) any
7 % later version.
8 % The latest version of the license is in
9 % http://www.latex-project.org/lppl.txt
10 % and version 1.3 or later is part of all distributions of
11 % LaTeX version 2005/12/01 or later.
12 %
13 % This work has the LPPL maintenance status `maintained'.
14 %
15 % The Current Maintainer of this work is Boris Veytsman,
16 % <[email protected]>
17 %
18 % This work consists of the file nostarch.dtx and the
19 % derived file nostarch.cls
20 %
21 % \fi
22 % \CheckSum{0}
23 %
24 %
25 %% \CharacterTable
26 %% {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
27 %% 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
28 %% Digits \0\1\2\3\4\5\6\7\8\9
29 %% Exclamation \! Double quote \" Hash (number) \#
30 %% Dollar \$ Percent \% Ampersand \&
31 %% Acute accent \' Left paren \( Right paren \)
32 %% Asterisk \* Plus \+ Comma \,
33 %% Minus \- Point \. Solidus \/
34 %% Colon \: Semicolon \; Less than \<
35 %% Equals \= Greater than \> Question mark \?
36 %% Commercial at \@ Left bracket \[ Backslash \\
37 %% Right bracket \] Circumflex \^ Underscore \_
38 %% Grave accent \` Left brace \{ Vertical bar \|
39 %% Right brace \} Tilde \~}
40 %
41 %\iffalse
42 % Taken from xkeyval.dtx
43 %\fi
44 %\makeatletter
45 %\def\DescribeOption#1{\leavevmode\@bsphack
46 % \marginpar{\raggedleft\PrintDescribeOption{#1}}%
47 % \SpecialOptionIndex{#1}\@esphack\ignorespaces}
48 %\def\PrintDescribeOption#1{\strut\emph{option}\\\MacroFont #1\ }
49 %\def\SpecialOptionIndex#1{\@bsphack
50 % \index{#1\actualchar{\protect\ttfamily#1}
51 % (option)\encapchar usage}%
52 % \index{options:\levelchar#1\actualchar{\protect\ttfamily#1}\encapchar
53 % usage}\@esphack}
54 %\def\DescribeOptions#1{\leavevmode\@bsphack
55 % \marginpar{\raggedleft\strut\emph{options}%
56 % \@for\@tempa:=#1\do{%
57 % \\\strut\MacroFont\@tempa\SpecialOptionIndex\@tempa
58 % }}\@esphack\ignorespaces}
59 %\makeatother
60 %
61 % \MakeShortVerb{|}
62 % \GetFileInfo{nostarch.dtx}
63 % \newcommand{\progname}[1]{\textsf{#1}}
64 % \title{\LaTeX{} Style For \emph{No Starch Press}
65 % \thanks{\copyright 2008--2023, Boris Veytsman}}
66 % \author{Boris Veytsman\thanks{%
67 % \href{mailto:[email protected]}{\texttt{[email protected]}},
68 % \href{mailto:[email protected]}{\texttt{[email protected]}}}}
69 % \date{\filedate, \fileversion}
70 % \maketitle
71 % \begin{abstract}
72 % This package provides class for typesetting books for No Starch
73 % Press, \url{http://www.nostarch.com}
74 % \end{abstract}
75 % \tableofcontents
76 %
77 % \clearpage
78 %
79 % \changes{v0.1}{2008/02/27}{First fully functional version}
80 % \changes{v0.5}{2008/03/19}{Documentation update}
81 % \changes{v0.6}{2008/03/21}{Documentation update}
82 % \changes{v1.0}{2008/04/07}{First public release}
83 % \changes{v1.1}{2008/05/24}{Added interface to listings package and
84 % upquote package. Updated documentation}
85 % \changes{v1.4}{2020/04/29}{Updated interface with listings package}
86 % \changes{v2.0}{2023/03/30}{Incorporated in-house changes by No
87 % Starch Press}
88 %
89 %
90 %\section{Introduction}
91 %\label{sec:intro}
92 %
93 % This is the ``official'' \LaTeX{} style for \emph{No Starch Press,}
94 % \url{http://www.nostarch.com}. The class is intended to typeset
95 % books for this publisher---both hard copies and electronic books.
96 %
97 % The suite provides main class, |nostarch.cls|, hyperref interface
98 % |nshyper.sty| and MakeIndex style |nostarch.ist|.
99 %
100 % The initial version of this class was written in 2008. Since then a
101 % number of changes was made for in-house processing by the \emph{No
102 % Starch} team, with special thanks to Alex Freed. In 2023 these
103 % changes were incorporated back to the publicly released version.
104 %
105 %\section{User's Guide}
106 %\label{sec:manual}
107 %
108 %
109 %\subsection{Installation}
110 %\label{sec:installation}
111 %
112 % The installation of the class follows the usual
113 % practice~\cite{TeXFAQ} for \LaTeX{} packages:
114 % \begin{enumerate}
115 % \item Run \progname{latex} on |nostarch.ins|. This will produce the
116 % following files:
117 % \LaTeX{} class |nostarch.cls|, \LaTeX{} style |nshyper.sty| and
118 % MakeIndex style |nostarch.ist|.
119 % \item Put the files |nostarch.cls|, |nshypher.sty| and
120 % |nostarch.ist| to
121 % the places where \LaTeX{} and MakeIndex can find them (see
122 % \cite{TeXFAQ} or the documentation for your \TeX{}
123 % system).\label{item:install}
124 % \item Update the database of file names. Again, see \cite{TeXFAQ}
125 % or the documentation for your \TeX{} system for the system-specific
126 % details.\label{item:update}
127 % \item The file |nostarch.pdf| provides the documentation for the
128 % package (this is the file you are probably reading now).
129 % \end{enumerate}
130 % As an alternative to items~\ref{item:install} and~\ref{item:update}
131 % you can just put the files in the working directory where your
132 % |.tex| file is.
133 %
134 % To typeset the books in the distinctive \emph{No Starch Press} style
135 % you will need the fonts used by them. Unfortunately these fonts
136 % (New Baskerville, Futura, The Sans Mono Condensed and Dogma) are not
137 % free. You have the following options:
138 % \begin{enumerate}
139 % \item Typeset your book using only free fonts (the option |nocfonts|
140 % discussed below).
141 % \item Buy the fonts and install them.
142 % \item Arrange with \emph{No Starch Press} for the use of these fonts
143 % for your book.
144 % \end{enumerate}
145 % The details of the installation are discussed below in
146 % Section~\ref{sec:ug_fonts}.
147 %
148 %
149 %
150 %\subsection{Fonts installation}
151 %\label{sec:ug_fonts}
152 %
153 % If you wish to try \progname{nostarch} class without bothering to
154 % typeset camera-ready copy, you may use the option |nocfonts| for
155 % \emph{no commercial fonts,} and the class will use only the free
156 % fonts available in \TeX\ distributions.
157 %
158 % If you work with \emph{No Starch Press} on your book, you might be
159 % provided with the fonts. Today \emph{No Starch Press} typically
160 % uses \progname{xelatex} and expects the fonts in True~Type format.
161 % If this is the case, use the option |cfonts|. \emph{No Starch
162 % Press} recommends the authors to put the font files in the
163 % subdirectory \path{fonts} of their main directory. This is where
164 % \progname{nostarch} expects them. This is also the layout of
165 % directories in the \emph{No Starch Press} \emph{Overleaf}
166 % templates. However, if you prefer to put the fonts in another
167 % directory, searcheable by \progname{xelatex}, use the option
168 % |nofontsdir| in the invocation.
169 %
170 % These options are summarized in Figure~\ref{fig:fonts}.
171 %
172 % \begin{figure}
173 % \centering
174 % \begin{tikzpicture}
175 % \node[draw, circle, radius=0.1] (start) {};
176 % \node[draw, align=center, below=of start]
177 % (haveFonts) {Do you have \\commercial fonts?};
178 % \node[draw, left=of haveFonts, align=center] (nocfonts)
179 % {Use |nocfonts|\\ option};
180 % \node[draw, below=of nocfonts, rounded corners]
181 % (any) {Use any engine};
182 % \node[draw, right=of haveFonts, align=center] (cfonts)
183 % {Use |cfonts|\\option};
184 % \node[draw, below=of cfonts, align=center] (haveSubdir) {Are the fonts
185 % \\in |fonts| \\subdirectory?};
186 % \node[draw, left=of haveSubdir, align=center]
187 % (nofontsdir) {Use |nofontsdir|\\option};
188 % \node[draw, below=of haveSubdir, align=center] (fontsdir)
189 % {Use |fontsdir|\\option};
190 % \node[draw, below=of fontsdir, rounded corners] (xelatex)
191 % {Use \progname{xelatex} engine};
192 % \draw[-latex] (start) -- (haveFonts);
193 % \draw[-latex] (haveFonts) -- node[above] {No} (nocfonts);
194 % \draw[-latex] (haveFonts) -- node[above] {Yes} (cfonts);
195 % \draw[-latex] (nocfonts) -- (any);
196 % \draw[-latex] (cfonts) -- (haveSubdir);
197 % \draw[-latex] (haveSubdir) -- node[above] {No} (nofontsdir);
198 % \draw[-latex] (haveSubdir) -- node[right] {Yes} (fontsdir);
199 % \draw[-latex] (nofontsdir) |- (xelatex);
200 % \draw[-latex] (fontsdir) -- (xelatex);
201 % \end{tikzpicture}
202 % \caption{Flowchart for font-related options}
203 % \label{fig:fonts}
204 % \end{figure}
205 %
206 %
207 %\subsection{Invocation}
208 %\label{sec:invocation}
209 %
210 % To use the class, put in the preamble of your document
211 % \begin{flushleft}
212 % |\documentclass[|\meta{options}|]{nostarch}|
213 % \end{flushleft}
214 %
215 % \DescribeOptions{cfonts,nocfonts}%
216 % As discussed above, \emph{No Starch Press} uses a number of
217 % commercial fonts to typeset their books.
218 % The option |cfonts| (default) tells \LaTeX{} that you do have these
219 % commercial fonts. On the other hand, the option |nocfonts| instructs
220 % \LaTeX{}
221 % to use freely available fonts for typesetting. Of course in this
222 % case the result will not look like a \emph{No Starch Press} Book.
223 %
224 % \DescribeOptions{fontsdir,nofontsdir}%
225 % If you use commercial fonts \emph{and} \progname{xelatex}, the
226 % latter usually expects them in the subdirectory \path{fonts} of the
227 % main directory (see Section~\ref{sec:ug_fonts}). The options
228 % |fontsdir| (default) sets up this behavior. Use the option
229 % |nofontsdir| to tell \progname{xelatex} to search standard font
230 % directories insted.
231 %
232 % Figure~\ref{fig:fonts} may help to choose the right options.
233 %
234 %
235 %\subsection{Use of \progname{hyperref} Package}
236 %\label{sec:guide:hyperref}
237 %
238 % The books typeset by \emph{No Starch Press} can be sold either as
239 % traditional printed and bound hard copies, or as PDF files. If you,
240 % the author, envisage the second possibility, you may want additional
241 % possibilites provided by \progname{hyperref}
242 % package~\cite{Rahtz06:Hyperref}, like ``clickable'' entries in the
243 % table of context and index, etc. The provided package |nshyper.sty|
244 % adds the functionality of \progname{hyperref} to the class. This
245 % package is highly recommended for the books that are going to be
246 % distributed in an electronic form.
247 %
248 % To use the package, just add the line |\uspackage{nshyper}| to your
249 % preamble. This package should be loaded last since it redefines
250 % internals of many other packages. Note that a direct call of
251 % \progname{hyperref} by |\usepackage{hyperref}| will not work since
252 % \progname{nshyper} patches hyperref to work with our class.
253 %
254 %
255 %
256 %\subsection{Front Matter}
257 %\label{sec:guide:frontmatter}
258 %
259 % \DescribeMacro{\frontmatter}
260 % A book can be divided into three parts: front matter, main matter
261 % and back matter. Front matter starts with the command
262 % |\frontmatter|. Normally this is the first command in the class.
263 % Front matter contains half page, title page, copyright page, brief
264 % contents, detailed contents, foreword(s) and other stuff which is
265 % traditionally typeset on roman-numbered pages. The commands in main
266 % matter can be divides into \emph{declarations} and
267 % \emph{directives.} Declarations do not typeset anything. Rather,
268 % they up parameters for the typesetting. Directives use them to
269 % typeset the stuff.
270 %
271 %
272 %\subsubsection{Front Matter Declarations}
273 %\label{sec:guide:decls}
274 %
275 %
276 %
277 % \DescribeMacro{\title}
278 % There are five declarations defined by |nostarch.cls|: |\title|,
279 % |\subtitle|,
280 % |\author|, |\nostarchlogo| and |\nostarchlocation|. The macro
281 % |\title|, like the standard \LaTeX{} |\title|, sets the title of the
282 % book, for example |\title|\texttt{\{The book about everything\}}.
283 %
284 % \DescribeMacro{\subtitle}
285 % The macro |\subtitle| takes one argument and sets up the subtitle of
286 % your book, for example |\subtitle|\texttt{\{A Guide For
287 % Perplexed\}}.
288 %
289 % \DescribeMacro{\author}
290 % The command |\author| has just one argument, which is the list of
291 % authors, separated by commas and (for the last author) the word
292 % ``and''. Do not use the command |\and| defined in the standard
293 % \LaTeX. For example,
294 % |\author|\texttt{\{Ralph Alpher, Hans Bethe and George Gamow\}}.
295 %
296 % \DescribeMacro{\nostarchlogo}
297 % Due to copyright reasons the logo of \emph{No Starch Press} is not
298 % distribuded with the package. You should get the logo as a graphics
299 % file from the publishers and put in the directory where \LaTeX{} can
300 % find it (for example, the directory with the other sources of your
301 % book). The command |\nostarchlogo| has one argument: the name of
302 % the file, for example, |\nostarchlogo{biglogo.pdf}|.
303 % The file will be automatically scaled to the proper size.
304 %
305 % \DescribeMacro{\nostarchlocation}
306 % \emph{No Starch Press} books are usually published in San
307 % Francisco. If you need to change this setting, use
308 % |\nostarchlocation| declaration, for example,
309 % |\nostarchlocation|\texttt{\{San Francisco; London; Tokyo\}}.
310 %
311 %
312 %
313 %\subsubsection{Front Matter Directives}
314 %\label{sec:guide:directives}
315 %
316 %
317 %
318 % \DescribeMacro{\makehalftitle}
319 % The command |\makehalftitle| creates \emph{half title page.}
320 % This is normally the first page of the book.
321 %
322 % \DescribeMacro{\maketitle}
323 % The command |\maketitle| creates \emph{title page.} It uses logo
324 % and full title of the book.
325 %
326 % \DescribeMacro{copyrightpage}
327 % The copyright page is the \emph{verso} of the title page. It has
328 % information about copyright, edition history, the credits of the
329 % people who helped you to make the book, CIP information, etc. The
330 % exact contents of the copyright page differ from book to book.
331 % Therefore the class does not try to create this page automatically,
332 % and rather sets up the typographic style for arbitrary contents.
333 % For this purpose the environment |copyrigthtpage| is used. So just
334 % put the information provided by the publisher between
335 % |\begin{copyrightpage}| and |\end{copyrightpage}|. Use
336 % |\textbf{\sffamily title}| for the title of the book on the
337 % copyright line.
338 %
339 % \DescribeMacro{cipblock}
340 % One of important parts of the copyright page is \emph{CIP block.}
341 % It contains catalogue data for your book (CIP means Cataloguing in
342 % Publication, by the way). Again, the contents of this field will be
343 % provied by the publishers; you just need to put them inside
344 % |cipblock| environment, i.e. between |\begin{cipblock}| and
345 % |\end{cipblock}|. To make your life easier, this block is typeset
346 % verbatim, so line ends and spaces are typeset as is.
347 %
348 %
349 % \DescribeMacro{dedicationpage}
350 % Dedications, if any, are included in the special dedication page,
351 % for which a special environment |dedicationpage| is provided.
352 %
353 % \DescribeMacro{\brieftableofcontents}
354 % \DescribeMacro{\tableofcontents}
355 % The standard \LaTeX{} provides just one table of contents. This
356 % class uses two tables: brief contents and contents in detail. They
357 % are correspondingly typeset by the commands |\brieftableofcontents|
358 % and |\tableofcontents|.
359 %
360 %
361 % \DescribeMacro{\sectionnumberwidth}
362 % \DescribeMacro{\subsectionnumberwidth}
363 % In most books by \emph{No Starch Press} sections and subsections are
364 % unnumbered. However, sometimes the books use numbered sections or
365 % subsections. In these cases you may want to adjust the widths left
366 % for section and subsection numbers in the detailed table of
367 % contents. They are set by
368 % |\sectionnumberwidth| and |\subsectionnumberwidth|, and can be
369 % changed with the usual |\setlength| command.
370 %
371 %
372 % Forewords and similar front matter materials are unnumbered
373 % chapters: |\chapter*[Foreword by R. E.~Viewer]{Foreword}|.
374 %
375 %
376 % Front matter with its formal parts like copyright page, CIP
377 % information, etc., can be daunting, especially for novice authors.
378 % Feel free to use the sample enclosed and ask the publisher for
379 % advice.
380 %
381 %\subsection{Main Matter}
382 %\label{sec:guide:mainmatter}
383 %
384 % \DescribeMacro{\mainmatter}
385 % The command |\mainmatter| finishes the front matter and starts the
386 % main matter of the book. The main matter is divided into chapters,
387 % sections, subsections, etc. They are discussed below.
388 %
389 %
390 %\subsubsection{Parts, Chapters and Sections}
391 %\label{sec:guide:sections}
392 %
393 % \DescribeMacro{\chapter}
394 % \DescribeMacro{\section}
395 % \DescribeMacro{\subsection}
396 % \DescribeMacro{\subsubsection}
397 % \emph{No Starch Press} books have chapters, sections, subsections and
398 % subsubsections. The chapters are usually numbered, but sections ande
399 % below are not. The commands for them are the same as in the
400 % standard \LaTeX: |\chapter|\oarg{short title}\marg{long title},
401 % |\section|\oarg{short title}\marg{long title}, etc. For
402 % example:
403 % \begin{verbatim}
404 % \section[Building Lego Fire Track]{How To Build A Lego Fire Track
405 % And Why It Is Fun}
406 % \end{verbatim}
407 % The ``starred'' forms |\chapter*|, |\section*| etc. are used when
408 % the corresponding division has no number (like unnumbered chapters in
409 % the front matter). Since our sections, subsections and
410 % subsusbsections are unnumbered anyway, this form has meaning only
411 % for chapters (but can be used for other divisions as well).
412 %
413 % \DescribeMacro{\chapterart}
414 % \DescribeMacro{\chapterartfile}
415 % \emph{No Starch Press} books use ``circular art'' for chapter
416 % openings (except for unnumbered chapters in the front matter). The
417 % command |\chapterart| should be issued immediately
418 % after |\chapter| command and before the first paragraph. Its
419 % argument is the artwork used for the current chapter:
420 % |\chapterart|\marg{\LaTeX{} commands}. In the
421 % simplest case it is just inclusion of an external graphics file, for
422 % example:
423 % \begin{verbatim}
424 % \chapterart{\includegraphics[width=1.264in]{firetrack.jpg}}
425 % \end{verbatim}
426 % Actually, this simplest case is so ubiquitous, that there is a
427 % special command |\chapterartfile|\marg{filename} for it, so the
428 % previous example can be simplified as
429 % \begin{verbatim}
430 % \chapterartfile{firetrack.jpg}
431 % \end{verbatim}
432 % However, you can use instead any \LaTeX{} commands to produce
433 % the artwork. Rememer that it must be $1.264''\times1.222''$.
434 %
435 % The first paragraph after chapter start is typeset in larger size
436 % font than the body font. If this paragraph is too long, you may
437 % need to manually change the font size back in the middle of it. The
438 % simplest way to do this is the combination
439 % |\par\noindent\normalfont| in a strategic place.
440 %
441 %
442 % \DescribeMacro{\part}
443 % Sometimes larger books are separated into parts. The command
444 % |\part|\marg{Title} is used to typeset parts.
445 %
446 %\subsubsection{Environments}
447 %\label{sec:guide:lists}
448 %
449 %
450 % \DescribeMacro{itemize}
451 % \DescribeMacro{enumerate}
452 % \DescribeMacro{description}
453 % \DescribeMacro{aside}
454 % \DescribeMacro{note}
455 % \DescribeMacro{warning}
456 % The class offers standard |itemize|, |enumerate| and |description|
457 % environment. There are also special environments reserverd for
458 % asides. The |aside| environment has a mandatory argument: aside
459 % name. It typesets its contents in italics with the name in bold on
460 % the marginh:
461 % \begin{verbatim}
462 % \begin{aside}{Reminder}
463 % Do not forget to plug off the computer before doing any
464 % modifications!
465 % \end{aside}
466 % \end{verbatim}
467 % The environments |note| and |warning| are similar, but have
468 % pre-defined names NOTE and WARNING, e.g
469 % \begin{verbatim}
470 % \begin{note}
471 % Do not forget to plug off the computer before doing any
472 % modifications!
473 % \end{note}
474 % \begin{warning}
475 % Do not forget to plug off the computer before doing any
476 % modifications!
477 % \end{warning}
478 % \end{verbatim}
479 %
480 %
481 %\subsubsection{Tables and Figures}
482 %\label{sec:guide:floats}
483 %
484 % There are several things to keep in mind when using tables and
485 % figures with the class.
486 %
487 % The tables and figures are not centered. Neither are their
488 % captions. The captions for figures go \emph{below} the figures, the
489 % captions for tables go \emph{above} the tabular data.
490 %
491 % \DescribeMacro{\NextCaptionWidth}%
492 % The captions of tables and figures are automatically typeset with
493 % the same width as the table or figure. Sometimes, however, \LaTeX\
494 % makes a mistake in the calculation. In this case the macro
495 % \cs{NextCaptionWidth}\marg{length} overrides this calculation and
496 % sets the width of the caption for the next figure or table to
497 % \marg{length}, for example
498 % \begin{verbatim}
499 % \NextCaptionWidth{2in}
500 % \begin{figure}
501 % ...
502 % \caption{...}
503 % \end{figure}
504 % \end{verbatim}
505 %
506 %
507 % Typesetting tables, unfortunately, is rarely done right, and
508 % standard \LaTeX{} is not an exception. The authors are urged to
509 % read the introduction to \progname{booktabs}
510 % package~\cite{Fear05:Booktabs}. To summarize,
511 % \begin{enumerate}
512 % \item Never ever use vertical rules.
513 % \item Never ever use double rules.
514 % \item Use only |\toprule|, |\midrule| and |\bottomrule| for tables.
515 % \end{enumerate}
516 % \DescribeMacro{\tbfont}
517 % \DescribeMacro{\thfont}
518 % \DescribeMacro{tabular}
519 % \emph{No Starch Press} uses special fonts for table body and table
520 % header. Since there are too many tabular-like environments
521 % (|tabular|, |tabbing|, |longtable|, \dots) we do not redefine them
522 % switch on these fonts automatically, but rather provide two font
523 % switching commands. The command |\tbfont| should be used
524 % \emph{before} tabular environment, and the command |\thfont| should
525 % be used in all header cells. Also, usually the table entries are
526 % flushed left, so you might want to put |@{}| before the first column
527 % declaration in |\begin{tabular}| to suppress the padding on the
528 % left. Here is an example of a properly
529 % done table layout:
530 % \begin{verbatim}
531 % \begin{table}
532 % \caption{Starch Content of Foods}
533 % \label{tab:starch}
534 % \tbfont
535 % \begin{tabular}{@{}lr}
536 % \toprule
537 % \thfont Product & \thfont Starch Content, \% \\
538 % \midrule
539 % Bran (wheat) & 23.0\\
540 % Brown rice (raw) & 80.0\\
541 % Brown bread (average) & 41.3\\
542 % White bread (average) & 46.7\\
543 % \bottomrule
544 % \end{tabular}
545 % \end{table}
546 % \end{verbatim}
547 %
548 %
549 %
550 %\subsubsection{Code Fragments}
551 %\label{sec:guide:code}
552 %
553 % The class provides two facilities for including code fragments in
554 % the books.
555 %
556 % \DescribeMacro{Code}
557 % For short unformatted code fragments the \progname{fancyvrb}
558 % package~\cite{VanZandt98:Fancyvrb} facilities are recommended. This
559 % package is automatically automatically loaded by the class. Long code
560 % fragments should be
561 % separated by rules; the class defines verbatim-like |Code|
562 % environment, which does exactly this:
563 % \begin{verbatim}
564 % \begin{Code}
565 % main() {
566 % printf("Hello, World\n");
567 % }
568 % \end{Code}
569 % \end{verbatim}
570 % See the documentation of~\cite{VanZandt98:Fancyvrb} about many
571 % features of this package.
572 %
573 % For longer code fragments the \progname{listings}
574 % package~\cite{Heinz07:Listings} is more appropriate. It is also
575 % automatically loaded. This package provides a number of useful
576 % features, well describe in its manual. We will briefly mention
577 % several of them, which might be of interest for the authors of
578 % \emph{No Starch Press}:
579 % \begin{enumerate}
580 % \item Automatic code formatting according to the rules of the chosen
581 % program language (for example, |\lstset{language=C}| or
582 % |\lstset{language=Lisp}|).
583 % \item A rich set of different frames: ruled code with
584 % |frame=lines|, boxed code with |frame=single| etc.
585 % \item An option to add captions to the listings (the class
586 % automatically formats the captions according to the style of
587 % \emph{No Starch Press}).
588 % \item An option to make a listing floating.
589 % \item An option to automatically number code lines.
590 % \item An option to add list of listings (with the command
591 % |\lstlistoflistings|).
592 % \end{enumerate}
593 %
594 % To make the code in |\verb| commands and |verbatim|-like
595 % environments be typeset with the \progname{listings} package, you
596 % may want to set |fancyvrb=true| in the preamble of your document.
597 %
598 % It should be noted that the authors are recommended \emph{not} to
599 % use |\texttt| or |\tt| for inline code fragments. The proper way to
600 % add inline code is |\verb| or |\lstinline| from the
601 % \progname{listings} package. The difference is obvious, for
602 % example, in quote characters.
603 %
604 %
605 %\subsection{Boxes}
606 %\label{sec:ug_boxes}
607 %
608 % \DescribeEnv{nspbox}%
609 % You may put some information into \emph{boxes}. Boxes have a \emph{heading}
610 % and a \emph{text}. The environment |nspbox| can be used to typeset
611 % them, for example:
612 % \begin{verbatim}
613 % \begin{nspbox}{This is a heading}
614 % This is a text for the box.
615 % \end{nspbox}
616 % \end{verbatim}
617 %
618 %\subsection{Back Matter}
619 %\label{sec:guide:backmatter}
620 %
621 % \DescribeMacro{\backmatter}
622 % Back matter includes bibliography, index, update page, colophon and
623 % other material. It starts with the command |\backmatter|.
624 %
625 %
626 %
627 %\subsubsection{Bibliography}
628 %\label{sec:guide:bibliography}
629 %
630 % \emph{No Starch Press} at present has no special style for
631 % bibliography, so the authors have a relative freedom to choose one.
632 % However, it would be a good idea to use the \progname{natbib}
633 % package~\cite{Daly07:Natbib}. This class should work with
634 % \progname{natbib}.
635 %
636 % No support for per chapter bibliography lists is provided by the
637 % package.
638 %
639 %
640 %\subsubsection{Index}
641 %\label{sec:guide:index}
642 %
643 % The books published by \emph{No Starch Press} usually have index.
644 % This package provides special style file |nostarch.ist| for index
645 % formatting.
646 %
647 %
648 % \DescribeMacro{\makeindex}
649 % \DescribeMacro{\printindex}
650 % To create index:
651 % \begin{enumerate}
652 %
653 % \item Put in the preamble of your
654 % document the command |\makeindex|.
655 % \item In the body of your document use |\index| commands as
656 % described in~\cite{Lamport94}.
657 % \item Put in the Back Matter the command |\printindex| at the place
658 % you want the index to be printed.
659 % \item After a \progname{latex} run \progname{makeindex} with the
660 % style |nostarch.ist|. In a Unix system the corresponding command is
661 % \begin{verbatim}
662 % makeindex -s nostarch.ist mydocument
663 % \end{verbatim}
664 % or, in a more verbose way
665 % \begin{verbatim}
666 % makeindex -s nostarch.ist -o mydocument.ind mydocument.idx
667 % \end{verbatim}
668 % (here we assume that your main file is |mydocument.tex|).
669 %
670 % Refer to the documentation of your \TeX{} system for the way to run
671 % \progname{makeindex} on your computer.
672 % \end{enumerate}
673 %
674 %
675 %\subsubsection{Updates and Colophon}
676 %\label{sec:guide:updates}
677 %
678 % \DescribeMacro{\updatespage}
679 % \emph{No Starch Press} books usually have updates page, which lists
680 % the Web address for updates, errata, etc. The command
681 % |\updatespage| starts such page. You are free to choose any text
682 % there. Note that if you use the package
683 % \progname{nshypher}~\ref{sec:guide:hyperref}, then the command
684 % |\url|\marg{URL} becomes a hyperlink in the electronic edition.
685 %
686 %
687 % \DescribeMacro{\colophon}
688 % The last part of Back Matter is usually a \emph{colophon} which
689 % describes how the book was printed and typeset. The command
690 % |\colophon| starts this part and prints some standard information
691 % about your fonts and \LaTeX{} package. You may want to add some
692 % information after this command.
693 %
694 %
695 % \StopEventually{%
696 % \clearpage
697 % \bibliography{nostarch}
698 % \bibliographystyle{unsrt}}
699 %
700 % \clearpage
701 %
702 %
703 %\section{Implementation}
704 %\label{sec:impl}
705 %
706 %\subsection{Identification}
707 %\label{sec:ident}
708 %
709 % We start with the declaration who we are. Most |.dtx| files put
710 % driver code in a separate driver file |.drv|. We roll this code into the
711 % main file, and use the pseudo-guard |<gobble>| for it.
712 % \begin{macrocode}
713 %<class>\NeedsTeXFormat{LaTeX2e}
714 %<*gobble>
715 \ProvidesFile{nostarch.dtx}
716 %</gobble>
717 %<class>\ProvidesClass{nostarch}
718 %<nshyper>\ProvidesPackage{nshyper}
719 %<*!ist>
720 [2023/07/19 v2.4 Typesetting books for No Starch Press]
721 %</!ist>
722 % \end{macrocode}
723 %
724 % And the driver code:
725 % \begin{macrocode}
726 %<*gobble>
727 \documentclass{ltxdoc}
728 \usepackage{array}
729 \usepackage{url,amsfonts, tikz}
730 \usepackage[breaklinks,colorlinks,linkcolor=black,citecolor=black,
731 pagecolor=black,urlcolor=black,hyperindex=false]{hyperref}
732 \usetikzlibrary{positioning}
733 \PageIndex
734 \CodelineIndex
735 \RecordChanges
736 \EnableCrossrefs
737 \begin{document}
738 \DocInput{nostarch.dtx}
739 \end{document}
740 %</gobble>
741 %<*class>
742 % \end{macrocode}
743 %
744 %
745 %\subsection{Options}
746 %\label{sec:options}
747 %
748 %\begin{macro}{\ifnostarch@cfonts}
749 % First, let us decide whether we have non-free fonts:
750 % \begin{macrocode}
751 \newif\ifnostarch@cfonts
752 \nostarch@cfontstrue
753 \DeclareOption{cfonts}{\nostarch@cfontstrue}
754 \DeclareOption{nocfonts}{\nostarch@cfontsfalse}
755 % \end{macrocode}
756 % \end{macro}
757 %
758 % \begin{macro}{\ifnostarch@fontsdir}
759 % \changes{v2.0}{2023/03/31}{Introduced macro}
760 % We also need to check whether we want to use \emph{No Starch} in
761 % house |fonts| directory
762 % \begin{macrocode}
763 \newif\ifnostarch@fontsdir
764 \nostarch@fontsdirtrue
765 \DeclareOption{fontsdir}{\nostarch@fontsdirtrue}
766 \DeclareOption{nofontsdir}{\nostarch@fontsdirfalse}
767 % \end{macrocode}
768 % \end{macro}
769 %
770 % The size-changing options produce a warning:
771 % \begin{macrocode}
772 \long\def\nostarch@size@warning#1{%
773 \ClassWarning{nostarch}{Size-changing option #1 will not be
774 honored}}%
775 \DeclareOption{8pt}{\nostarch@size@warning{\CurrentOption}}%
776 \DeclareOption{9pt}{\nostarch@size@warning{\CurrentOption}}%
777 \DeclareOption{10pt}{\nostarch@size@warning{\CurrentOption}}%
778 \DeclareOption{11pt}{\nostarch@size@warning{\CurrentOption}}%
779 \DeclareOption{12pt}{\nostarch@size@warning{\CurrentOption}}%
780 % \end{macrocode}
781 %
782 %
783 %
784 % All other options are passed to \progname{book}:
785 % \begin{macrocode}
786 \DeclareOption*{\PassOptionsToClass{\CurrentOption}{book}}
787 % \end{macrocode}
788 %
789 % Now we read the configuration file
790 % \begin{macrocode}
791 \InputIfFileExists{nostarch.cfg}{%
792 \ClassInfo{nostarch}{%
793 Loading configuration file nostarch.cfg}}{%
794 \ClassInfo{nostarch}{%
795 Configuration file nostarch.cfg is not found}}
796 % \end{macrocode}
797 % And process the options:
798 % \begin{macrocode}
799 \ProcessOptions\relax
800 % \end{macrocode}
801 %
802 %
803 %
804 %
805 %
806 %\subsection{Loading Class and Packages}
807 %\label{sec:loading}
808 %
809 % We start with the base class
810 % \begin{macrocode}
811 \LoadClass[10pt]{book}
812 % \end{macrocode}
813 %
814 % A bunch of packages:
815 % \begin{macrocode}
816 \RequirePackage[table]{xcolor}
817 \RequirePackage{iftex, ifpdf, longtable,
818 fancyhdr, fancyvrb, booktabs, graphicx,
819 listings, caption, makeidx, upquote, pifont,
820 textcomp, xcolor, lmodern, nameref, float, amssymb, etoolbox,
821 setspace, marginnote, url, subfigure}
822 \RequirePackage[framemethod=TikZ]{mdframed}
823 \RequirePackage{soul}
824 \RequirePackage[T1]{fontenc}
825 \RequirePackage{ragged2e}
826 % \end{macrocode}
827 %
828 % We do not want the option |document| with \progname{ragged2e}: this
829 % calls \progname{footmisc}, while we want our own footnotes:
830 % \begin{macrocode}
831 \RequirePackage{ragged2e}
832 \setlength\RaggedRightParindent{\parindent}
833 \RaggedRight
834 % \end{macrocode}
835 %
836 %
837 % \begin{macro}{\@nschapterpreamble}
838 % This is the preamble to bibliography and index commands used when
839 % \progname{nshyper} is loaded. Normally it is empty.
840 % \begin{macrocode}
841 \def\@nschapterpreamble{}
842 % \end{macrocode}
843 %
844 % \end{macro}
845 %
846 %
847 %\subsection{Fonts}
848 %\label{sec:fonts}
849 %
850 % \begin{macro}{\nostarch@fontspath}
851 % \changes{v2.0}{2023/03/31}{Introduced macro}
852 % The path to load fonts
853 % \begin{macrocode}
854 \ifnostarch@fontsdir
855 \def\nostarch@fontspath#1{Path=fonts/#1/,}
856 \else
857 \def\nostarch@fontspath#1{Path,}
858 \fi
859 % \end{macrocode}
860 % \end{macro}
861 %
862 % If we have commercial fonts, we load them.
863 % \begin{macrocode}
864 \ifnostarch@cfonts
865 \ifpdftex
866 \ClassWarning{nostarch}{Commercial fonts usually require xelatex engine}
867 \RequirePackage{nbaskerv}%
868 \RequirePackage{futurans}%
869 \RequirePackage[scaled=0.85]{thsmc}%
870 \RequirePackage{dogma}%
871 \newcommand{\dogma}{\fontfamily{fdg}\selectfont}%
872 \else %XeTeX or LuaTeX
873 \RequirePackage{fontspec}
874 \newfontface\dogma[
875 \nostarch@fontspath{dogma}
876 UprightFont=dogmab01.ttf,
877 Ligatures=TeX
878 ]{dogma} % Font used for chapter titles
879
880 \newfontface\timesnewroman[
881 \nostarch@fontspath{tnr}
882 UprightFont=times.ttf,
883 BoldFont=timesbd.ttf,
884 ItalicFont=timesi.ttf,
885 BoldItalicFont=timesbi.ttf,
886 Ligatures=TeX
887 ]{timesnewroman}
888
889 \newfontface\futurabook[
890 \nostarch@fontspath{futurans}
891 UprightFont=FuturB37.ttf,
892 BoldFont=FuturH79.ttf,
893 ItalicFont=FutuBO08.ttf,
894 BoldItalicFont=FutCBO63.ttf,
895 Ligatures=TeX
896 ]{futurabook}
897
898 \newfontface\futuraheavy[
899 \nostarch@fontspath{futurans}
900 UprightFont=FuturH79.ttf,
901 Ligatures=TeX
902 ]{futuraheavy}
903
904 \newfontface\futuraboldc[
905 \nostarch@fontspath{futurans}
906 UprightFont=futucb18.ttf,
907 Ligatures=TeX
908 ]{futuraboldc}
909
910 \newfontface\futuraboldcoblique[
911 \nostarch@fontspath{futurans}
912 UprightFont=FutCBO63.ttf,
913 Ligatures=TeX
914 ]{futuraboldcoblique}
915
916 \newfontface\futuraoblique[
917 \nostarch@fontspath{futurans}
918 UprightFont=FutuBO08.ttf,
919 Ligatures=TeX
920 ]{futuraoblique}
921
922 \setmainfont{nbaskerv}[
923 \nostarch@fontspath{nbaskerv}
924 UprightFont=NewBaskervilleEF-Roman.ttf,
925 BoldFont=NewBaskervilleEF-Bold.ttf,
926 ItalicFont=NewBaskervilleEF-RomanIta.ttf,
927 BoldItalicFont=NewBaskervilleEF-BoldIta.ttf,
928 Ligatures=TeX]
929
930 \setmonofont[Scale=0.85,
931 \nostarch@fontspath{thsmc}
932 UprightFont=ThSMCP25.ttf,
933 BoldFont=ThSMCB02.ttf,
934 ItalicFont=ThSMCI29.ttf,
935 BoldItalicFont=TSMCBI56.ttf]{thsmc}
936
937 \setsansfont[
938 \nostarch@fontspath{futurans}
939 UprightFont=futura.ttf,
940 BoldFont=FuturB41.ttf,
941 ItalicFont=FutuBO08.ttf,
942 BoldItalicFont=FutCBO63.ttf,
943 Ligatures=TeX
944 ]{futurans}
945
946 \fi
947 % \end{macrocode}
948 % Otherwise we just use sans serif font for dogma.
949 % \begin{macrocode}
950 \else
951 \newcommand{\dgdefault}{\sfdefault}%
952 \fi
953 % \end{macrocode}
954 %
955 % A number of commands to provide font defaults in case we use
956 % non-commercial fonts
957 % \begin{macrocode}
958 \providecommand{\dogma}{\fontfamily{dgdefault}\selectfont}
959 \providecommand{\futuraboldc}{\fontfamily{\sfdefault}\fontseries{bc}%
960 \selectfont}
961 \providecommand{\futuraboldcoblique}{\fontfamily{\sfdefault}\fontseries{bc}%
962 \itshape\selectfont}
963 \providecommand{\futuraheavy}{\fontfamily{\sfdefault}\fontseries{hq}%
964 \selectfont}
965 \providecommand{\futurabook}{\fontfamily{\sfdefault}\fontseries{k}%
966 \selectfont}
967 % \end{macrocode}
968 %
969 % And switch to normal size---just in case
970 % \begin{macrocode}
971 \normalsize
972 % \end{macrocode}
973 %
974 % Special commands for number balls
975 % \begin{macro}{\wingding}
976 % \changes{v2.0}{2023/03/31}{Introduced macro}
977 % The number ball
978 % \begin{macrocode}
979 \newcommand{\wingding}[1]{\ding{\the\numexpr #1 + 181 \relax}}
980 % \end{macrocode}
981 % \end{macro}
982 % \begin{macro}{\codewingding}
983 % \changes{v2.0}{2023/03/31}{Introduced macro}
984 % The number ball inside code
985 % \begin{macrocode}
986 \newcommand{\codewingding}[1]{\vbox{\llap{\wingding{#1}\hskip 0.5em}}}
987 % \end{macrocode}
988 % \end{macro}
989 %
990 % \begin{macro}{\menuarrow}
991 % \changes{v2.0}{2023/04/08}{Introduced macro}
992 % \begin{macrocode}
993 \newcommand\menuarrow{\raisebox{.2ex}{\small $\blacktriangleright$}}
994 % \end{macrocode}
995 % \end{macro}
996 % \begin{macro}{\bettertilde}
997 % \changes{v2.0}{2023/04/04}{Introduced macro}
998 % A tilde uses for some texts
999 % \begin{macrocode}
1000 \newcommand{\bettertilde}{\raisebox{-1ex}{\textasciitilde}}
1001 % \end{macrocode}
1002 % \end{macro}
1003 %
1004 % \begin{macro}{\slashslash}
1005 % \changes{v2.0}{2023/04/04}{Introduced macro}
1006 % The special slash
1007 % \begin{macrocode}
1008 \newcommand{\slashslash}{%
1009 \raisebox{.53ex}{%
1010 \scalebox{.5}{%
1011 \rotatebox[origin=c]{18}{$\mathbf{/}$}%
1012 }%
1013 }%
1014 }
1015 % \end{macrocode}
1016 % \end{macro}
1017 %
1018 % \begin{macro}{\neq}
1019 % \changes{v2.0}{2023/04/04}{Introduced macro}
1020 % A better $\neq$
1021 % \begin{macrocode}
1022 \renewcommand{\neq}{\mathrel
1023 {%
1024 \vphantom{=}%
1025 \ooalign{\kern.05em\smash{\slashslash}\hidewidth\cr$=$\cr}%
1026 }%
1027 }
1028
1029 % \end{macrocode}
1030 % \end{macro}
1031 %
1032 % \begin{macro}{\keycap}
1033 % Taken from:
1034 % \url{https://tex.stackexchange.com/questions/55664/fake-small-caps-with-xetex-fontspec/225078}
1035 % \begin{macrocode}
1036 \newcommand\keycap[1]{\fauxschelper#1 \relax\relax}
1037 \def\fauxschelper#1 #2\relax{%
1038 \fauxschelphelp#1\relax\relax%
1039 \if\relax#2\relax\else\ \fauxschelper#2\relax\fi%
1040 }
1041 \def\Hscale{.83}\def\Vscale{.72}\def\Cscale{1.00}
1042 \def\fauxschelphelp#1#2\relax{%
1043 \ifnum`#1>``\ifnum`#1<`\{\scalebox{\Hscale}[\Vscale]{\uppercase{#1}}\else%
1044 \scalebox{\Cscale}[1]{#1}\fi\else\scalebox{\Cscale}[1]{#1}\fi%
1045 \ifx\relax#2\relax\else\fauxschelphelp#2\relax\fi}
1046 % \end{macrocode}
1047 % \end{macro}
1048 %
1049 %\subsection{Page Dimensions and Paragraphing}
1050 %\label{sec:page}
1051 %
1052 % \begin{macro}{\paperheight}
1053 % \begin{macro}{\paperwidth}
1054 % The trim size:
1055 % \begin{macrocode}
1056 \setlength{\paperheight}{9.25in}
1057 \setlength{\paperwidth}{7in}
1058 % \end{macrocode}
1059 % \end{macro}
1060 % \end{macro}
1061 % \begin{macro}{\pdfpaperheight}
1062 % \begin{macro}{\pdfpaperwidth}
1063 % \begin{macro}{\pdfvorigin}
1064 % \begin{macro}{\pdfhorigin}
1065 % If we deal with \progname{pdftex}, we can use this information more
1066 % creatively. This was inspired by
1067 % \progname{memoir}~\cite{Wilson04:Memoir}.
1068 % \begin{macrocode}
1069 \ifpdf\relax
1070 \pdfpageheight=\paperheight
1071 \pdfpagewidth=\paperwidth
1072 \pdfvorigin=1in
1073 \pdfhorigin=1in
1074 \fi
1075 % \end{macrocode}
1076 % \end{macro}
1077 % \end{macro}
1078 % \end{macro}
1079 % \end{macro}
1080 %
1081 % \begin{macro}{\topmargin}
1082 % \changes{v0.2}{2008/03/03}{Moved down}
1083 % \changes{v0.7}{2008/04/04}{Changed dimensions}
1084 % \changes{v1.1}{2008/05/24}{Made shorter}
1085 % The top margin is 0.625''. We use fake headers of 12pt:
1086 % \begin{macrocode}
1087 \setlength\topmargin{0.625in}
1088 \addtolength\topmargin{-1in}
1089 \addtolength\topmargin{-12pt}
1090 % \end{macrocode}
1091 % \end{macro}
1092 % \begin{macro}{\textheight}
1093 % This is the height of the text including footnotes, but excluding
1094 % running head and foot.
1095 % \begin{macrocode}
1096 \setlength\textheight{8in}
1097 \addtolength{\textheight}{-0.207in}
1098 % \end{macrocode}
1099 % Now we take care of the first line height:
1100 % \begin{macrocode}
1101 \addtolength\textheight{\topskip}
1102 % \end{macrocode}
1103 % \end{macro}
1104 %
1105 % \begin{macro}{\evensidemargin}
1106 % \begin{macro}{\oddsidemargin}
1107 % The margins on even and odd pages are 0.687''+0.833'' (margin par
1108 % width) + 0.167'' (margin par gap):
1109 % \begin{macrocode}
1110 \setlength\evensidemargin{0.687in}
1111 \addtolength{\evensidemargin}{-1in}
1112 \addtolength{\evensidemargin}{0.833in}
1113 \addtolength{\evensidemargin}{0.167in}
1114 \setlength\oddsidemargin{\evensidemargin}
1115 % \end{macrocode}
1116 % \end{macro}
1117 % \end{macro}
1118 % \begin{macro}{\textwidth}
1119 % The type area is 5.625'', but this includes side gap:
1120 % \begin{macrocode}
1121 \setlength\textwidth{5.625in}
1122 \addtolength\textwidth{-0.833in}
1123 \addtolength\textwidth{-0.167in}
1124 % \end{macrocode}
1125 % \end{macro}
1126 %
1127 % \begin{macro}{\parindent}
1128 % The paragraph indentation is 0.25'':
1129 % \begin{macrocode}
1130 \setlength\parindent{0.25in}
1131 % \end{macrocode}
1132 % \end{macro}
1133 %
1134 %
1135 %
1136 % \begin{macro}{\headheight}
1137 % \begin{macro}{\headsep}
1138 % We do not have headers in these books. Fancyhdr sets |headheight|
1139 % to 12pt, so we compensate it above in |\topmargin|
1140 % \begin{macrocode}
1141 \setlength\headheight{12pt}
1142 \setlength\headsep{0pt}
1143 % \end{macrocode}
1144 % \end{macro}
1145 % \end{macro}
1146 %
1147 % \begin{macro}{\footskip}
1148 % The footer is 8.792'' from top
1149 % \begin{macrocode}
1150 \setlength{\footskip}{9in}
1151 \addtolength{\footskip}{-\textheight}
1152 \addtolength{\footskip}{0.067in}
1153 \addtolength{\footskip}{\baselineskip}
1154 \addtolength{\footskip}{-1in}
1155 % \end{macrocode}
1156 % \end{macro}
1157 %
1158 % \begin{macro}{\widowpenalty}
1159 % \begin{macro}{\clubpenalty}
1160 % \changes{v0.3}{2008/03/11}{Changed settings}
1161 % We forbid widows and clubs. To prevent too extended pages we use
1162 % |\raggedbottom|:
1163 % \begin{macrocode}
1164 \widowpenalty=10000
1165 \clubpenalty=10000
1166 \raggedbottom
1167 % \end{macrocode}
1168 %
1169 % \end{macro}
1170 % \end{macro}
1171 %
1172 % \begin{macro}{\sochapter}
1173 % \changes{v2.0}{2023/04/04}{Introduced macro}
1174 % \begin{macro}{\sotitle}
1175 % \changes{v2.0}{2023/04/04}{Introduced macro}
1176 % \begin{macro}{\sobox}
1177 % \changes{v2.0}{2023/04/04}{Introduced macro}
1178 % \begin{macro}{\sonote}
1179 % \changes{v2.0}{2023/04/04}{Introduced macro}
1180 % Some spacing commands.
1181 % \begin{macrocode}
1182 \sodef\sochapter{}{.150em}{.5em}{1em}
1183 \sodef\sotitle{}{.125em}{.5em}{1em}
1184 \sodef\sobox{}{.075em}{.5em}{1em}
1185 \sodef\sonote{}{.200em}{.5em}{1em}
1186 % \end{macrocode}
1187 % \end{macro}
1188 % \end{macro}
1189 % \end{macro}
1190 % \end{macro}
1191 %
1192 %\subsection{Headers and Footers}
1193 %\label{sec:headers}
1194 %
1195 %
1196 % \begin{macro}{\headrulewidth}
1197 % \begin{macro}{\footrulewidth}
1198 % We do not want decorative rules:
1199 % \begin{macrocode}
1200 \renewcommand{\headrulewidth}{0pt}
1201 \renewcommand{\footrulewidth}{0pt}
1202 % \end{macrocode}
1203 % \end{macro}
1204 % \end{macro}
1205 %
1206 %
1207 % We do not have headers:
1208 % \begin{macrocode}
1209 \pagestyle{fancy}
1210 \lhead{}
1211 \rhead{}
1212 \chead{}
1213 % \end{macrocode}
1214 %
1215 % The right footer is stuck 0.833''+0.167'' = 1'' to the right
1216 % \begin{macrocode}
1217 \fancyhfoffset[L]{1in}
1218 % \end{macrocode}
1219 %
1220 % On even pages we put page number and chapter title in footer.
1221 % \begin{macrocode}
1222 \fancyfoot[RO]{\sffamily \fontsize{6pt}{6pt}%
1223 \fontseries{lq}\selectfont\rightmark%
1224 \hspace{2em} \futuraboldc \fontsize{9pt}{6pt}\selectfont\thepage}
1225 \fancyfoot[LO]{}
1226 \fancyfoot[CO]{}
1227 % \end{macrocode}
1228 %
1229 % On even pages we put page number and chapter number in footer:
1230 % \begin{macrocode}
1231 \fancyfoot[LE]{\futuraboldc \fontsize{9pt}{6pt}%
1232 \selectfont\thepage%
1233 \fontseries{lq}\sffamily \fontsize{6pt}{6pt}\selectfont%
1234 \hspace{2em}\leftmark}
1235 \fancyfoot[RE]{}
1236 \fancyfoot[CE]{}
1237 % \end{macrocode}
1238 %
1239 %
1240 %\subsection{Front Matter}
1241 %\label{sec:frontmatter}
1242 %
1243 %
1244 % \begin{macro}{\subtitle}
1245 % \changes{v0.5}{2008/03/19}{Introduced the macro}
1246 % We use subtitle of the book\dots
1247 % \begin{macrocode}
1248 \newcommand{\subtitle}[1]{\gdef\@subtitle{#1}}
1249 % \end{macrocode}
1250 % \end{macro}
1251 % \begin{macro}{\@subtitle}
1252 % \changes{v0.5}{2008/03/19}{Introduced the macro}
1253 % \dots With empty default:
1254 % \begin{macrocode}
1255 \def\@subtitle{}
1256 % \end{macrocode}
1257 % \end{macro}
1258 %
1259 % \begin{macro}{\nostarchlogo}
1260 % \changes{v0.5}{2008/03/19}{Introduced the macro}
1261 % The logotype of the publisher:
1262 % \begin{macrocode}
1263 \newcommand{\nostarchlogo}[1]{\gdef\@nostarchlogo{#1}}
1264 % \end{macrocode}
1265 % \end{macro}
1266 % \begin{macro}{\@nostarchlogo}
1267 % \changes{v0.5}{2008/03/19}{Introduced the macro}
1268 % The default it empty:
1269 % \begin{macrocode}
1270 \def\@nostarchlogo{}
1271 % \end{macrocode}
1272 % \end{macro}
1273 % \begin{macro}{\nostarchlocation}
1274 % \changes{v0.5}{2008/03/19}{Introduced the macro}
1275 % Similarly for location:
1276 % \begin{macrocode}
1277 \newcommand{\nostarchlocation}[1]{\gdef\@nostarchlocation{#1}}
1278 % \end{macrocode}
1279 % \end{macro}
1280 % \begin{macro}{\@nostarchlocation}
1281 % \changes{v0.5}{2008/03/19}{Introduced the macro}
1282 % The default is SF:
1283 % \begin{macrocode}
1284 \def\@nostarchlocation{San Francisco}
1285 % \end{macrocode}
1286 % \end{macro}
1287 %
1288 %
1289 % \begin{macro}{\makehalftitle}
1290 % \changes{v0.5}{2008/03/19}{Introduced the macro}
1291 % \changes{v0.7}{2008/04/04}{Changed dimensions}
1292 % Now we are ready to typeset the half title page. It is flushed
1293 % right, cannot be to the left of the page center and must be 0.25''
1294 % indented from the right:
1295 % \begin{macrocode}
1296 \def\makehalftitle{%
1297 \clearpage
1298 {\pagestyle{empty}\cleardoublepage}%
1299 \thispagestyle{empty}%
1300 \null%\vskip1.025in%
1301 \leavevmode\noindent\hspace{1.66in}%
1302 \begin{minipage}[t]{2.5625in}%
1303 \flushright
1304 \sffamily\bfseries\fontsize{12\p@}{13\p@}\selectfont
1305 \MakeUppercase{\@title}%
1306 \end{minipage}}
1307 % \end{macrocode}
1308 % \end{macro}
1309 %
1310 %
1311 % \begin{macro}{maketitle}
1312 % \changes{v0.5}{2008/03/19}{Changed LaTeX default}
1313 % \changes{v0.7}{2008/04/04}{Changed dimensions}
1314 % Now the main title page:
1315 % \begin{macrocode}
1316 \def\maketitle{%
1317 \bgroup
1318 \clearpage
1319 {\pagestyle{empty}\cleardoublepage}%
1320 \thispagestyle{empty}%
1321 \bgroup
1322 \list{}{\leftmargin-1in\rightmargin\z@\labelwidth\z@%
1323 \labelsep\z@\listparindent\z@\parsep\z@\itemsep\z@%
1324 \topsep\z@\partopsep\z@}%
1325 \item\relax
1326 \centering
1327 \null\vskip0.855in%
1328 {\dogma \fontsize{36\p@}{37\p@}\selectfont
1329 \MakeUppercase{\sotitle{\@title}}\par}%
1330 \if\@subtitle\@empty\relax\else
1331 {\null\vskip25\p@%
1332 \dogma \fontsize{24\p@}{25\p@}\selectfont
1333 \@subtitle\par}%
1334 \fi
1335 \vspace{2.15in}%
1336 \vspace{-\baselineskip}%
1337 {\futuraheavy\fontsize{18\p@}{22\p@}\selectfont
1338 by \@author\par}%
1339 \vspace{12\p@}%
1340 \vspace{\baselineskip}%
1341 \if\@nostarchlogo\@empty\relax\else
1342 \includegraphics[height=1.08in]{\@nostarchlogo}\par
1343 \fi
1344 \vspace{12\p@}%
1345 \normalfont\@nostarchlocation\par
1346 \endlist
1347 \egroup
1348 \clearpage\egroup}
1349 % \end{macrocode}
1350 % \end{macro}
1351 %
1352 % \begin{macro}{copyrightpage}
1353 % \changes{v0.5}{2008/03/19}{Introduced the macro}
1354 % This is the page copyright data:
1355 % \begin{macrocode}
1356 \newenvironment{copyrightpage}{%
1357 \clearpage
1358 \bgroup
1359 \list{}{\leftmargin-1in\rightmargin\z@\labelwidth\z@%
1360 \labelsep\z@\listparindent\z@\parsep8\p@\itemsep\z@%
1361 \topsep\z@\partopsep\z@}%
1362 \item\relax
1363 \thispagestyle{empty}%
1364 \normalfont\fontsize{8\p@}{10\p@}\selectfont}{%
1365 \endlist
1366 \egroup
1367 \clearpage}
1368 % \end{macrocode}
1369 % \end{macro}
1370 %
1371 % \begin{macro}{cipblock}
1372 % \changes{v0.5}{2008/03/19}{Introduced the macro}
1373 % CIP block is supposed to be in typewriter font. So we use
1374 % verbatim:
1375 % \begin{macrocode}
1376 \newenvironment{cipblock}{%
1377 \leavevmode\par\normalfont\fontsize{8\p@}{10\p@}\selectfont
1378 \textit{Library of Congress Cataloging-in-Publication Data}\par%
1379 \ttfamily\@vobeyspaces\obeylines
1380 \parindent\z@\parfillskip\@flushglue\parskip\z@skip}{\par\vskip8pt\relax}
1381 % \end{macrocode}
1382 % \end{macro}
1383 %
1384 %
1385 % \begin{macro}{dedicationpage}
1386 % \changes{v0.5}{2008/03/19}{Introduced the macro}
1387 % \changes{v2.0}{2023/04/04}{Rewritten}
1388 % Dedication is centered:
1389 % \begin{macrocode}
1390 \newenvironment{dedicationpage}{%
1391 \clearpage
1392 \bgroup
1393 \list{}{\leftmargin-1in\rightmargin\z@\labelwidth\z@%
1394 \labelsep\z@\listparindent\z@\parsep8\p@\itemsep\z@%
1395 \topsep\z@\partopsep\z@}%
1396 \item\relax
1397 \thispagestyle{empty}%
1398 \null\vskip1.175in%
1399 \centering\normalfont}{%
1400 \endlist
1401 \egroup
1402 \clearpage}
1403 % \end{macrocode}
1404 % \end{macro}
1405 %
1406 %
1407 %\subsection{Tables of Contents}
1408 %\label{sec:toc}
1409 %
1410 % Standard \LaTeX{} has just one table of contents. We have two. The
1411 % table of brief contents will have the extension |tbc|, while the
1412 % standard table of contents will have the standard extension |toc|.
1413 %
1414 % \begin{macro}{\briefcontentsname}
1415 % The name for brief contents
1416 % \begin{macrocode}
1417 \def\briefcontentsname{{Brief Contents}}
1418 % \end{macrocode}
1419 %
1420 % \end{macro}
1421 %
1422 % \begin{macro}{\contentsname}
1423 % Same with |\contentsname|
1424 % \begin{macrocode}
1425 \def\contentsname{Contents in Detail}%
1426 % \end{macrocode}
1427 % Special treatment if \progname{babel} is used:
1428 % \begin{macrocode}
1429 \AtBeginDocument{\@ifpackageloaded{babel}{%
1430 \addto\captionsenglish{%
1431 \renewcommand{\contentsname}%
1432 {Contents in Detail}}}{}}
1433 % \end{macrocode}
1434 %
1435 % \end{macro}
1436 %
1437 % \begin{macro}{\apptoc}
1438 % \changes{v2.0}{2023/04/14}{Added macro}
1439 % Changing chapter names in appendix
1440 % \begin{macrocode}
1441 \newcommand{\apptoc}{\renewcommand{\chaptername}{Appendix}}
1442 % \end{macrocode}
1443 % \end{macro}
1444 %
1445 % \begin{macro}{\brieftableofcontents}
1446 % \changes{v0.5}{2008/03/19}{Introduced macro}
1447 % \changes{v0.7}{2008/04/04}{Changed dimensions}
1448 % \changes{v0.8}{2008/04/07}{Changed dimensions}
1449 % \changes{v1.1}{2008/05/24}{Added toc name to the verso footers}
1450 % This is the new macro:
1451 % \begin{macrocode}
1452 \newcommand\brieftableofcontents{%
1453 \clearpage
1454 {\pagestyle{empty}\cleardoublepage}%
1455 \bgroup
1456 \thispagestyle{empty}%
1457 \markboth{\briefcontentsname}{\briefcontentsname}%
1458 \null\vskip0.925in%
1459 \list{}{\leftmargin-1.0in\rightmargin0.4in\labelwidth\z@%
1460 \labelsep\z@\listparindent\z@\parsep\z@\itemsep\z@%
1461 \topsep\z@\partopsep\z@}%
1462 \item\relax
1463 {\centering
1464 \dogma\fontsize{16\p@}{18\p@}\selectfont
1465 \MakeUppercase{\sochapter{Brief Contents}}\par}\vskip40pt%
1466 \@starttoc{tbc}%
1467 \endlist
1468 \egroup}
1469 % \end{macrocode}
1470 %
1471 % \end{macro}
1472 % \begin{macro}{\tableofcontents}
1473 % \changes{v0.5}{2008/03/19}{Changed LaTeX default}
1474 % \changes{v0.7}{2008/04/04}{Changed dimensions}
1475 % \changes{v0.8}{2008/04/07}{Changed dimensions}
1476 % \changes{v1.1}{2008/05/24}{Added toc name to the verso footers}
1477 % \changes{v1.2}{2008/06/01}{Added toc name to the verso footers}
1478 % This is the new macro:
1479 % \begin{macrocode}
1480 \renewcommand\tableofcontents{%
1481 \clearpage
1482 {\pagestyle{empty}\cleardoublepage}%
1483 \bgroup
1484 \thispagestyle{empty}%
1485 \markboth{\contentsname}{\contentsname}%
1486 \null\vskip0.175in%
1487 \list{}{\leftmargin-1.0in\rightmargin0.6in\labelwidth\z@%
1488 \labelsep\z@\listparindent\z@\parsep\z@\itemsep\z@%
1489 \topsep\z@\partopsep\z@}%
1490 \item\relax
1491 {\centering
1492 \dogma\fontsize{16\p@}{18\p@}\selectfont
1493 \MakeUppercase{\sochapter{Contents in Detail}}\par}\vskip18pt%
1494 \@starttoc{toc}%
1495 \endlist
1496 \egroup}
1497 % \end{macrocode}
1498 % \end{macro}
1499 %
1500 % \begin{macro}{\@dotsep}
1501 % \changes{v0.7}{2008/04/04}{Changed LaTeX default}
1502 % \changes{v0.8}{2008/04/07}{Tightened dots}
1503 % Standard \LaTeX{} provides 4.5 for the distance between dots. We
1504 % will make this tighter:
1505 % \begin{macrocode}
1506 \renewcommand\@dotsep{1.5}
1507 % \end{macrocode}
1508 %
1509 % \end{macro}
1510 %
1511 % \begin{macro}{\l@part}
1512 % \changes{v0.5}{2008/03/19}{Changed LaTeX default}
1513 % This is how we typeset parts in the table of contents
1514 % \begin{macrocode}
1515 \renewcommand*\l@part[2]{%
1516 \ifnum \c@tocdepth >-2\relax
1517 \addpenalty{-\@highpenalty}%
1518 \addvspace{28\p@}%
1519 \begingroup
1520 \parindent \z@ \rightskip \@pnumwidth
1521 \parfillskip -\@pnumwidth
1522 {\leavevmode
1523 \sffamily\bfseries\fontsize{12\p@}{14\p@}\selectfont
1524 #1}\par
1525 \nobreak
1526 \global\@nobreaktrue
1527 \everypar{\global\@nobreakfalse\everypar{}}%
1528 \endgroup
1529 \fi}
1530 % \end{macrocode}
1531 % \end{macro}
1532 % \begin{macro}{\l@chapter}
1533 % \changes{v0.5}{2008/03/19}{Changed LaTeX default}
1534 % This is how we typeset chapters in the table of contents
1535 % \begin{macrocode}
1536 \renewcommand*\l@chapter[2]{%
1537 \ifnum \c@tocdepth >\m@ne
1538 \addpenalty{-\@highpenalty}%
1539 \vskip 20\p@
1540 \setlength\@tempdima{1.5em}%
1541 \begingroup
1542 \parindent \z@ \rightskip \@pnumwidth
1543 \parfillskip -\@pnumwidth
1544 \leavevmode
1545 \sffamily \bfseries \fontsize{10\p@}{12\p@}\selectfont{#1}%
1546 \nobreak\hfil \nobreak\hb@xt@\@pnumwidth{\hss #2}\par
1547 \vskip4\p@\penalty\@highpenalty
1548 \endgroup
1549 \fi}
1550 % \end{macrocode}
1551 % \end{macro}
1552 %
1553 % \begin{macro}{\sectionnumberwidth}
1554 % \changes{v1.3}{2008/06/06}{Introduced the length}
1555 % The number width for sections. Normally the width of |99.99|
1556 % \begin{macrocode}
1557 \newlength{\sectionnumberwidth}
1558 \settowidth{\sectionnumberwidth}{%
1559 \futurabook\fontsize{9\p@}{11\p@}\selectfont
1560 99.99}
1561 % \end{macrocode}
1562 % \end{macro}
1563 % \begin{macro}{\boldsectionnumberwidth}
1564 % \changes{v2.0}{2023/04/06}{Introduced the length}
1565 % The number width for bold sections. Normally the width of |99.99|
1566 % \begin{macrocode}
1567 \newlength{\boldsectionnumberwidth}
1568 \settowidth{\boldsectionnumberwidth}{%
1569 \futuraheavy\fontsize{9\p@}{11\p@}\selectfont
1570 99.99}
1571 % \end{macrocode}
1572 % \end{macro}
1573 % \begin{macro}{\subsectionnumberwidth}
1574 % \changes{v1.3}{2008/06/06}{Introduced the length}
1575 % The number width for subsections. Normally the width of
1576 % |99.99.99|
1577 % \begin{macrocode}
1578 \newlength{\subsectionnumberwidth}
1579 \settowidth{\subsectionnumberwidth}{%
1580 \futurabook\fontsize{9\p@}{11\p@}\selectfont
1581 99.99.99}
1582 % \end{macrocode}
1583 % \end{macro}
1584 %
1585 % \begin{macro}{\l@section}
1586 % \changes{v0.5}{2008/03/19}{Changed LaTeX default}
1587 % \changes{v1.3}{2008/06/06}{Made number width user settable}
1588 % This is how we typeset sections in the table of contents
1589 % \begin{macrocode}
1590 \renewcommand{\l@section}[2]{\@dottedtocline{1}{\z@}{%
1591 \sectionnumberwidth}{%
1592 \futurabook\fontsize{9\p@}{11\p@}\selectfont#1}{%
1593 \futurabook\fontsize{9\p@}{11\p@}\selectfont#2}}
1594 % \end{macrocode}
1595 % \end{macro}
1596 %
1597 % \begin{macro}{\l@subsection}
1598 % \changes{v0.5}{2008/03/19}{Changed LaTeX default}
1599 % \changes{v1.1}{2008/05/24}{Changed numwidth}
1600 % \changes{v1.2}{2008/06/01}{Changed numwidth again}
1601 % \changes{v1.3}{2008/06/06}{Made number width user settable}
1602 % This is how we typeset subsections in the table of contents
1603 % \begin{macrocode}
1604 \renewcommand{\l@subsection}[2]{\@dottedtocline{2}{0.5in}%
1605 {\subsectionnumberwidth}{%
1606 \futurabook\fontsize{9\p@}{11\p@}\selectfont#1}{%
1607 \futurabook\fontsize{9\p@}{11\p@}\selectfont#2}}
1608 % \end{macrocode}
1609 % \end{macro}
1610 %
1611 % \begin{macro}{\l@boldsection}
1612 % \changes{v2.0}{2023/04/06}{Introduced the macro}
1613 % This is how we typeset bold sections in the table of contents
1614 % \begin{macrocode}
1615 \newcommand*\l@boldsection[2]{{\bfseries\@dottedtocline{1}{\z@}{%
1616 \boldsectionnumberwidth}{%
1617 \futuraheavy\fontsize{9\p@}{11\p@}\selectfont#1}{%
1618 \futuraheavy\fontsize{9\p@}{11\p@}\selectfont#2}}}
1619 % \end{macrocode}
1620 % \end{macro}
1621 %
1622 %
1623 % \begin{macro}{\l@bpart}
1624 % \changes{v0.6}{2008/03/21}{Introduced macro}
1625 % There is a special formatting of parts in the brief table of
1626 % contents:
1627 % \begin{macrocode}
1628 \newcommand*\l@bpart[2]{%
1629 \ifnum \c@tocdepth >-2\relax
1630 \addpenalty{-\@highpenalty}%
1631 \addvspace{14\p@}%
1632 \begingroup
1633 \parindent \z@ \rightskip \@pnumwidth
1634 \parfillskip -\@pnumwidth
1635 {\leavevmode
1636 \futuraheavy\fontsize{9\p@}{14\p@}\selectfont
1637 #1}\par\vskip7\p@%
1638 \nobreak
1639 \global\@nobreaktrue
1640 \everypar{\global\@nobreakfalse\everypar{}}%
1641 \endgroup
1642 \fi}
1643 % \end{macrocode}
1644 % \end{macro}
1645 %
1646 % \begin{macro}{\@pnumwidth}
1647 % \changes{v2.0}{2023/04/08}{Redefined macro}
1648 % \begin{macrocode}
1649 \renewcommand{\@pnumwidth}{17pt}
1650 % \end{macrocode}
1651 % \end{macro}
1652 %
1653 % \begin{macro}{\l@bchapter}
1654 % \changes{v0.6}{2008/03/21}{Introduced macro}
1655 % There is a special formatting of chapters in the brief table of
1656 % contents:
1657 % \begin{macrocode}
1658 \newcommand*\l@bchapter[2]{%
1659 \ifnum \c@tocdepth >\m@ne
1660 \addpenalty{-\@highpenalty}%
1661 \setlength\@tempdima{1.5em}%
1662 \begingroup
1663 \parindent \z@ \rightskip \@pnumwidth
1664 \parfillskip -\@pnumwidth
1665 \leavevmode
1666 \futurabook\fontsize{9\p@}{14\p@}\selectfont
1667 #1\nobreak\leaders\hbox{$\m@th
1668 \mkern \@dotsep mu\hbox{.}\mkern \@dotsep
1669 mu$}\hfill
1670 \nobreak\hb@xt@\@pnumwidth{\hss #2}\par
1671 \penalty\@highpenalty
1672 \endgroup
1673 \fi}
1674 % \end{macrocode}
1675 % \end{macro}
1676 %
1677 %
1678 %\subsection{Main Matter}
1679 %\label{sec:mainmatter}
1680 %
1681 % \begin{macro}{\mainmatter}
1682 % \changes{v0.6}{2008/03/19}{Changed LaTeX default}
1683 % We redefine |\mainmatter| to take care of that blank verso
1684 % page\dots
1685 % \begin{macrocode}
1686 \renewcommand\mainmatter{%
1687 \clearpage
1688 {\thispagestyle{empty}\cleardoublepage}%
1689 \@mainmattertrue
1690 \pagenumbering{arabic}}
1691 % \end{macrocode}
1692 % \end{macro}
1693 %
1694 %
1695 %\subsection{Back Matter}
1696 %\label{sec:backmatter}
1697 %
1698 % \begin{macro}{\backmatter}
1699 % \changes{v0.6}{2008/03/21}{Changed LaTeX default}
1700 % We redefine |\backmatter| to take care of that blank verso
1701 % page\dots
1702 % \begin{macrocode}
1703 \renewcommand\backmatter{%
1704 \clearpage
1705 {\thispagestyle{empty}\cleardoublepage}%
1706 \@mainmatterfalse}
1707 % \end{macrocode}
1708 % \end{macro}
1709 %
1710 %
1711 %\subsection{Sectioning}
1712 %\label{sec:sectioning}
1713 %
1714 % We do not number sections and below:
1715 % \begin{macrocode}
1716 \setcounter{secnumdepth}{0}
1717 % \end{macrocode}
1718 %
1719 % \begin{macro}{\sectionmark}
1720 % Our section commands do not mark:
1721 % \begin{macrocode}
1722 \def\sectionmark#1{}%
1723 % \end{macrocode}
1724 % \end{macro}
1725 %
1726 %
1727 % Chapters, unlike the ones in~\cite{classes}, have \emph{two} obligatory
1728 % arguments. The second argument is the command to fill the ``circular
1729 % graphics''. Otherwise we follow the design in~\cite{classes}. One
1730 % problem, however: we \emph{cannot} use |\secdef| because we have
1731 % three arguments, not two.
1732 %
1733 %
1734 % \begin{macro}{\if@firstpara}
1735 % We introduce a macro to get special typesetting for the first
1736 % paragraph after a part or a chapter begins:
1737 % \begin{macrocode}
1738 \newif\if@firstpara
1739 \@firstparafalse
1740 % \end{macrocode}
1741 % \end{macro}
1742 %
1743 % \begin{macro}{\turnoffbigpara}
1744 % \changes{v2.0}{2023/04/01}{Introduced macro}
1745 % And the code to manually turn it off
1746 % \begin{macrocode}
1747 \newcommand{\turnoffbigpara}{\@firstparafalse}
1748 % \end{macrocode}
1749 % \end{macro}
1750 %
1751 % \begin{macro}{\@chapterart}
1752 % We also keep track of the current artwork for chapter start:
1753 % \begin{macrocode}
1754 \def\@chapterart{}
1755 % \end{macrocode}
1756 % \end{macro}
1757 %
1758 % \begin{macro}{\secdef}
1759 % \changes{v0.6}{2008/03/21}{Changed LaTeX default}
1760 % The standard \LaTeX{} |secdef| assumes that starred commands have no
1761 % optional argument. This is not right for us:
1762 % \begin{macrocode}
1763 \def\secdef#1#2{\@ifstar{\@dblarg{#2}}{\@dblarg{#1}}}
1764 % \end{macrocode}
1765 %
1766 % \end{macro}
1767 %
1768 %
1769 % \begin{macro}{\part}
1770 % \changes{v0.5}{2008/03/16}{Changed LaTeX default}
1771 % Our parts differ from the ones in standard LaTeX since we use empty
1772 % pagestyle rather than plain in part pages. The trick with
1773 % |\cleardoublepage| is from~\cite{Oostrum04:Fancyhdr}
1774 % \begin{macrocode}
1775 \renewcommand\part{%
1776 \clearpage
1777 {\pagestyle{empty}\cleardoublepage}%
1778 \everypar{}%
1779 \markboth{}{}%
1780 \def\@chapterart{}%
1781 \thispagestyle{empty}%
1782 \null\vskip0.715in%
1783 \secdef\@part\@spart}
1784 % \end{macrocode}
1785 % \end{macro}
1786 %
1787 % \begin{macro}{\@part}
1788 % \changes{v0.5}{2008/03/16}{Changed LaTeX default}
1789 % \changes{v0.7}{2008/04/04}{Changed dimensions}
1790 % This code is used when we have a numbered part.
1791 % \begin{macrocode}
1792 \def\@part[#1]#2{%
1793 \ifnum \c@secnumdepth >-2\relax
1794 \refstepcounter{part}%
1795 \addcontentsline{toc}{part}{\MakeUppercase{\partname}
1796 \thepart\protect\linebreak\penalty\@highpenalty\MakeUppercase{#1}}%
1797 \addcontentsline{tbc}{bpart}{\MakeUppercase{\partname~\thepart: \futuraheavy #1}}%
1798 \else
1799 \addcontentsline{toc}{part}{\MakeUppercase{#1}}%
1800 \addcontentsline{tbc}{bpart}{\MakeUppercase{\futuraheavy #1}}%
1801 \fi
1802 {\centering
1803 \interlinepenalty \@M
1804 \normalfont
1805 \ifnum \c@secnumdepth >-2\relax
1806 \futuraboldc\fontsize{80pt}{80pt}\selectfont
1807 \MakeUppercase{\partname\nobreakspace\thepart}%
1808 \par
1809 \vskip 0.45in%
1810 \fi
1811 \dogma \fontsize{16pt}{16pt}\selectfont
1812 \MakeUppercase{\sochapter{#2}}\par}%
1813 \@endpart}
1814 % \end{macrocode}
1815 % \end{macro}
1816 %
1817 % \begin{macro}{\@spart}
1818 % \changes{v0.5}{2008/03/16}{Changed LaTeX default}
1819 % This is used for starred parts (probably not something we are
1820 % going to encounter\dots)
1821 % \begin{macrocode}
1822 \def\@spart[#1]#2{%
1823 \addcontentsline{toc}{part}{\MakeUppercase{#1}}%
1824 \addcontentsline{tbc}{bpart}{\MakeUppercase{#1}}%
1825 {\centering
1826 \dogma \fontsize{16pt}{16pt}\selectfont
1827 \MakeUppercase{\sochapter{#2}}\par}%
1828 \@endpart}
1829 % \end{macrocode}
1830 % \end{macro}
1831 %
1832 % \begin{macro}{\@endpart}
1833 % \changes{v0.5}{2008/03/16}{Changed LaTeX default}
1834 % When part is finished, we change the settings of the first paragraph:
1835 % \begin{macrocode}
1836 \def\@endpart{%
1837 \@afterindentfalse
1838 \vskip49\p@%
1839 \@firstparatrue
1840 \@afterheading}
1841 % \end{macrocode}
1842 %
1843 % \end{macro}
1844 %
1845 % \begin{macro}{\chapter}
1846 % \changes{v0.6}{2008/03/21}{Reverted to standard interface}
1847 % First, we suppress floats, set up empty page style and delete
1848 % indentation after the chapter. Then we check whether the chapter is
1849 % starred:
1850 % \begin{macrocode}
1851 \def\chapter{%
1852 \clearpage
1853 {\pagestyle{empty}\cleardoublepage}%
1854 \everypar{}%
1855 \thispagestyle{empty}%
1856 \global\@topnum\z@
1857 \@afterindentfalse
1858 \gdef\@chapterart{}%
1859 \secdef\@chapter\@schapter}
1860 % \end{macrocode}
1861 % \end{macro}
1862 %
1863 %
1864 % \begin{macro}{\@chapter}
1865 % \changes{v0.2}{2008/03/04}{Moved up}
1866 % \changes{v0.6}{2008/03/21}{Reverted to standard interface}
1867 % \changes{v1.3}{2008/06/06}{Corrected a stupid mistake: put
1868 % refstepcounter out of a group}
1869 % The actual work is done by |\@chapter| macro.
1870 % \begin{macrocode}
1871 \def\@chapter[#1]#2{%
1872 \vspace*{0.622in}
1873 \ifnum \c@secnumdepth > \m@ne
1874 \refstepcounter{chapter}%
1875 \typeout{Chapter:\thechapter\space\@currentlabel}%
1876 \markboth{\@chapapp~\thechapter}{#1}%
1877 \typeout{\@chapapp\space\thechapter.}%
1878 \addcontentsline{toc}{chapter}{\thechapter%
1879 \protect\linebreak\penalty\@highpenalty
1880 \MakeUppercase{#1}}%
1881 \addcontentsline{tbc}{bchapter}{%
1882 \chaptername~\thechapter:~#1}%
1883 {\centering
1884 \futuraboldc\fontsize{120pt}{120pt}
1885 \selectfont
1886 \thechapter\par\nobreak\vskip27pt}%
1887 \else
1888 \addcontentsline{toc}{chapter}{%
1889 \MakeUppercase{#1}}%
1890 \addcontentsline{tbc}{bchapter}{#1}%
1891 \markboth{#1}{#1}%
1892 \fi
1893 {\centering
1894 \dogma\fontsize{16pt}{18pt}\selectfont
1895 \MakeUppercase{\sochapter{#2}}\par}\nobreak\vskip25pt\relax%
1896 \@firstparatrue
1897 \@afterheading}%
1898 % \end{macrocode}
1899 % \end{macro}
1900 %
1901 % \begin{macro}{\@schapter}
1902 % \changes{v0.6}{2008/03/21}{Reverted to standard interface}
1903 % \changes{v0.7}{2008/04/04}{Changed dimensions}
1904 % This is used when we have a starred chapter:
1905 % \begin{macrocode}
1906 \def\@schapter[#1]#2{%
1907 \vspace*{2.747in}
1908 {\centering
1909 \phantomsection
1910 \addcontentsline{toc}{chapter}{%
1911 \MakeUppercase{#1}}%
1912 \addcontentsline{tbc}{bchapter}{#1}%
1913 \markboth{#1}{#1}%
1914 {\fontsize{16pt}{18pt}\selectfont
1915 \MakeUppercase{\dogma \sochapter{#2}}\par}}\nobreak\vskip25pt\relax%
1916 \@firstparatrue
1917 \@afterheading}%
1918 % \end{macrocode}
1919 % \end{macro}
1920 %
1921 % \begin{macro}{\@afterheading}
1922 % \changes{v0.3}{2008/03/12}{Moved the circle art}
1923 % \changes{v0.4}{2008/03/14}{Added special treatment for the case of
1924 % empty chapter art}
1925 % \changes{v0.7}{2008/04/04}{Changed dimensions}
1926 % We cannot use the standard |\@afterheading| since we want to put the
1927 % first paragraph in larger font and put there the artwork. So we
1928 % take |\@afterheading| code and patch it:
1929 % \begin{macrocode}
1930 \def\@afterheading{%
1931 \@nobreaktrue
1932 \everypar{%
1933 \if@nobreak
1934 \@nobreakfalse
1935 \clubpenalty \@M
1936 \setbox\z@\lastbox
1937 \else
1938 \clubpenalty \@clubpenalty
1939 \everypar{}%
1940 \fi
1941 \if@firstpara
1942 % \end{macrocode}
1943 % The first paragraph has a special font and artwork in the beginning:
1944 % \begin{macrocode}
1945 \rule{\z@}{49\p@}%
1946 \ifx\@chapterart\@empty%
1947 \else
1948 \makebox[0pt][r]{\raisebox{-0.5in}[0pt][0pt]{%
1949 \@chapterart\hspace{0.21in}}}%
1950 \parshape=5
1951 0.963in 3.622in
1952 0.913in 3.672in
1953 0.813in 3.772in
1954 0.563in 4.022in
1955 0in \textwidth
1956 \fi
1957 \fontsize{14pt}{16.5pt}\selectfont%
1958 \parskip=3pt
1959 \else
1960 \parskip=0pt
1961 \normalsize\selectfont
1962 \fi
1963 \@firstparafalse}}%
1964 % \end{macrocode}
1965 % \end{macro}
1966 %
1967 % \begin{macro}{\chapterwithquote}
1968 % \changes{v2.0}{2023/04/08}{Introduced the command}
1969 % \begin{macrocode}
1970 \def\chapterwithquote{%
1971 \clearpage
1972 {\pagestyle{empty}\cleardoublepage}%
1973 \everypar{}%
1974 \thispagestyle{empty}%
1975 \global\@topnum\z@
1976 \@afterindentfalse
1977 \gdef\@chapterart{}%
1978 \secdef\@chapterwithquote\@schapter}
1979 % \end{macrocode}
1980 % \end{macro}
1981 % \begin{macro}{\@chapterwithquote}
1982 % \changes{v2.0}{2023/04/08}{Introduced the command}
1983 % \begin{macrocode}
1984 \def\@chapterwithquote[#1]#2#3#4{%
1985 \vspace*{0.622in}
1986 \ifnum \c@secnumdepth > \m@ne
1987 \refstepcounter{chapter}%
1988 \typeout{Chapter:\thechapter\space\@currentlabel}%
1989 \markboth{\@chapapp~\thechapter}{#1}%
1990 \typeout{\@chapapp\space\thechapter.}%
1991 \addcontentsline{toc}{chapter}{\thechapter%
1992 \protect\linebreak\penalty\@highpenalty
1993 \MakeUppercase{#1}}%
1994 \addcontentsline{tbc}{bchapter}{%
1995 \chaptername~\thechapter:~#1}%
1996 {\centering
1997 \futuraboldc\fontsize{120pt}{120pt}
1998 \selectfont
1999 \thechapter\par\nobreak\vskip27pt}%
2000 \else
2001 \addcontentsline{toc}{chapter}{%
2002 \MakeUppercase{#1}}%
2003 \addcontentsline{tbc}{bchapter}{#1}%
2004 \markboth{#1}{#1}%
2005 \fi
2006 {\centering
2007 \dogma\fontsize{16pt}{18pt}\selectfont
2008 \MakeUppercase{\sochapter{#2}}\par\vspace{.1in}\normalfont\fontsize{9pt}{11pt}\selectfont\textit{#3}\par\textit{\textemdash#4}\par}\nobreak\vskip25pt\relax%
2009 \@firstparatrue
2010 \@afterheading}%
2011 % \end{macrocode}
2012 % \end{macro}
2013 %
2014 % \begin{macro}{\chapterart}
2015 % \changes{v0.6}{2008/03/21}{Introduced the command}
2016 % This creates the chapterart:
2017 % \begin{macrocode}
2018 \newcommand{\chapterart}[1]{\gdef\@chapterart{#1}}%
2019 % \end{macrocode}
2020 % \end{macro}
2021 %
2022 % \begin{macro}{\chapterartfile}
2023 % \changes{v0.6}{2008/03/21}{Introduced the command}
2024 % The simplified version of |\chapterart|:
2025 % \begin{macrocode}
2026 \newcommand{\chapterartfile}[1]{\gdef\@chapterart{%
2027 \includegraphics[width=1.264in]{#1}}}%
2028 % \end{macrocode}
2029 %
2030 % \end{macro}
2031 %
2032 %
2033 % \begin{macro}{\section}
2034 % \changes{v0.3}{2008/03/09}{Changed indentation}
2035 % Sections correspond to |HeadA| in our specs. We use |\everypar{}|
2036 % in case section starts just after chapter start.
2037 % \begin{macrocode}
2038 \renewcommand{\section}{\everypar{}%
2039 \@startsection{section}{1}{-0.75in}{16pt}{6pt}{%
2040 \sffamily \bfseries \fontsize{12pt}{16pt}\selectfont}}%
2041 % \end{macrocode}
2042 % \end{macro}
2043 %
2044 % \begin{macro}{\subsection}
2045 % Subsections correspond to |HeadB| in our specs:
2046 % \begin{macrocode}
2047 \renewcommand{\subsection}{\everypar{}%
2048 \@startsection{subsection}{2}{0pt}{14pt}{4pt}{%
2049 \futuraboldcoblique
2050 \fontsize{12pt}{17pt}\selectfont}}%
2051 % \end{macrocode}
2052 % \end{macro}
2053 %
2054 %
2055 % \begin{macro}{\subsubsection}
2056 % Subsubsections correspond to |HeadC| in our specs:
2057 % \begin{macrocode}
2058 \renewcommand{\subsubsection}{\everypar{}%
2059 \@startsection{subsubsection}{3}{0pt}{10pt}{2pt}{%
2060 \futuraboldc \fontsize{10pt}{14pt}%
2061 \selectfont}}%
2062 % \end{macrocode}
2063 % \end{macro}
2064 %
2065 % We do not redefine levels below, leaving the options
2066 % from~\cite{classes} in place.
2067 %
2068 %
2069 %
2070 %\subsection{Lists}
2071 %\label{sec:lists}
2072 %
2073 % This follows design of~\cite{classes} with the values from our
2074 % specifications:
2075 % \begin{macro}{\leftmargin}
2076 % \begin{macro}{\leftmargini}
2077 % \begin{macro}{\leftmarginii}
2078 % \begin{macro}{\leftmarginiii}
2079 % \begin{macro}{\leftmarginiv}
2080 % The host of |\leftmargin| commands:
2081 % \begin{macrocode}
2082 \setlength{\leftmargin}{0.25in}
2083 \setlength{\leftmargini}{0.25in}
2084 \setlength{\leftmarginii}{0.25in}
2085 \setlength{\leftmarginiii}{0.25in}
2086 \setlength{\leftmarginiv}{0.25in}
2087 % \end{macrocode}
2088 % \end{macro}
2089 % \end{macro}
2090 % \end{macro}
2091 % \end{macro}
2092 % \end{macro}
2093 %
2094 % \begin{macro}{\rightmargin}
2095 % Right margin is always zero:
2096 % \begin{macrocode}
2097 \setlength{\rightmargin}{0pt}
2098 % \end{macrocode}
2099 % \end{macro}
2100 %
2101 %
2102 % \begin{macro}{\@listi}
2103 % \begin{macro}{\@listI}
2104 % This is the default list on the first level
2105 % \begin{macrocode}
2106 \def\@listi{\leftmargin\leftmargini
2107 \labelwidth\leftmargini\relax
2108 \advance\labelwidth-\labelsep\relax
2109 \parsep0\p@\relax
2110 \topsep6\p@\relax
2111 \itemsep4\p@\relax}
2112 \let\@listI\@listi
2113 % \end{macrocode}
2114 % \end{macro}
2115 % \end{macro}
2116 %
2117 % \begin{macro}{\@listii}
2118 % \begin{macro}{\@listiii}
2119 % \begin{macro}{\@listiv}
2120 % \begin{macro}{\@listv}
2121 % \begin{macro}{\@listvi}
2122 % And the lists for the next levels:
2123 % \begin{macrocode}
2124 \def\@listii{\leftmargin\leftmarginii
2125 \labelwidth\leftmarginii
2126 \advance\labelwidth-\labelsep
2127 \parsep0\p@\relax
2128 \topsep0\p@\relax
2129 \itemsep0\p@\relax}
2130 \def\@listiii{\leftmargin\leftmarginiii
2131 \labelwidth\leftmarginiii
2132 \advance\labelwidth-\labelsep
2133 \parsep0\p@\relax
2134 \topsep0\p@\relax
2135 \itemsep0\p@\relax}
2136 \def\@listiv{\leftmargin\leftmarginiv
2137 \labelwidth\leftmarginiv
2138 \advance\labelwidth-\labelsep
2139 \parsep0\p@\relax
2140 \topsep0\p@\relax
2141 \itemsep0\p@\relax}
2142 \def\@listv{\leftmargin\leftmarginv
2143 \labelwidth\leftmarginv
2144 \advance\labelwidth-\labelsep
2145 \parsep0\p@\relax
2146 \topsep0\p@\relax
2147 \itemsep0\p@\relax}
2148 \def\@listvi{\leftmargin\leftmarginvi
2149 \labelwidth\leftmarginvi
2150 \advance\labelwidth-\labelsep
2151 \parsep0\p@\relax
2152 \topsep0\p@\relax
2153 \itemsep0\p@\relax}
2154 % \end{macrocode}
2155 % \end{macro}
2156 % \end{macro}
2157 % \end{macro}
2158 % \end{macro}
2159 % \end{macro}
2160 %
2161 % \begin{macro}{itemize}
2162 % \changes{v0.2}{2008/03/03}{Flush left bullets}
2163 % We make bullets flushleft:
2164 % \begin{macrocode}
2165 \def\itemize{%
2166 \ifnum \@itemdepth >\thr@@\@toodeep\else
2167 \advance\@itemdepth\@ne
2168 \edef\@itemitem{labelitem\romannumeral\the\@itemdepth}%
2169 \expandafter
2170 \list
2171 \csname\@itemitem\endcsname
2172 {\def\makelabel##1{##1}}%
2173 \fi}
2174 % \end{macrocode}
2175 %
2176 % \end{macro}
2177 %
2178 % \begin{macro}{enumerate}
2179 % \changes{v0.2}{2008/03/03}{Flush left numbers}
2180 % We make numbering flushleft:
2181 % \begin{macrocode}
2182 \def\enumerate{%
2183 \ifnum \@enumdepth >\thr@@\@toodeep\else
2184 \advance\@enumdepth\@ne
2185 \edef\@enumctr{enum\romannumeral\the\@enumdepth}%
2186 \expandafter
2187 \list
2188 \csname label\@enumctr\endcsname
2189 {\usecounter\@enumctr\def\makelabel##1{##1}}%
2190 \fi}
2191 % \end{macrocode}
2192 %
2193 % \end{macro}
2194 %
2195 % \begin{macro}{description}
2196 % \changes{v2.0}{2023/04/08}{Redefined}
2197 % \begin{macrocode}
2198 \renewenvironment{description}%
2199 {\list{}{\labelwidth=0pt \leftmargin=18pt
2200 \let\makelabel\descriptionlabel}}
2201 {\endlist}
2202 % \end{macrocode}
2203 % \end{macro}
2204 %
2205 % \begin{macro}{quotation}
2206 % In |quotation| environment the paragraphs are indented. We use
2207 % 9pt Roman for quotations:
2208 % \begin{macrocode}
2209 \renewenvironment{quotation}{%
2210 \list{}{\listparindent\parindent\relax
2211 \itemindent\listparindent\relax
2212 \rightmargin0.5in\relax
2213 \leftmargin0.5in\relax}%
2214 \item\fontsize{9pt}{11pt}\selectfont}{\endlist}
2215 % \end{macrocode}
2216 % \end{macro}
2217 %
2218 %
2219 % \begin{macro}{quote}
2220 % Quote is for short quotations without indentations:
2221 % \begin{macrocode}
2222 \renewenvironment{quote}{%
2223 \list{}{\listparindent0pt\relax
2224 \itemindent\listparindent\relax
2225 \rightmargin0.5in\relax
2226 \leftmargin0.5in\relax}%
2227 \item\fontsize{9pt}{11pt}\selectfont}{\endlist}
2228 % \end{macrocode}
2229 % \end{macro}
2230 %
2231 % \begin{macro}{\aside}
2232 % \changes{v2.2}{2023/06/10}{Added macro}
2233 % An environment for asides. Italics with the name (the mandatory
2234 % arg) on the margin
2235 % \begin{macrocode}
2236 \newenvironment{aside}[1]{%
2237 \list{\makebox[0pt][r]{\dogma \fontsize{7.5pt}{12pt}
2238 \colorbox{black}{\textcolor{white}{\sonote{#1}}}\hspace{2em}}}{\listparindent0pt\relax
2239 \topsep9\p@\relax
2240 \itemindent0\p@\relax
2241 \rightmargin0\p@\relax
2242 \leftmargin0\p@\relax
2243 \labelwidth0\p@\relax
2244 \labelsep0\p@}%
2245 \item\itshape}{\vspace{-3pt}\endlist}
2246 % \end{macrocode}
2247 % \end{macro}
2248 %
2249 % \begin{macro}{\note}
2250 % \changes{v2.2}{2023/06/10}{Redefined using generic}
2251 % Note is in italics with
2252 % the word ``NOTE'' on the margin:
2253 % \begin{macrocode}
2254 \newenvironment{note}{\begin{aside}{NOTE}}{\end{aside}}
2255 % \end{macrocode}
2256 % \end{macro}
2257 % \begin{macro}{\warning}
2258 % \changes{v2.2}{2023/06/10}{Defined using generic}
2259 % Warning is in italics with
2260 % the word ``WARNING'' on the margin:
2261 % \begin{macrocode}
2262 \newenvironment{warning}{\begin{aside}{WARNING}}{\end{aside}}
2263 % \end{macrocode}
2264 % \end{macro}
2265 %
2266 % \begin{macro}{plainlist}
2267 % \changes{v2.0}{2023/04/08}{Added macro}
2268 \newenvironment{plainlist}{%
2269 \renewcommand{\descriptionlabel}[1]{\hspace{\labelsep}\textbf{##1}} % Add em space to description label
2270 \begin{description}%
2271 }{%
2272 \renewcommand{\descriptionlabel}[1]{\hspace{\labelsep}\textbf{##1 \quad}} % Add em space to description label
2273 \end{description}%
2274 }
2275
2276 % \end{macro}
2277 %
2278 %\subsection{Footnotes}
2279 %\label{sec:footnotes}
2280 %
2281 % \begin{macro}{\footnoterule}
2282 % \changes{v0.3}{2008/03/11}{Increased kern above the rule}
2283 % \changes{v1.1}{2008/06/01}{Increased kern below the rule}
2284 % We want one inch by 0.25 footnote rule:
2285 % \begin{macrocode}
2286 \renewcommand\footnoterule{%
2287 \kern6\p@
2288 \hrule height 0.25pt depth 0pt width 1in
2289 \kern2\p@}
2290 % \end{macrocode}
2291 % \end{macro}
2292 %
2293 % \begin{macro}{\@footnotetext}
2294 % \changes{v0.3}{2008/03/11}{Changed LaTeX default}
2295 % We want 4pt between footnotes. Unfortunately the standard
2296 % functions introduces |\@finalstrut|, which we do not need
2297 % here\dots
2298 % \begin{macrocode}
2299 \long\def\@footnotetext#1{\insert\footins{%
2300 \reset@font\footnotesize
2301 \interlinepenalty\interfootnotelinepenalty
2302 \splittopskip\footnotesep
2303 \splitmaxdepth \dp\strutbox \floatingpenalty \@MM
2304 \hsize\columnwidth \@parboxrestore
2305 \protected@edef\@currentlabel{%
2306 \csname p@footnote\endcsname\@thefnmark
2307 }%
2308 \color@begingroup
2309 \@makefntext{%
2310 \rule\z@{13.5pt}\ignorespaces#1}%
2311 \color@endgroup}}%
2312 % \end{macrocode}
2313 % \end{macro}
2314 %
2315 % \begin{macro}{\footins}
2316 % \changes{v0.3}{2008/03/11}{Changed LaTeX defaults}
2317 % We make some space between footnotes:
2318 % \begin{macrocode}
2319 \setlength{\skip\footins}{20\p@ \@plus 4\p@ \@minus 0\p@}
2320 % \end{macrocode}
2321 %
2322 % \end{macro}
2323 %
2324 %
2325 % \begin{macro}{\@makefntext}
2326 % \changes{v1.1}{2008/05/24}{Added space between footnote mark and
2327 % footnote text}
2328 % We do not indent the footnotes:
2329 % \begin{macrocode}
2330 % \renewcommand\@makefntext[1]{%
2331 % \parindent 0\p@%
2332 % \RaggedRightParindent0\p@%
2333 % \noindent
2334 % \@makefnmark\space#1}
2335 \renewcommand\@makefntext[1]{%
2336 \@thefnmark.~#1}
2337 % \end{macrocode}
2338 % \end{macro}
2339 %
2340 %
2341 %\subsection{Tables, Figures and Listings}
2342 %\label{sec:tbl_fig}
2343 %
2344 % \begin{macro}{\thefigure}
2345 % We want dash instead of dot between chapter number and figure
2346 % number:
2347 % \begin{macrocode}
2348 \renewcommand \thefigure
2349 {\ifnum \c@chapter>\z@ \thechapter-\fi \@arabic\c@figure}
2350 % \end{macrocode}
2351 % \end{macro}
2352 % \begin{macro}{\thetable}
2353 % We want dash instead of dot between chapter number and table
2354 % number:
2355 % \begin{macrocode}
2356 \renewcommand \thetable
2357 {\ifnum \c@chapter>\z@ \thechapter-\fi \@arabic\c@table}
2358 % \end{macrocode}
2359 % \end{macro}
2360 % \begin{macro}{\thelistings}
2361 % \changes{v1.4}{2020/04/24}{Added \cs{AtBeginDocument}}
2362 % And the same for listings. Note that listings package uses
2363 % \cs{AtBeginDocument}, so we need to postpone this
2364 % \begin{macrocode}
2365 \AtBeginDocument{%
2366 \renewcommand \thelstlisting
2367 {\ifnum \c@chapter>\z@ \thechapter-\fi \@arabic\c@lstlisting}%
2368 }
2369 % \end{macrocode}
2370 % \end{macro}
2371 %
2372 % Default listings settings
2373 % \begin{macrocode}
2374 \lstset{
2375 frame = lines,
2376 showstringspaces=false,
2377 tabsize=4,
2378 title=\lstname,
2379 numbers = none,
2380 caption={},
2381 literate={\ }{{\ }}1{"}{\textquotedbl}1,
2382 escapeinside={(@}{@)},
2383 captionpos=b,
2384 basicstyle=\ttfamily,
2385 columns=fullflexible,
2386 moredelim=[is][\bfseries]{***}{***},
2387 moredelim=[is][\itshape]{___}{___},
2388 moredelim=[is][\bfseries\itshape]{&&&}{&&&},
2389 aboveskip=8pt,
2390 }
2391 % \end{macrocode}
2392 %
2393 % \begin{macro}{codewide}
2394 % \changes{v2.0}{2023/4/08}{Added environment}
2395 % \begin{macrocode}
2396 \lstnewenvironment
2397 {codewide}[1][]
2398 {
2399 \renewcommand{\codewingding}[1]
2400 {\ding{\the\numexpr ##1 + 181 \relax}}
2401 \captionsetup[lstlisting]{font=nostarchfigfont,singlelinecheck=off,
2402 aboveskip=4pt, belowskip=-12pt, margin=-70pt}
2403 \lstset{
2404 frame = lines,
2405 showstringspaces=false,
2406 tabsize=4,
2407 title=\lstname,
2408 numbers = none,
2409 literate={\ }{{\ }}1{"}{\textquotedbl}1,
2410 escapeinside={(@}{@)},
2411 captionpos=b,
2412 caption={},
2413 basicstyle=\ttfamily,
2414 columns=fullflexible,
2415 moredelim=[is][\bfseries]{***}{***},
2416 moredelim=[is][\itshape]{___}{___},
2417 moredelim=[is][\bfseries\itshape]{&&&}{&&&},
2418 xleftmargin=-70pt,
2419 aboveskip=8pt,
2420 #1
2421 }}
2422 {
2423 \renewcommand{\codewingding}[1]
2424 {\vbox{\llap{\wingding{#1}\hskip 0.5em}}}
2425 \captionsetup[lstlisting]{font=nostarchfigfont,singlelinecheck=off,
2426 aboveskip=4pt, belowskip=0pt, margin=0pt}}
2427 % \end{macrocode}
2428 % \end{macro}
2429 %
2430 % Setting up longtables
2431 % \begin{macrocode}
2432 \def\LTleft{\z@}
2433 \def\LTright{\fill}
2434 % \end{macrocode}
2435 %
2436 % \begin{macro}{\ifnostarch@overridecaptionwidth}
2437 % \changes{v2.1}{2023/04/09}{Introduced macro}
2438 % Whether the user wants to override automatically selected caption
2439 % width
2440 % \begin{macrocode}
2441 \newif\ifnostarch@overridecaptionwidth
2442 \nostarch@overridecaptionwidthfalse
2443 % \end{macrocode}
2444 % \end{macro}
2445 %
2446 % \begin{macro}{\nostarch@captionwidth}
2447 % \changes{v2.1}{2023/04/09}{Introduced macro}
2448 % The width of the caption. Either set by the user or measured
2449 % \begin{macrocode}
2450 \newlength\nostarch@captionwidth
2451 % \end{macrocode}
2452 % \end{macro}
2453 %
2454 % \begin{macro}{\NextCaptionWidth}
2455 % \changes{v2.1}{2023/04/09}{Introduced macro}
2456 % A user-level command to set the caption width
2457 % \begin{macrocode}
2458 \newcommand\NextCaptionWidth[1]{%
2459 \global\nostarch@overridecaptionwidthtrue
2460 \global\setlength{\nostarch@captionwidth}{#1}%
2461 }
2462 % \end{macrocode}
2463 % \end{macro}
2464 %
2465 % \begin{macro}{\nostarch@measurecaptionwidth}
2466 % \changes{v2.1}{2023/04/09}{Introduced macro}
2467 % We set \cs{nostarch@captionwidth} to the width of the last box
2468 % unless the flag \cs{ifnostarch@overridecaptionwidth} is set. At the
2469 % end we set the flag to false.
2470 % \begin{macrocode}
2471 \newcommand\nostarch@measurecaptionwidth{%
2472 \ifnostarch@overridecaptionwidth\else
2473 \par
2474 \setbox\@tempboxa\lastbox
2475 \setbox\@tempboxa=\hbox{\unhbox\@tempboxa}%
2476 \global\setlength{\nostarch@captionwidth}{\wd\@tempboxa}%
2477 \box\@tempboxa\par
2478 \fi
2479 \global\nostarch@overridecaptionwidthfalse
2480 }
2481 % \end{macrocode}
2482 % \end{macro}
2483 %
2484 % We measure the width at the begin of the figure caption. Note that
2485 % the cs{AtBeginCaption} hook is too late for us.
2486 % \begin{macrocode}
2487 \AtBeginDocument{%
2488 \pretocmd{\caption}{\def\@tempa{figure}%
2489 \ifx\@tempa\@captype\relax
2490 \nostarch@measurecaptionwidth
2491 \fi}{}{}}
2492 % \end{macrocode}
2493 %
2494 %
2495 % We declare the caption format for figures and tables
2496 % \begin{macrocode}
2497 \DeclareCaptionFormat*{nostarchfigtblformat}{%
2498 \parbox{\nostarch@captionwidth}{#1#2#3}}
2499 % \end{macrocode}
2500 %
2501 % Tables are more complex, because captions are \emph{before} the
2502 % tables. Therefore we need to write the width into aux file and read
2503 % it from there. Most of the ideas here are stolen from
2504 % \textsl{longtable} code.
2505 %
2506 % \begin{macro}{\nostarch@tbl@warn}
2507 % \changes{v2.1}{2023/04/10}{Introduced macro}
2508 % Whether to ask the user for rerun due to changed widths
2509 % \begin{macrocode}
2510 \def\nostarch@tbl@warn{}
2511 \AtEndDocument{\nostarch@tbl@warn}
2512 % \end{macrocode}
2513 % \end{macro}
2514 %
2515 % \begin{macro}{\c@nostarch@tbl}
2516 % \changes{v2.1}{2023/04/10}{Introduced macro}
2517 % We write the table width into the macro \cs{nostarch@tbl@N}, where
2518 % $N$ is the roman representation of the table number
2519 % \begin{macrocode}
2520 \newcounter{nostarch@tbl}
2521 % \end{macrocode}
2522 % \end{macro}
2523 %
2524 % \begin{macro}{\nostarch@read@tbl@width}
2525 % \changes{v2.1}{2023/04/10}{Introduced macro}
2526 % At the beginning of table environment we read the latest value of the
2527 % width for the given table and set the caption size
2528 % \begin{macrocode}
2529 \newcommand\nostarch@read@tbl@width{%
2530 \stepcounter{nostarch@tbl}%
2531 \expandafter\ifx\csname nostarch@tbl@\romannumeral\c@nostarch@tbl\endcsname\relax
2532 \edef\@tempa{\the\textwidth}%
2533 \else
2534 \edef\@tempa{\csname nostarch@tbl@\romannumeral\c@nostarch@tbl\endcsname}%
2535 \fi
2536 \expandafter\setlength\expandafter\nostarch@captionwidth\expandafter{\@tempa}%
2537 }
2538 \AtBeginEnvironment{table}{\nostarch@read@tbl@width}
2539 % \end{macrocode}
2540 % \end{macro}
2541 %
2542 % \begin{macro}{\nostarch@save@tbl@width}
2543 % \changes{v2.1}{2023/04/10}{Introduced macro}
2544 % At the end of the table environment we measure the width of the last
2545 % box and write it in the aux file.
2546 % \begin{macrocode}
2547 \newcommand\nostarch@save@tbl@width{%
2548 \nostarch@measurecaptionwidth
2549 \if@filesw
2550 \immediate\write\@auxout{%
2551 \gdef\expandafter\noexpand\csname nostarch@tbl@\romannumeral\c@nostarch@tbl\endcsname
2552 {\the\nostarch@captionwidth}}%
2553 \fi
2554 \expandafter\ifx\csname nostarch@tbl@\romannumeral\c@nostarch@tbl\endcsname\relax
2555 \edef\@tempa{\the\textwidth}%
2556 \else
2557 \edef\@tempa{\csname nostarch@tbl@\romannumeral\c@nostarch@tbl\endcsname}%
2558 \fi
2559 \expandafter\ifdim\@tempa=\nostarch@captionwidth\else
2560 \gdef\nostarch@tbl@warn{\ClassWarningNoLine{nostarch}
2561 {Table widths have changed. Rerun LaTeX.}}
2562 \fi
2563 }
2564 \pretocmd{\endtable}{\nostarch@save@tbl@width}{}{}
2565 % \end{macrocode}
2566 % \end{macro}
2567 %
2568 % The |H| specifier from the |float| package redefines the end of the
2569 % float, so we need to patch it too
2570 % \begin{macrocode}
2571 \pretocmd{\float@endH}{\def\@tempa{table}%
2572 \ifx\@tempa\@captype\nostarch@save@tbl@width\fi}{}{}
2573 % \end{macrocode}
2574 %
2575 % \begin{macro}{\nostarch@read@LT@width}
2576 % \changes{v2.1}{2023/04/10}{Introduced macro}
2577 % The long table version of setting caption width is different,
2578 % because a longtable knows its width.
2579 % \begin{macrocode}
2580 \def\nostarch@read@LT@width{%
2581 \ifnostarch@overridecaptionwidth\else
2582 \global\setlength{\nostarch@captionwidth}{\z@}%
2583 \bgroup
2584 \def\LT@entry##1##2{%
2585 \global\addtolength{\nostarch@captionwidth}{##2}}%
2586 \csname LT@\romannumeral\c@LT@tables\endcsname
2587 \egroup
2588 \fi
2589 \global\nostarch@overridecaptionwidthfalse
2590 }
2591 \AtBeginDocument{\pretocmd{\caption@LT@config}{\global\rownum=1\relax
2592 \nostarch@read@LT@width}{}{}}
2593 \AtBeginEnvironment{longtable}{\global\rownum=0\relax}
2594 % \end{macrocode}
2595 % \end{macro}
2596 %
2597 %
2598 % Fonts for captions
2599 % \begin{macrocode}
2600 \DeclareCaptionFont{nostarchfigfont}{\sffamily
2601 \itshape \fontsize{8.5pt}{9pt}\selectfont}
2602 \DeclareCaptionFont{nostarchtabfont}{\futurabook
2603 \fontsize{9pt}{9pt}\selectfont}
2604 % \end{macrocode}
2605 % And the setup
2606 % \begin{macrocode}
2607 \captionsetup[figure]{font=nostarchfigfont,singlelinecheck=off,
2608 aboveskip=8pt,belowskip=-8pt, format=nostarchfigtblformat}
2609 \captionsetup[lstlisting]{font=nostarchfigfont,singlelinecheck=off,
2610 aboveskip=4pt, belowskip=0pt}
2611 \captionsetup[table]{font=nostarchtabfont,singlelinecheck=off,
2612 aboveskip=0pt,belowskip=4pt, labelfont=bf, format=nostarchfigtblformat}
2613 % \end{macrocode}
2614 %
2615 % \begin{macro}{\captionlst}
2616 % \begin{macro}{\boxlst}
2617 % \begin{macro}{\tablelst}
2618 \newcommand{\captionlst}[1]{{\ttfamily \itshape \fontsize{10pt}{9pt}\selectfont #1}}
2619 \newcommand{\boxlst}[1]{{\ttfamily \fontsize{10pt}{9pt}\selectfont #1}}
2620 \newcommand{\tablelst}[1]{{\ttfamily \fontsize{10pt}{9pt}\selectfont #1}}
2621 % \end{macro}
2622 % \end{macro}
2623 % \end{macro}
2624 %
2625 % \begin{macro}{\tbfont}
2626 % This is the font used for table body:
2627 % \begin{macrocode}
2628 \def\tbfont{%
2629 \futurabook\fontsize{8.5pt}{10pt}\selectfont}
2630 % \end{macrocode}
2631 % \end{macro}
2632 %
2633 % \begin{macro}{\thfont}
2634 % Font for table headers:
2635 % \begin{macrocode}
2636 \def\thfont{%
2637 \futuraheavy\fontsize{9pt}{10pt}\selectfont}
2638 % \end{macrocode}
2639 % \end{macro}
2640 % \begin{macrocode}
2641 \AtBeginEnvironment{tabular}{\tbfont}
2642 \AtBeginEnvironment{longtable}{\tbfont}
2643 % \end{macrocode}
2644 %
2645 % \begin{macro}{\heawyrulewidth}
2646 % \begin{macro}{\lightrulewidth}
2647 % \begin{macro}{\cmidrulewidth}
2648 % Changing \progname{booktabs} defaults:
2649 % \begin{macrocode}
2650 \heavyrulewidth=3\p@
2651 \lightrulewidth=1\p@
2652 \cmidrulewidth=1.5\p@
2653 % \end{macrocode}
2654 % \end{macro}
2655 % \end{macro}
2656 % \end{macro}
2657 %
2658 %
2659 % \begin{macro}{\bottomrule}
2660 % Our |\bottomrule| is thin:
2661 % \begin{macrocode}
2662 \def\bottomrule{\noalign{\ifnum0=`}\fi
2663 \@aboverulesep=\aboverulesep
2664 \global\@belowrulesep=\belowbottomsep
2665 \global\@thisruleclass=\@ne
2666 \@ifnextchar[{\@BTrule}{\@BTrule[\lightrulewidth]}}
2667 % \end{macrocode}
2668 % \end{macro}
2669 %
2670 %
2671 % \begin{macro}{\belowrulesep}
2672 % \begin{macro}{\belowbottomsep}
2673 % \begin{macro}{\abovetopsep}
2674 % Again redefining \progname{booktabs}:
2675 % \begin{macrocode}
2676 \belowrulesep=0.7ex
2677 \belowbottomsep=0.65pt
2678 \aboverulesep=0.7ex
2679 \abovetopsep=0.65pt
2680 % \end{macrocode}
2681 %
2682 % \end{macro}
2683 % \end{macro}
2684 % \end{macro}
2685 %
2686 % \begin{macro}{tablewide}
2687 % Wide table
2688 % \begin{macrocode}
2689 \newenvironment{tablewide}[1][]
2690 {
2691 \captionsetup[table]{font=nostarchtabfont,singlelinecheck=off,
2692 aboveskip=0pt,belowskip=4pt, labelfont=bf, margin=-70pt}
2693 \begin{table}[#1]
2694 }
2695 {
2696 \end{table}
2697 \captionsetup[table]{font=nostarchtabfont,singlelinecheck=off,
2698 aboveskip=0pt,belowskip=4pt, labelfont=bf, margin=0pt}
2699 }
2700 % \end{macrocode}
2701 % \end{macro}
2702 %
2703 % \begin{macro}{tabularwide}
2704 % Wide tabular
2705 % \begin{macrocode}
2706 \newenvironment{tabularwide}[1]
2707 {
2708 \hspace*{-72pt}
2709 \begin{tabular}{#1}
2710 }
2711 {
2712 \end{tabular}
2713 }
2714 % \end{macrocode}
2715 % \end{macro}
2716 %
2717 % \begin{macro}{figurewide}
2718 % Wide figure
2719 % \begin{macrocode}
2720 \newenvironment{figurewide}[1][]
2721 {
2722 \captionsetup[figure]{font=nostarchfigfont,singlelinecheck=off,
2723 aboveskip=8pt,belowskip=-8pt, margin=-70pt}
2724 \begin{figure}[#1]
2725 \hspace*{-70pt}
2726 }
2727 {
2728 \end{figure}
2729 \captionsetup[figure]{font=nostarchfigfont,singlelinecheck=off,
2730 aboveskip=8pt,belowskip=-8pt}
2731 }
2732 % \end{macrocode}
2733 % \end{macro}
2734 %
2735 % Setting up colors in tables
2736 % \begin{macrocode}
2737 \rowcolors[]{1}{}{nspgray}
2738 % \end{macrocode}
2739 %
2740 % We extend the height of the rows and delete the space arounr rules
2741 % \begin{macrocode}
2742 \setlength{\aboverulesep}{0pt}
2743 \setlength{\belowrulesep}{0pt}
2744 \setlength{\extrarowheight}{.8ex}
2745 % \end{macrocode}
2746 %
2747 %\subsection{Verbatim, url and Listings Customization}
2748 %\label{sec:verbatim}
2749 %
2750 % \begin{macro}{Code}
2751 % This is for framed code:
2752 % \begin{macrocode}
2753 \DefineVerbatimEnvironment{Code}{Verbatim}{frame=lines,framerule=0.25pt, commandchars=\\\{\}}
2754 % \end{macrocode}
2755 % \end{macro}
2756 %
2757 %
2758 % \begin{macro}{\FV@ListParameterHook}
2759 % The skip before code is too large for us
2760 % \begin{macrocode}
2761 \FV@AddToHook\FV@ListParameterHook{\vspace{-6pt}}
2762 % \end{macrocode}
2763 % \end{macro}
2764 %
2765 % We also enable verbatim footnotes.
2766 % \begin{macrocode}
2767 \VerbatimFootnotes
2768 % \end{macrocode}
2769 %
2770 %
2771 %\subsection{Boxes and projects}
2772 %\label{sec:boxes}
2773 %
2774 % Various boxes.
2775 %
2776 % \begin{macro}{nspgray}
2777 % The color for boxes
2778 % \begin{macrocode}
2779 \definecolor{nspgray}{cmyk}{0, 0, 0, 0.1}
2780 % \end{macrocode}
2781 % \end{macro}
2782 %
2783 % And various mdframed styled boxes
2784 % \begin{macrocode}
2785 \mdfdefinestyle{nspbox}{%
2786 linecolor=black,
2787 outerlinewidth=1pt,
2788 roundcorner=5pt,
2789 innertopmargin=\baselineskip,
2790 innerbottommargin=\baselineskip,
2791 innerrightmargin=18pt,
2792 innerleftmargin=18pt,
2793 backgroundcolor=nspgray,
2794 everyline=true
2795 }
2796
2797 \mdfdefinestyle{custombox}{%
2798 linecolor=black,
2799 outerlinewidth=1pt,
2800 roundcorner=5pt,
2801 innertopmargin=\baselineskip,
2802 innerbottommargin=\baselineskip,
2803 innerrightmargin=18pt,
2804 innerleftmargin=18pt,
2805 everyline=true
2806 }
2807 \newenvironment{nspbox}[1]
2808 {\begin{mdframed}[style=nspbox]
2809 \begin{center}
2810 {\dogma \fontsize{9pt}{15pt} \MakeUppercase{\sobox{#1}}}
2811 \end{center}
2812 \begin{flushright}
2813 \begin{flushleft}
2814 \parskip=.5\baselineskip
2815 \tbfont
2816 }
2817 {\end{flushleft}\end{flushright}
2818 \end{mdframed}}
2819 \newenvironment{nspboxcontinued}
2820 {\begin{mdframed}[style=nspbox]
2821 \begin{flushright}
2822 \begin{flushleft}
2823 \parskip=.5\baselineskip
2824 \tbfont
2825 }
2826 {
2827 \end{flushleft}
2828 \end{flushright}
2829 \end{mdframed}}
2830 \newenvironment{custombox}[1]
2831 {\begin{mdframed}[style=custombox]
2832 \begin{center}
2833 {\dogma \fontsize{9pt}{15pt} \MakeUppercase{\sobox{#1}}}
2834 \end{center}
2835 \begin{flushright}
2836 \begin{flushleft}
2837 \parskip=.5\baselineskip
2838 \tbfont
2839 }
2840 {\end{flushleft}\end{flushright}
2841 \end{mdframed}}
2842
2843 \newenvironment{customboxcontinued}
2844 {\begin{mdframed}[style=custombox]
2845 \begin{flushright}
2846 \begin{flushleft}
2847 \parskip=.5\baselineskip
2848 \tbfont
2849 }
2850 {
2851 \end{flushleft}
2852 \end{flushright}
2853 \end{mdframed}}
2854
2855 \newcommand{\continued}[0]{%
2856 {\begin{flushright}%
2857 \emph{(continued)}%
2858 \end{flushright}}%
2859 }
2860 % \end{macrocode}
2861 %
2862 %
2863 % Project stuff
2864 % \begin{macrocode}
2865 \newcounter{project}
2866 \stepcounter{project}
2867 \newcommand{\projecthead}[1]{
2868 \vspace{16pt}%
2869 \noindent%
2870 \hspace{-.75in}%
2871 \addcontentsline{toc}{boldsection}{Project~\#\theproject: #1}%
2872 {\sffamily\bfseries\fontsize{12pt}{16pt}\selectfont
2873 \colorbox{black}{\textcolor{white}{Project~\#\theproject: #1}}}%
2874 \vspace{6pt}%
2875 \@afterindentfalse\@afterheading%
2876 \refstepcounter{project}%
2877 }
2878 % \end{macrocode}
2879 %
2880 % Urls are typeset in italics, with upper tilde, and according to the
2881 % following rules: URLs should break \emph{before} periods,
2882 % underscores, equal signs, ampersands, and hyphens but \emph{after}
2883 % colons, slashes and hash marks. Also, we do not allow splitting
2884 % before slashes.
2885 % \begin{macro}{\UrlFont}
2886 % \changes{v2.1}{2023/04/08}{Redefined macro}
2887 % Urls are in italic
2888 % \begin{macrocode}
2889 \def\UrlFont{\itshape}
2890 % \end{macrocode}
2891 % \end{macro}
2892 % \begin{macro}{\UrlTildeSpecial}
2893 % \changes{v2.1}{2023/04/08}{Redefined macro}
2894 % \begin{macrocode}
2895 \def\UrlTildeSpecial{\do\~{\raise.2ex\hbox{\m@th$\scriptstyle\sim$}}}
2896 \let\Url@force@Tilde\UrlTildeSpecial
2897 % \end{macrocode}
2898 % \end{macro}
2899 % \begin{macro}{\UrlBreaks}
2900 % \changes{v2.1}{2023/04/08}{Redefined macro}
2901 % \changes{v2.1}{2023/04/10}{Moved slashes to specials}
2902 % Breaks after colons, slashes, hash marks. Colons are defined in
2903 % \cs{UrlBigBreaks}, so we need the other signs. We also add some
2904 % other signs here
2905 % \begin{macrocode}
2906 \def\UrlBreaks{\do\#\do\\\do\>\do\]\do\)\do\}}
2907 % \end{macrocode}
2908 % \end{macro}
2909 % \begin{macro}{\UrlSpecials}
2910 % \changes{v2.1}{2023/04/08}{Redefined macro}
2911 % \changes{v2.1}{2023/04/11}{Added slashes and double quote}
2912 % \changes{v2.3}{2023/06/18}{Moved out opening braces for
2913 % compatibility with amsmath}
2914 % \changes{v2.4}{2023/07/19}{Restored opening brackets using David
2915 % Carlisle's advice}
2916 % We add to macro special treatment of the chars with breaking URLs.
2917 % Slashes are interesting: we allow breaking after them, but not
2918 % before, even after other slashes or colons
2919 % \emph{before} them
2920 % \begin{macrocode}
2921 \g@addto@macro{\UrlSpecials}{%
2922 \do\.{\penalty\UrlBreakPenalty\mathchar46\relax}%
2923 \do\_{\penalty\UrlBreakPenalty\mathchar95\relax}%
2924 \do\={\penalty\UrlBreakPenalty\mathchar61\relax}%
2925 \do\&{\penalty\UrlBreakPenalty\mathchar38\relax}%
2926 \do\-{\penalty\UrlBreakPenalty\mathchar45\relax}%
2927 \do\!{\penalty\UrlBreakPenalty\mathchar33\relax}%
2928 \do\?{\penalty\UrlBreakPenalty\mathchar63\relax}%
2929 \do\|{\penalty\UrlBreakPenalty\mathchar124\relax}%
2930 \do\,{\penalty\UrlBreakPenalty\mathchar44\relax}%
2931 \do\;{\penalty\UrlBreakPenalty\mathchar59\relax}%
2932 \do\@{\penalty\UrlBreakPenalty\mathchar64\relax}%
2933 \do\'{\penalty\UrlBreakPenalty\mathchar39\relax}%
2934 \do\"{\penalty\UrlBreakPenalty\mathchar34\relax}%
2935 \do\+{\penalty\UrlBreakPenalty\mathchar43\relax}%
2936 \do\<{\penalty\UrlBreakPenalty\mathchar60\relax}%
2937 \do\[{\penalty\UrlBreakPenalty\mathchar91\relax}%
2938 \do\({\penalty\UrlBreakPenalty\mathchar40\relax}%
2939 \do\{{\penalty\UrlBreakPenalty\mathchar123\relax}%
2940 \do\/{\unpenalty\penalty\@M\mathchar47\penalty\UrlBreakPenalty}%
2941 }
2942 % \end{macrocode}
2943 % \end{macro}
2944 %
2945 % \begin{macro}{\UrlNoBreaks}
2946 % \changes{v2.1}{2023/04/08}{Redefined macro}
2947 % \changes{v2.3}{2023/06/18}{Removed redefinition}
2948 % We do not allow breaks in urls after brackets
2949 % \begin{macrocode}
2950 % \def\UrlNoBreaks{} % Rolled back redefinition
2951 % \end{macrocode}
2952 % \end{macro}
2953 %
2954 % \begin{macro}{\Url@MathSetup}
2955 % \changes{v2.4}{2023/07/19}{Added to the macro}
2956 % Amsmath redefines math catcodes every math expression. This lead to
2957 % incompatibility. By David Carlisle's advice, we reset this
2958 % resetting. We add this to the macro that is called at the beginning
2959 % of every url
2960 % \begin{macrocode}
2961 \g@addto@macro{\Url@MathSetup}{\let\resetMathstrut@\relax}
2962 % \end{macrocode}
2963 % \end{macro}
2964 %
2965 %\subsection{Margin notes}
2966 %\label{sec:margins}
2967 %
2968 % Filenames on margins
2969 % \begin{macrocode}
2970 \renewcommand*{\marginfont}{\sffamily\itshape\fontsize{8.5}{10}\selectfont}
2971 \renewcommand*{\marginnotevadjust}{-\baselineskip}
2972 \newcommand{\marginwingding}[1]{{\fontsize{10pt}{12pt}\selectfont \wingding{#1}}}
2973 % \end{macrocode}
2974 %
2975 % Code below makes the margin note always on the left, taken from:
2976 % \url{https://tex.stackexchange.com/questions/472728/marginnote-always-on-left-side-of-the-page}
2977 % \begin{macrocode}
2978 \long\def\@mn@@@marginnote[#1]#2[#3]{%
2979 \begingroup
2980 \ifmmode\mn@strut\let\@tempa\mn@vadjust\else
2981 \if@inlabel\leavevmode\fi
2982 \ifhmode\mn@strut\let\@tempa\mn@vadjust\else\let\@tempa\mn@vlap\fi
2983 \fi
2984 \@tempa{%
2985 \vbox to\z@{%
2986 \vss
2987 \@mn@margintest
2988 \if@reversemargin\if@tempswa
2989 \@tempswafalse
2990 \else
2991 \@tempswatrue
2992 \fi\fi
2993
2994 \llap{%
2995 \vbox to\z@{\kern\marginnotevadjust\kern #3
2996 \vbox to\z@{%
2997 \hsize\marginparwidth
2998 \linewidth\hsize
2999 \kern-\parskip
3000 %\mn@parboxrestore
3001 \marginfont\raggedleftmarginnote\strut\hspace{\z@}%
3002 \ignorespaces#1\endgraf
3003 \vss
3004 }%
3005 \vss
3006 }%
3007 \if@mn@verbose
3008 \PackageInfo{marginnote}{xpos seems to be \@mn@currxpos}%
3009 \fi
3010 \begingroup
3011 \ifx\@mn@currxpos\relax\else\ifx\@mn@currpos\@empty\else
3012 \kern\@mn@currxpos
3013 \fi\fi
3014 \ifx\@mn@currpage\relax
3015 \let\@mn@currpage\@ne
3016 \fi
3017 \if@twoside\ifodd\@mn@currpage\relax
3018 \kern-\oddsidemargin
3019 \else
3020 \kern-\evensidemargin
3021 \fi
3022 \else
3023 \kern-\oddsidemargin
3024 \fi
3025 \kern-1in
3026 \endgroup
3027 \kern\marginparsep
3028 }%
3029 }%
3030 }%
3031 \endgroup
3032 }
3033 % \end{macrocode}
3034 %
3035 %\subsection{Bibliography}
3036 %\label{sec:biblio}
3037 %
3038 % \begin{macro}{\bibsection}
3039 % \changes{v0.6}{2008/03/22}{Introduced the macro}
3040 % We actually use chapter for bibliographic sections, but here we
3041 % try to be nice to \progname{natbib}:
3042 % \begin{macrocode}
3043 \AtBeginDocument{
3044 \def\bibsection{%
3045 \clearpage
3046 {\pagestyle{empty}\cleardoublepage}%
3047 \everypar{}%
3048 \thispagestyle{empty}%
3049 \global\@topnum\z@
3050 \@afterindentfalse
3051 \gdef\@chapterart{}%
3052 \@nschapterpreamble
3053 \vspace*{0.622in}%
3054 \addcontentsline{toc}{chapter}{\MakeUppercase{\bibname}}%
3055 \addcontentsline{tbc}{bchapter}{\bibname}%
3056 {\centering
3057 {\dogma\fontsize{16pt}{20pt}\selectfont
3058 \MakeUppercase{\sochapter{\bibname}}\par}}\nobreak\vskip25pt\relax%
3059 \@mkboth{\bibname}{\bibname}}}%
3060 % \end{macrocode}
3061 %
3062 % \end{macro}
3063 %
3064 %
3065 % \begin{macro}{thebibliography}
3066 % \changes{v0.6}{2008/03/22}{Introduced the macro}
3067 % We want bibliography to be in the table of contents:
3068 % \begin{macrocode}
3069 \renewenvironment{thebibliography}[1]{%
3070 \bibsection
3071 \list{\@biblabel{\@arabic\c@enumiv}}%
3072 {\settowidth\labelwidth{\@biblabel{#1}}%
3073 \leftmargin\labelwidth
3074 \advance\leftmargin\labelsep
3075 \@openbib@code
3076 \usecounter{enumiv}%
3077 \let\p@enumiv\@empty
3078 \renewcommand\theenumiv{\@arabic\c@enumiv}}%
3079 \sloppy
3080 \clubpenalty4000
3081 \@clubpenalty \clubpenalty
3082 \widowpenalty4000%
3083 \sfcode`\.\@m}
3084 {\def\@noitemerr
3085 {\@latex@warning{Empty `thebibliography' environment}}%
3086 \endlist}
3087 % \end{macrocode}
3088 %
3089 % \end{macro}
3090 %
3091 %\subsection{Index}
3092 %\label{sec:index}
3093 %
3094 % \begin{macro}{\term}
3095 % \changes{v2.0}{2023/04/04}{Introduced the macro}
3096 % An indexed term
3097 % \begin{macrocode}
3098 \newcommand{\term}[1]{\emph{#1}\index{#1}}
3099 % \end{macrocode}
3100 % \end{macro}
3101 %
3102 % \begin{macro}{theindex}
3103 % \changes{v0.6}{2008/03/22}{Introduced the macro}
3104 % We want our index to be in the table of contents too:
3105 % \begin{macrocode}
3106 \renewenvironment{theindex}{%
3107 \clearpage
3108 {\pagestyle{empty}\cleardoublepage}%
3109 \everypar{}%
3110 \thispagestyle{empty}%
3111 \global\@topnum\z@
3112 \@afterindentfalse
3113 \gdef\@chapterart{}%
3114 \if@twocolumn
3115 \@restonecolfalse
3116 \else
3117 \@restonecoltrue
3118 \fi
3119 \twocolumn[%
3120 \@nschapterpreamble
3121 \vspace*{0.622in}%
3122 \addcontentsline{toc}{chapter}{\MakeUppercase{\indexname}}%
3123 \addcontentsline{tbc}{bchapter}{\indexname}%
3124 {\centering
3125 {\dogma%
3126 \fontsize{16pt}{20pt}\selectfont
3127 \MakeUppercase{\sochapter{\indexname}}\par}}%
3128 \nobreak\vskip25pt\relax]%
3129 \@mkboth{\indexname}%
3130 {\indexname}%
3131 \parindent\z@
3132 \parskip\z@ \@plus .3\p@\relax
3133 \columnseprule \z@
3134 \columnsep 0.25in%
3135 \let\item\@idxitem}
3136 {\if@restonecol\onecolumn\else\clearpage\fi}
3137 % \end{macrocode}
3138 % \end{macro}
3139 %
3140 % \begin{macro}{\@idxitem}
3141 % \changes{v0.6}{2008/03/22}{Changed default}
3142 % This is how we format level 1 index entries:
3143 % \begin{macrocode}
3144 \renewcommand\@idxitem{%
3145 \par\hangindent0.45in\normalfont\fontsize{9.5\p@}{11.5\p@}\selectfont
3146 \raggedright}
3147 % \end{macrocode}
3148 % \end{macro}
3149 % \begin{macro}{\subitem}
3150 % \changes{v0.6}{2008/03/22}{Changed default}
3151 % Level 2 entries:
3152 % \begin{macrocode}
3153 \renewcommand\subitem{\@idxitem \hspace*{0.15in}}
3154 % \end{macrocode}
3155 % \end{macro}
3156 % \begin{macro}{\subsubitem}
3157 % \changes{v0.6}{2008/03/22}{Changed default}
3158 % Level 3 entries:
3159 % \begin{macrocode}
3160 \renewcommand\subsubitem{\@idxitem \hspace*{0.3in}}
3161 % \end{macrocode}
3162 % \end{macro}
3163 % \begin{macro}{\indexspace}
3164 % \changes{v0.6}{2008/03/22}{Changed default}
3165 % The space between the groups
3166 % \begin{macrocode}
3167 \renewcommand\indexspace{\par \vskip 14\p@\relax}
3168 % \end{macrocode}
3169 % \end{macro}
3170 % \begin{macro}{\indexgroup}
3171 % \changes{v0.6}{2008/03/22}{Introduced the macro}
3172 % When an index starts a new letter, we call this macro:
3173 % \begin{macrocode}
3174 \newcommand\indexgroup[1]{{\futuraboldc
3175 \fontseries{bc}\fontsize{11\p@}{13\p@}\selectfont#1}\par\vskip4\p@}
3176 % \end{macrocode}
3177 % \end{macro}
3178 %
3179 %
3180 %
3181 %\subsection{Update Page and Colophon}
3182 %\label{sec:update_colophon}
3183 %
3184 % \begin{macro}{\updatesname}
3185 % \changes{v0.6}{2008/03/22}{Introduced the macro}
3186 % Just the name for updates:
3187 % \begin{macrocode}
3188 \def\updatesname{Updates}
3189 % \end{macrocode}
3190 %
3191 % \end{macro}
3192 %
3193 %
3194 % \begin{macro}{\updatespage}
3195 % \changes{v0.6}{2008/03/22}{Introduced the macro}
3196 % This is the command that start update page. It looks like
3197 % chapter, but it does not mark the pages or appear in the tables of
3198 % contents:
3199 % \begin{macrocode}
3200 \newcommand\updatespage{%
3201 \clearpage
3202 {\pagestyle{empty}\cleardoublepage}%
3203 \everypar{}%
3204 \thispagestyle{empty}%
3205 \global\@topnum\z@
3206 \gdef\@chapterart{}%
3207 \vspace*{1.875in}%
3208 {\centering
3209 \dogma%
3210 \fontsize{16pt}{20pt}\selectfont
3211 \MakeUppercase{\sochapter{\updatesname}}\par\nobreak\vskip40\p@}%
3212 \@nobreaktrue
3213 \everypar{%
3214 \if@nobreak
3215 \@nobreakfalse
3216 \clubpenalty \@M
3217 \setbox\z@\lastbox
3218 \else
3219 \clubpenalty \@clubpenalty
3220 \everypar{}%
3221 \fi}}
3222 % \end{macrocode}
3223 % \end{macro}
3224 %
3225 %
3226 % \begin{macro}{\colophonname}
3227 % \changes{v0.6}{2008/03/22}{Introduced the macro}
3228 % Just the name for colophon:
3229 % \begin{macrocode}
3230 \def\colophonname{Colophon}
3231 % \end{macrocode}%
3232 % \end{macro}
3233 %
3234 %
3235 % \begin{macro}{\colophon}
3236 % Colophon does not start a separate page:
3237 % \changes{v0.6}{2008/03/22}{Introduced the macro}
3238 % \begin{macrocode}
3239 \newcommand\colophon{%
3240 \everypar{}%
3241 \global\@topnum\z@
3242 \gdef\@chapterart{}%
3243 \vspace*{0.875in}%
3244 %{\centering
3245 %\dogma%
3246 % \fontsize{16pt}{20pt}\selectfont
3247 %\MakeUppercase{\sochapter{\colophonname}}\par\nobreak\vskip40\p@}%
3248 \@nobreaktrue
3249 \everypar{%
3250 \if@nobreak
3251 \@nobreakfalse
3252 \clubpenalty \@M
3253 \setbox\z@\lastbox
3254 \else
3255 \clubpenalty \@clubpenalty
3256 \everypar{}%
3257 \fi}\par
3258 The fonts used in \emph{\@title} are New Baskerville, Futura, The
3259 Sans Mono Condensed, and Dogma. The book was typeset with
3260 \LaTeXe{} package
3261 \texttt{nostarch} by Boris Veytsman with many additions by Alex
3262 Freed and other members of the \emph{No Starch Press} team
3263 \emph{(\csname [email protected]\endcsname).}\par}
3264 % \end{macrocode}
3265 % \end{macro}
3266 %
3267 %\subsection{End of Class}
3268 %\label{end}
3269 %
3270 %
3271 % \begin{macrocode}
3272 %</class>
3273 % \end{macrocode}
3274 %
3275 %\subsection{Dealing with \progname{hyperref}}
3276 %\label{sec:hyperref}
3277 %
3278 % \changes{v0.6}{2008/03/22}{Introduced package \progname{nshyper}}
3279 % First, we load \progname{hyperref} with right options. I do not
3280 % know why bookmarks do not work, but this is important to switch off:
3281 % \begin{macrocode}
3282 %<*nshyper>
3283 \RequirePackage[breaklinks,colorlinks,linkcolor=black,
3284 citecolor=black,pagecolor=black,urlcolor=black,hyperindex]{hyperref}
3285 % \end{macrocode}
3286 %
3287 % \progname{hyperref} expects the starred parts and chapters to have
3288 % only one argument---but we have two!
3289 % \begin{macrocode}
3290 \AtBeginDocument{%
3291 \def\@schapter[#1]#2{%
3292 \H@old@schapter[#1]{#2}%
3293 \@nschapterpreamble}%
3294 \def\@spart[#1]#2{%
3295 \H@old@spart[#1]{#2}%
3296 \Hy@GlobalStepCount\Hy@linkcounter
3297 \xdef\@currentHref{part*.\the\Hy@linkcounter}%
3298 \Hy@raisedlink{\hyper@anchorstart{\@currentHref}\hyper@anchorend}}}%
3299 % \end{macrocode}
3300 % We change the preamble for bibliography and index:
3301 % \begin{macrocode}
3302 \def\@nschapterpreamble{%
3303 \begingroup
3304 \let\@mkboth\@gobbletwo
3305 \Hy@GlobalStepCount\Hy@linkcounter
3306 \xdef\@currentHref{\Hy@chapapp*.\the\Hy@linkcounter}%
3307 \Hy@raisedlink{\hyper@anchorstart{\@currentHref}\hyper@anchorend}%
3308 \endgroup}
3309 % \end{macrocode}
3310 %
3311 % We can add information about the file to the pdf metadata as well:
3312 % \begin{macrocode}
3313 \let\ns@old@maketitle\maketitle
3314 \def\maketitle{%
3315 \hypersetup{pdfauthor=\@author, pdftitle=\@title}%
3316 \ns@old@maketitle}
3317 %</nshyper>
3318 % \end{macrocode}
3319 %
3320 %
3321 %\subsection{\progname{MakeIndex} Style File}
3322 %\label{sec:makeindex}
3323 % \changes{v0.6}{2008/03/23}{Added \progname{MakeIndex} style}
3324 %
3325 % These lines will produce some warnings when
3326 % running Makeindex as they try to cover two different
3327 % versions of the program:
3328 % \begin{macrocode}
3329 %<*ist>
3330 lethead_prefix "\\indexgroup{"
3331 lethead_suffix "}\\nopagebreak\n"
3332 lethead_flag 1
3333 heading_prefix "\\indexgroup{"
3334 heading_suffix "}\\nopagebreak\n"
3335 headings_flag 1
3336 %</ist>
3337 % \end{macrocode}
3338 %
3339 %
3340 %\Finale
3341 %\clearpage
3342 %
3343 %\PrintChanges
3344 %\clearpage
3345 %\PrintIndex
3346 %
3347 \endinput