% \iffalse % % Copyright 2008-2023, Boris Veytsman % This work may be distributed and/or modified under the % conditions of the LaTeX Project Public License, either % version 1.3 of this license or (at your option) any % later version. % The latest version of the license is in % http://www.latex-project.org/lppl.txt % and version 1.3 or later is part of all distributions of % LaTeX version 2005/12/01 or later. % % This work has the LPPL maintenance status `maintained'. % % The Current Maintainer of this work is Boris Veytsman, % % % This work consists of the file nostarch.dtx and the % derived file nostarch.cls % % \fi % \CheckSum{0} % % %% \CharacterTable %% {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 %% 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 %% Digits \0\1\2\3\4\5\6\7\8\9 %% Exclamation \! Double quote \" Hash (number) \# %% Dollar \$ Percent \% Ampersand \& %% Acute accent \' Left paren \( Right paren \) %% Asterisk \* Plus \+ Comma \, %% Minus \- Point \. Solidus \/ %% Colon \: Semicolon \; Less than \< %% Equals \= Greater than \> Question mark \? %% Commercial at \@ Left bracket \[ Backslash \\ %% Right bracket \] Circumflex \^ Underscore \_ %% Grave accent \` Left brace \{ Vertical bar \| %% Right brace \} Tilde \~} % %\iffalse % Taken from xkeyval.dtx %\fi %\makeatletter %\def\DescribeOption#1{\leavevmode\@bsphack % \marginpar{\raggedleft\PrintDescribeOption{#1}}% % \SpecialOptionIndex{#1}\@esphack\ignorespaces} %\def\PrintDescribeOption#1{\strut\emph{option}\\\MacroFont #1\ } %\def\SpecialOptionIndex#1{\@bsphack % \index{#1\actualchar{\protect\ttfamily#1} % (option)\encapchar usage}% % \index{options:\levelchar#1\actualchar{\protect\ttfamily#1}\encapchar % usage}\@esphack} %\def\DescribeOptions#1{\leavevmode\@bsphack % \marginpar{\raggedleft\strut\emph{options}% % \@for\@tempa:=#1\do{% % \\\strut\MacroFont\@tempa\SpecialOptionIndex\@tempa % }}\@esphack\ignorespaces} %\makeatother % % \MakeShortVerb{|} % \GetFileInfo{nostarch.dtx} % \newcommand{\progname}[1]{\textsf{#1}} % \title{\LaTeX{} Style For \emph{No Starch Press} % \thanks{\copyright 2008--2023, Boris Veytsman}} % \author{Boris Veytsman\thanks{% % \href{mailto:borisv@lk.net}{\texttt{borisv@lk.net}}, % \href{mailto:boris@varphi.com}{\texttt{boris@varphi.com}}}} % \date{\filedate, \fileversion} % \maketitle % \begin{abstract} % This package provides class for typesetting books for No Starch % Press, \url{http://www.nostarch.com} % \end{abstract} % \tableofcontents % % \clearpage % % \changes{v0.1}{2008/02/27}{First fully functional version} % \changes{v0.5}{2008/03/19}{Documentation update} % \changes{v0.6}{2008/03/21}{Documentation update} % \changes{v1.0}{2008/04/07}{First public release} % \changes{v1.1}{2008/05/24}{Added interface to listings package and % upquote package. Updated documentation} % \changes{v1.4}{2020/04/29}{Updated interface with listings package} % \changes{v2.0}{2023/03/30}{Incorporated in-house changes by No % Starch Press} % % %\section{Introduction} %\label{sec:intro} % % This is the ``official'' \LaTeX{} style for \emph{No Starch Press,} % \url{http://www.nostarch.com}. The class is intended to typeset % books for this publisher---both hard copies and electronic books. % % The suite provides main class, |nostarch.cls|, hyperref interface % |nshyper.sty| and MakeIndex style |nostarch.ist|. % % The initial version of this class was written in 2008. Since then a % number of changes was made for in-house processing by the \emph{No % Starch} team, with special thanks to Alex Freed. In 2023 these % changes were incorporated back to the publicly released version. % %\section{User's Guide} %\label{sec:manual} % % %\subsection{Installation} %\label{sec:installation} % % The installation of the class follows the usual % practice~\cite{TeXFAQ} for \LaTeX{} packages: % \begin{enumerate} % \item Run \progname{latex} on |nostarch.ins|. This will produce the % following files: % \LaTeX{} class |nostarch.cls|, \LaTeX{} style |nshyper.sty| and % MakeIndex style |nostarch.ist|. % \item Put the files |nostarch.cls|, |nshypher.sty| and % |nostarch.ist| to % the places where \LaTeX{} and MakeIndex can find them (see % \cite{TeXFAQ} or the documentation for your \TeX{} % system).\label{item:install} % \item Update the database of file names. Again, see \cite{TeXFAQ} % or the documentation for your \TeX{} system for the system-specific % details.\label{item:update} % \item The file |nostarch.pdf| provides the documentation for the % package (this is the file you are probably reading now). % \end{enumerate} % As an alternative to items~\ref{item:install} and~\ref{item:update} % you can just put the files in the working directory where your % |.tex| file is. % % To typeset the books in the distinctive \emph{No Starch Press} style % you will need the fonts used by them. Unfortunately these fonts % (New Baskerville, Futura, The Sans Mono Condensed and Dogma) are not % free. You have the following options: % \begin{enumerate} % \item Typeset your book using only free fonts (the option |nocfonts| % discussed below). % \item Buy the fonts and install them. % \item Arrange with \emph{No Starch Press} for the use of these fonts % for your book. % \end{enumerate} % The details of the installation are discussed below in % Section~\ref{sec:ug_fonts}. % % % %\subsection{Fonts installation} %\label{sec:ug_fonts} % % If you wish to try \progname{nostarch} class without bothering to % typeset camera-ready copy, you may use the option |nocfonts| for % \emph{no commercial fonts,} and the class will use only the free % fonts available in \TeX\ distributions. % % If you work with \emph{No Starch Press} on your book, you might be % provided with the fonts. Today \emph{No Starch Press} typically % uses \progname{xelatex} and expects the fonts in True~Type format. % If this is the case, use the option |cfonts|. \emph{No Starch % Press} recommends the authors to put the font files in the % subdirectory \path{fonts} of their main directory. This is where % \progname{nostarch} expects them. This is also the layout of % directories in the \emph{No Starch Press} \emph{Overleaf} % templates. However, if you prefer to put the fonts in another % directory, searcheable by \progname{xelatex}, use the option % |nofontsdir| in the invocation. % % These options are summarized in Figure~\ref{fig:fonts}. % % \begin{figure} % \centering % \begin{tikzpicture} % \node[draw, circle, radius=0.1] (start) {}; % \node[draw, align=center, below=of start] % (haveFonts) {Do you have \\commercial fonts?}; % \node[draw, left=of haveFonts, align=center] (nocfonts) % {Use |nocfonts|\\ option}; % \node[draw, below=of nocfonts, rounded corners] % (any) {Use any engine}; % \node[draw, right=of haveFonts, align=center] (cfonts) % {Use |cfonts|\\option}; % \node[draw, below=of cfonts, align=center] (haveSubdir) {Are the fonts % \\in |fonts| \\subdirectory?}; % \node[draw, left=of haveSubdir, align=center] % (nofontsdir) {Use |nofontsdir|\\option}; % \node[draw, below=of haveSubdir, align=center] (fontsdir) % {Use |fontsdir|\\option}; % \node[draw, below=of fontsdir, rounded corners] (xelatex) % {Use \progname{xelatex} engine}; % \draw[-latex] (start) -- (haveFonts); % \draw[-latex] (haveFonts) -- node[above] {No} (nocfonts); % \draw[-latex] (haveFonts) -- node[above] {Yes} (cfonts); % \draw[-latex] (nocfonts) -- (any); % \draw[-latex] (cfonts) -- (haveSubdir); % \draw[-latex] (haveSubdir) -- node[above] {No} (nofontsdir); % \draw[-latex] (haveSubdir) -- node[right] {Yes} (fontsdir); % \draw[-latex] (nofontsdir) |- (xelatex); % \draw[-latex] (fontsdir) -- (xelatex); % \end{tikzpicture} % \caption{Flowchart for font-related options} % \label{fig:fonts} % \end{figure} % % %\subsection{Invocation} %\label{sec:invocation} % % To use the class, put in the preamble of your document % \begin{flushleft} % |\documentclass[|\meta{options}|]{nostarch}| % \end{flushleft} % % \DescribeOptions{cfonts,nocfonts}% % As discussed above, \emph{No Starch Press} uses a number of % commercial fonts to typeset their books. % The option |cfonts| (default) tells \LaTeX{} that you do have these % commercial fonts. On the other hand, the option |nocfonts| instructs % \LaTeX{} % to use freely available fonts for typesetting. Of course in this % case the result will not look like a \emph{No Starch Press} Book. % % \DescribeOptions{fontsdir,nofontsdir}% % If you use commercial fonts \emph{and} \progname{xelatex}, the % latter usually expects them in the subdirectory \path{fonts} of the % main directory (see Section~\ref{sec:ug_fonts}). The options % |fontsdir| (default) sets up this behavior. Use the option % |nofontsdir| to tell \progname{xelatex} to search standard font % directories insted. % % Figure~\ref{fig:fonts} may help to choose the right options. % % %\subsection{Use of \progname{hyperref} Package} %\label{sec:guide:hyperref} % % The books typeset by \emph{No Starch Press} can be sold either as % traditional printed and bound hard copies, or as PDF files. If you, % the author, envisage the second possibility, you may want additional % possibilites provided by \progname{hyperref} % package~\cite{Rahtz06:Hyperref}, like ``clickable'' entries in the % table of context and index, etc. The provided package |nshyper.sty| % adds the functionality of \progname{hyperref} to the class. This % package is highly recommended for the books that are going to be % distributed in an electronic form. % % To use the package, just add the line |\uspackage{nshyper}| to your % preamble. This package should be loaded last since it redefines % internals of many other packages. Note that a direct call of % \progname{hyperref} by |\usepackage{hyperref}| will not work since % \progname{nshyper} patches hyperref to work with our class. % % % %\subsection{Front Matter} %\label{sec:guide:frontmatter} % % \DescribeMacro{\frontmatter} % A book can be divided into three parts: front matter, main matter % and back matter. Front matter starts with the command % |\frontmatter|. Normally this is the first command in the class. % Front matter contains half page, title page, copyright page, brief % contents, detailed contents, foreword(s) and other stuff which is % traditionally typeset on roman-numbered pages. The commands in main % matter can be divides into \emph{declarations} and % \emph{directives.} Declarations do not typeset anything. Rather, % they up parameters for the typesetting. Directives use them to % typeset the stuff. % % %\subsubsection{Front Matter Declarations} %\label{sec:guide:decls} % % % % \DescribeMacro{\title} % There are five declarations defined by |nostarch.cls|: |\title|, % |\subtitle|, % |\author|, |\nostarchlogo| and |\nostarchlocation|. The macro % |\title|, like the standard \LaTeX{} |\title|, sets the title of the % book, for example |\title|\texttt{\{The book about everything\}}. % % \DescribeMacro{\subtitle} % The macro |\subtitle| takes one argument and sets up the subtitle of % your book, for example |\subtitle|\texttt{\{A Guide For % Perplexed\}}. % % \DescribeMacro{\author} % The command |\author| has just one argument, which is the list of % authors, separated by commas and (for the last author) the word % ``and''. Do not use the command |\and| defined in the standard % \LaTeX. For example, % |\author|\texttt{\{Ralph Alpher, Hans Bethe and George Gamow\}}. % % \DescribeMacro{\nostarchlogo} % Due to copyright reasons the logo of \emph{No Starch Press} is not % distribuded with the package. You should get the logo as a graphics % file from the publishers and put in the directory where \LaTeX{} can % find it (for example, the directory with the other sources of your % book). The command |\nostarchlogo| has one argument: the name of % the file, for example, |\nostarchlogo{biglogo.pdf}|. % The file will be automatically scaled to the proper size. % % \DescribeMacro{\nostarchlocation} % \emph{No Starch Press} books are usually published in San % Francisco. If you need to change this setting, use % |\nostarchlocation| declaration, for example, % |\nostarchlocation|\texttt{\{San Francisco; London; Tokyo\}}. % % % %\subsubsection{Front Matter Directives} %\label{sec:guide:directives} % % % % \DescribeMacro{\makehalftitle} % The command |\makehalftitle| creates \emph{half title page.} % This is normally the first page of the book. % % \DescribeMacro{\maketitle} % The command |\maketitle| creates \emph{title page.} It uses logo % and full title of the book. % % \DescribeMacro{copyrightpage} % The copyright page is the \emph{verso} of the title page. It has % information about copyright, edition history, the credits of the % people who helped you to make the book, CIP information, etc. The % exact contents of the copyright page differ from book to book. % Therefore the class does not try to create this page automatically, % and rather sets up the typographic style for arbitrary contents. % For this purpose the environment |copyrigthtpage| is used. So just % put the information provided by the publisher between % |\begin{copyrightpage}| and |\end{copyrightpage}|. Use % |\textbf{\sffamily title}| for the title of the book on the % copyright line. % % \DescribeMacro{cipblock} % One of important parts of the copyright page is \emph{CIP block.} % It contains catalogue data for your book (CIP means Cataloguing in % Publication, by the way). Again, the contents of this field will be % provied by the publishers; you just need to put them inside % |cipblock| environment, i.e. between |\begin{cipblock}| and % |\end{cipblock}|. To make your life easier, this block is typeset % verbatim, so line ends and spaces are typeset as is. % % % \DescribeMacro{dedicationpage} % Dedications, if any, are included in the special dedication page, % for which a special environment |dedicationpage| is provided. % % \DescribeMacro{\brieftableofcontents} % \DescribeMacro{\tableofcontents} % The standard \LaTeX{} provides just one table of contents. This % class uses two tables: brief contents and contents in detail. They % are correspondingly typeset by the commands |\brieftableofcontents| % and |\tableofcontents|. % % % \DescribeMacro{\sectionnumberwidth} % \DescribeMacro{\subsectionnumberwidth} % In most books by \emph{No Starch Press} sections and subsections are % unnumbered. However, sometimes the books use numbered sections or % subsections. In these cases you may want to adjust the widths left % for section and subsection numbers in the detailed table of % contents. They are set by % |\sectionnumberwidth| and |\subsectionnumberwidth|, and can be % changed with the usual |\setlength| command. % % % Forewords and similar front matter materials are unnumbered % chapters: |\chapter*[Foreword by R. E.~Viewer]{Foreword}|. % % % Front matter with its formal parts like copyright page, CIP % information, etc., can be daunting, especially for novice authors. % Feel free to use the sample enclosed and ask the publisher for % advice. % %\subsection{Main Matter} %\label{sec:guide:mainmatter} % % \DescribeMacro{\mainmatter} % The command |\mainmatter| finishes the front matter and starts the % main matter of the book. The main matter is divided into chapters, % sections, subsections, etc. They are discussed below. % % %\subsubsection{Parts, Chapters and Sections} %\label{sec:guide:sections} % % \DescribeMacro{\chapter} % \DescribeMacro{\section} % \DescribeMacro{\subsection} % \DescribeMacro{\subsubsection} % \emph{No Starch Press} books have chapters, sections, subsections and % subsubsections. The chapters are usually numbered, but sections ande % below are not. The commands for them are the same as in the % standard \LaTeX: |\chapter|\oarg{short title}\marg{long title}, % |\section|\oarg{short title}\marg{long title}, etc. For % example: % \begin{verbatim} % \section[Building Lego Fire Track]{How To Build A Lego Fire Track % And Why It Is Fun} % \end{verbatim} % The ``starred'' forms |\chapter*|, |\section*| etc. are used when % the corresponding division has no number (like unnumbered chapters in % the front matter). Since our sections, subsections and % subsusbsections are unnumbered anyway, this form has meaning only % for chapters (but can be used for other divisions as well). % % \DescribeMacro{\chapterart} % \DescribeMacro{\chapterartfile} % \emph{No Starch Press} books use ``circular art'' for chapter % openings (except for unnumbered chapters in the front matter). The % command |\chapterart| should be issued immediately % after |\chapter| command and before the first paragraph. Its % argument is the artwork used for the current chapter: % |\chapterart|\marg{\LaTeX{} commands}. In the % simplest case it is just inclusion of an external graphics file, for % example: % \begin{verbatim} % \chapterart{\includegraphics[width=1.264in]{firetrack.jpg}} % \end{verbatim} % Actually, this simplest case is so ubiquitous, that there is a % special command |\chapterartfile|\marg{filename} for it, so the % previous example can be simplified as % \begin{verbatim} % \chapterartfile{firetrack.jpg} % \end{verbatim} % However, you can use instead any \LaTeX{} commands to produce % the artwork. Rememer that it must be $1.264''\times1.222''$. % % The first paragraph after chapter start is typeset in larger size % font than the body font. If this paragraph is too long, you may % need to manually change the font size back in the middle of it. The % simplest way to do this is the combination % |\par\noindent\normalfont| in a strategic place. % % % \DescribeMacro{\part} % Sometimes larger books are separated into parts. The command % |\part|\marg{Title} is used to typeset parts. % %\subsubsection{Environments} %\label{sec:guide:lists} % % % \DescribeMacro{itemize} % \DescribeMacro{enumerate} % \DescribeMacro{description} % \DescribeMacro{aside} % \DescribeMacro{note} % \DescribeMacro{warning} % The class offers standard |itemize|, |enumerate| and |description| % environment. There are also special environments reserverd for % asides. The |aside| environment has a mandatory argument: aside % name. It typesets its contents in italics with the name in bold on % the marginh: % \begin{verbatim} % \begin{aside}{Reminder} % Do not forget to plug off the computer before doing any % modifications! % \end{aside} % \end{verbatim} % The environments |note| and |warning| are similar, but have % pre-defined names NOTE and WARNING, e.g % \begin{verbatim} % \begin{note} % Do not forget to plug off the computer before doing any % modifications! % \end{note} % \begin{warning} % Do not forget to plug off the computer before doing any % modifications! % \end{warning} % \end{verbatim} % % %\subsubsection{Tables and Figures} %\label{sec:guide:floats} % % There are several things to keep in mind when using tables and % figures with the class. % % The tables and figures are not centered. Neither are their % captions. The captions for figures go \emph{below} the figures, the % captions for tables go \emph{above} the tabular data. % % \DescribeMacro{\NextCaptionWidth}% % The captions of tables and figures are automatically typeset with % the same width as the table or figure. Sometimes, however, \LaTeX\ % makes a mistake in the calculation. In this case the macro % \cs{NextCaptionWidth}\marg{length} overrides this calculation and % sets the width of the caption for the next figure or table to % \marg{length}, for example % \begin{verbatim} % \NextCaptionWidth{2in} % \begin{figure} % ... % \caption{...} % \end{figure} % \end{verbatim} % % % Typesetting tables, unfortunately, is rarely done right, and % standard \LaTeX{} is not an exception. The authors are urged to % read the introduction to \progname{booktabs} % package~\cite{Fear05:Booktabs}. To summarize, % \begin{enumerate} % \item Never ever use vertical rules. % \item Never ever use double rules. % \item Use only |\toprule|, |\midrule| and |\bottomrule| for tables. % \end{enumerate} % \DescribeMacro{\tbfont} % \DescribeMacro{\thfont} % \DescribeMacro{tabular} % \emph{No Starch Press} uses special fonts for table body and table % header. Since there are too many tabular-like environments % (|tabular|, |tabbing|, |longtable|, \dots) we do not redefine them % switch on these fonts automatically, but rather provide two font % switching commands. The command |\tbfont| should be used % \emph{before} tabular environment, and the command |\thfont| should % be used in all header cells. Also, usually the table entries are % flushed left, so you might want to put |@{}| before the first column % declaration in |\begin{tabular}| to suppress the padding on the % left. Here is an example of a properly % done table layout: % \begin{verbatim} % \begin{table} % \caption{Starch Content of Foods} % \label{tab:starch} % \tbfont % \begin{tabular}{@{}lr} % \toprule % \thfont Product & \thfont Starch Content, \% \\ % \midrule % Bran (wheat) & 23.0\\ % Brown rice (raw) & 80.0\\ % Brown bread (average) & 41.3\\ % White bread (average) & 46.7\\ % \bottomrule % \end{tabular} % \end{table} % \end{verbatim} % % % %\subsubsection{Code Fragments} %\label{sec:guide:code} % % The class provides two facilities for including code fragments in % the books. % % \DescribeMacro{Code} % For short unformatted code fragments the \progname{fancyvrb} % package~\cite{VanZandt98:Fancyvrb} facilities are recommended. This % package is automatically automatically loaded by the class. Long code % fragments should be % separated by rules; the class defines verbatim-like |Code| % environment, which does exactly this: % \begin{verbatim} % \begin{Code} % main() { % printf("Hello, World\n"); % } % \end{Code} % \end{verbatim} % See the documentation of~\cite{VanZandt98:Fancyvrb} about many % features of this package. % % For longer code fragments the \progname{listings} % package~\cite{Heinz07:Listings} is more appropriate. It is also % automatically loaded. This package provides a number of useful % features, well describe in its manual. We will briefly mention % several of them, which might be of interest for the authors of % \emph{No Starch Press}: % \begin{enumerate} % \item Automatic code formatting according to the rules of the chosen % program language (for example, |\lstset{language=C}| or % |\lstset{language=Lisp}|). % \item A rich set of different frames: ruled code with % |frame=lines|, boxed code with |frame=single| etc. % \item An option to add captions to the listings (the class % automatically formats the captions according to the style of % \emph{No Starch Press}). % \item An option to make a listing floating. % \item An option to automatically number code lines. % \item An option to add list of listings (with the command % |\lstlistoflistings|). % \end{enumerate} % % To make the code in |\verb| commands and |verbatim|-like % environments be typeset with the \progname{listings} package, you % may want to set |fancyvrb=true| in the preamble of your document. % % It should be noted that the authors are recommended \emph{not} to % use |\texttt| or |\tt| for inline code fragments. The proper way to % add inline code is |\verb| or |\lstinline| from the % \progname{listings} package. The difference is obvious, for % example, in quote characters. % % %\subsection{Boxes} %\label{sec:ug_boxes} % % \DescribeEnv{nspbox}% % You may put some information into \emph{boxes}. Boxes have a \emph{heading} % and a \emph{text}. The environment |nspbox| can be used to typeset % them, for example: % \begin{verbatim} % \begin{nspbox}{This is a heading} % This is a text for the box. % \end{nspbox} % \end{verbatim} % %\subsection{Back Matter} %\label{sec:guide:backmatter} % % \DescribeMacro{\backmatter} % Back matter includes bibliography, index, update page, colophon and % other material. It starts with the command |\backmatter|. % % % %\subsubsection{Bibliography} %\label{sec:guide:bibliography} % % \emph{No Starch Press} at present has no special style for % bibliography, so the authors have a relative freedom to choose one. % However, it would be a good idea to use the \progname{natbib} % package~\cite{Daly07:Natbib}. This class should work with % \progname{natbib}. % % No support for per chapter bibliography lists is provided by the % package. % % %\subsubsection{Index} %\label{sec:guide:index} % % The books published by \emph{No Starch Press} usually have index. % This package provides special style file |nostarch.ist| for index % formatting. % % % \DescribeMacro{\makeindex} % \DescribeMacro{\printindex} % To create index: % \begin{enumerate} % % \item Put in the preamble of your % document the command |\makeindex|. % \item In the body of your document use |\index| commands as % described in~\cite{Lamport94}. % \item Put in the Back Matter the command |\printindex| at the place % you want the index to be printed. % \item After a \progname{latex} run \progname{makeindex} with the % style |nostarch.ist|. In a Unix system the corresponding command is % \begin{verbatim} % makeindex -s nostarch.ist mydocument % \end{verbatim} % or, in a more verbose way % \begin{verbatim} % makeindex -s nostarch.ist -o mydocument.ind mydocument.idx % \end{verbatim} % (here we assume that your main file is |mydocument.tex|). % % Refer to the documentation of your \TeX{} system for the way to run % \progname{makeindex} on your computer. % \end{enumerate} % % %\subsubsection{Updates and Colophon} %\label{sec:guide:updates} % % \DescribeMacro{\updatespage} % \emph{No Starch Press} books usually have updates page, which lists % the Web address for updates, errata, etc. The command % |\updatespage| starts such page. You are free to choose any text % there. Note that if you use the package % \progname{nshypher}~\ref{sec:guide:hyperref}, then the command % |\url|\marg{URL} becomes a hyperlink in the electronic edition. % % % \DescribeMacro{\colophon} % The last part of Back Matter is usually a \emph{colophon} which % describes how the book was printed and typeset. The command % |\colophon| starts this part and prints some standard information % about your fonts and \LaTeX{} package. You may want to add some % information after this command. % % % \StopEventually{% % \clearpage % \bibliography{nostarch} % \bibliographystyle{unsrt}} % % \clearpage % % %\section{Implementation} %\label{sec:impl} % %\subsection{Identification} %\label{sec:ident} % % We start with the declaration who we are. Most |.dtx| files put % driver code in a separate driver file |.drv|. We roll this code into the % main file, and use the pseudo-guard || for it. % \begin{macrocode} %\NeedsTeXFormat{LaTeX2e} %<*gobble> \ProvidesFile{nostarch.dtx} % %\ProvidesClass{nostarch} %\ProvidesPackage{nshyper} %<*!ist> [2023/07/19 v2.4 Typesetting books for No Starch Press] % % \end{macrocode} % % And the driver code: % \begin{macrocode} %<*gobble> \documentclass{ltxdoc} \usepackage{array} \usepackage{url,amsfonts, tikz} \usepackage[breaklinks,colorlinks,linkcolor=black,citecolor=black, pagecolor=black,urlcolor=black,hyperindex=false]{hyperref} \usetikzlibrary{positioning} \PageIndex \CodelineIndex \RecordChanges \EnableCrossrefs \begin{document} \DocInput{nostarch.dtx} \end{document} % %<*class> % \end{macrocode} % % %\subsection{Options} %\label{sec:options} % %\begin{macro}{\ifnostarch@cfonts} % First, let us decide whether we have non-free fonts: % \begin{macrocode} \newif\ifnostarch@cfonts \nostarch@cfontstrue \DeclareOption{cfonts}{\nostarch@cfontstrue} \DeclareOption{nocfonts}{\nostarch@cfontsfalse} % \end{macrocode} % \end{macro} % % \begin{macro}{\ifnostarch@fontsdir} % \changes{v2.0}{2023/03/31}{Introduced macro} % We also need to check whether we want to use \emph{No Starch} in % house |fonts| directory % \begin{macrocode} \newif\ifnostarch@fontsdir \nostarch@fontsdirtrue \DeclareOption{fontsdir}{\nostarch@fontsdirtrue} \DeclareOption{nofontsdir}{\nostarch@fontsdirfalse} % \end{macrocode} % \end{macro} % % The size-changing options produce a warning: % \begin{macrocode} \long\def\nostarch@size@warning#1{% \ClassWarning{nostarch}{Size-changing option #1 will not be honored}}% \DeclareOption{8pt}{\nostarch@size@warning{\CurrentOption}}% \DeclareOption{9pt}{\nostarch@size@warning{\CurrentOption}}% \DeclareOption{10pt}{\nostarch@size@warning{\CurrentOption}}% \DeclareOption{11pt}{\nostarch@size@warning{\CurrentOption}}% \DeclareOption{12pt}{\nostarch@size@warning{\CurrentOption}}% % \end{macrocode} % % % % All other options are passed to \progname{book}: % \begin{macrocode} \DeclareOption*{\PassOptionsToClass{\CurrentOption}{book}} % \end{macrocode} % % Now we read the configuration file % \begin{macrocode} \InputIfFileExists{nostarch.cfg}{% \ClassInfo{nostarch}{% Loading configuration file nostarch.cfg}}{% \ClassInfo{nostarch}{% Configuration file nostarch.cfg is not found}} % \end{macrocode} % And process the options: % \begin{macrocode} \ProcessOptions\relax % \end{macrocode} % % % % % %\subsection{Loading Class and Packages} %\label{sec:loading} % % We start with the base class % \begin{macrocode} \LoadClass[10pt]{book} % \end{macrocode} % % A bunch of packages: % \begin{macrocode} \RequirePackage[table]{xcolor} \RequirePackage{iftex, ifpdf, longtable, fancyhdr, fancyvrb, booktabs, graphicx, listings, caption, makeidx, upquote, pifont, textcomp, xcolor, lmodern, nameref, float, amssymb, etoolbox, setspace, marginnote, url, subfigure} \RequirePackage[framemethod=TikZ]{mdframed} \RequirePackage{soul} \RequirePackage[T1]{fontenc} \RequirePackage{ragged2e} % \end{macrocode} % % We do not want the option |document| with \progname{ragged2e}: this % calls \progname{footmisc}, while we want our own footnotes: % \begin{macrocode} \RequirePackage{ragged2e} \setlength\RaggedRightParindent{\parindent} \RaggedRight % \end{macrocode} % % % \begin{macro}{\@nschapterpreamble} % This is the preamble to bibliography and index commands used when % \progname{nshyper} is loaded. Normally it is empty. % \begin{macrocode} \def\@nschapterpreamble{} % \end{macrocode} % % \end{macro} % % %\subsection{Fonts} %\label{sec:fonts} % % \begin{macro}{\nostarch@fontspath} % \changes{v2.0}{2023/03/31}{Introduced macro} % The path to load fonts % \begin{macrocode} \ifnostarch@fontsdir \def\nostarch@fontspath#1{Path=fonts/#1/,} \else \def\nostarch@fontspath#1{Path,} \fi % \end{macrocode} % \end{macro} % % If we have commercial fonts, we load them. % \begin{macrocode} \ifnostarch@cfonts \ifpdftex \ClassWarning{nostarch}{Commercial fonts usually require xelatex engine} \RequirePackage{nbaskerv}% \RequirePackage{futurans}% \RequirePackage[scaled=0.85]{thsmc}% \RequirePackage{dogma}% \newcommand{\dogma}{\fontfamily{fdg}\selectfont}% \else %XeTeX or LuaTeX \RequirePackage{fontspec} \newfontface\dogma[ \nostarch@fontspath{dogma} UprightFont=dogmab01.ttf, Ligatures=TeX ]{dogma} % Font used for chapter titles \newfontface\timesnewroman[ \nostarch@fontspath{tnr} UprightFont=times.ttf, BoldFont=timesbd.ttf, ItalicFont=timesi.ttf, BoldItalicFont=timesbi.ttf, Ligatures=TeX ]{timesnewroman} \newfontface\futurabook[ \nostarch@fontspath{futurans} UprightFont=FuturB37.ttf, BoldFont=FuturH79.ttf, ItalicFont=FutuBO08.ttf, BoldItalicFont=FutCBO63.ttf, Ligatures=TeX ]{futurabook} \newfontface\futuraheavy[ \nostarch@fontspath{futurans} UprightFont=FuturH79.ttf, Ligatures=TeX ]{futuraheavy} \newfontface\futuraboldc[ \nostarch@fontspath{futurans} UprightFont=futucb18.ttf, Ligatures=TeX ]{futuraboldc} \newfontface\futuraboldcoblique[ \nostarch@fontspath{futurans} UprightFont=FutCBO63.ttf, Ligatures=TeX ]{futuraboldcoblique} \newfontface\futuraoblique[ \nostarch@fontspath{futurans} UprightFont=FutuBO08.ttf, Ligatures=TeX ]{futuraoblique} \setmainfont{nbaskerv}[ \nostarch@fontspath{nbaskerv} UprightFont=NewBaskervilleEF-Roman.ttf, BoldFont=NewBaskervilleEF-Bold.ttf, ItalicFont=NewBaskervilleEF-RomanIta.ttf, BoldItalicFont=NewBaskervilleEF-BoldIta.ttf, Ligatures=TeX] \setmonofont[Scale=0.85, \nostarch@fontspath{thsmc} UprightFont=ThSMCP25.ttf, BoldFont=ThSMCB02.ttf, ItalicFont=ThSMCI29.ttf, BoldItalicFont=TSMCBI56.ttf]{thsmc} \setsansfont[ \nostarch@fontspath{futurans} UprightFont=futura.ttf, BoldFont=FuturB41.ttf, ItalicFont=FutuBO08.ttf, BoldItalicFont=FutCBO63.ttf, Ligatures=TeX ]{futurans} \fi % \end{macrocode} % Otherwise we just use sans serif font for dogma. % \begin{macrocode} \else \newcommand{\dgdefault}{\sfdefault}% \fi % \end{macrocode} % % A number of commands to provide font defaults in case we use % non-commercial fonts % \begin{macrocode} \providecommand{\dogma}{\fontfamily{dgdefault}\selectfont} \providecommand{\futuraboldc}{\fontfamily{\sfdefault}\fontseries{bc}% \selectfont} \providecommand{\futuraboldcoblique}{\fontfamily{\sfdefault}\fontseries{bc}% \itshape\selectfont} \providecommand{\futuraheavy}{\fontfamily{\sfdefault}\fontseries{hq}% \selectfont} \providecommand{\futurabook}{\fontfamily{\sfdefault}\fontseries{k}% \selectfont} % \end{macrocode} % % And switch to normal size---just in case % \begin{macrocode} \normalsize % \end{macrocode} % % Special commands for number balls % \begin{macro}{\wingding} % \changes{v2.0}{2023/03/31}{Introduced macro} % The number ball % \begin{macrocode} \newcommand{\wingding}[1]{\ding{\the\numexpr #1 + 181 \relax}} % \end{macrocode} % \end{macro} % \begin{macro}{\codewingding} % \changes{v2.0}{2023/03/31}{Introduced macro} % The number ball inside code % \begin{macrocode} \newcommand{\codewingding}[1]{\vbox{\llap{\wingding{#1}\hskip 0.5em}}} % \end{macrocode} % \end{macro} % % \begin{macro}{\menuarrow} % \changes{v2.0}{2023/04/08}{Introduced macro} % \begin{macrocode} \newcommand\menuarrow{\raisebox{.2ex}{\small $\blacktriangleright$}} % \end{macrocode} % \end{macro} % \begin{macro}{\bettertilde} % \changes{v2.0}{2023/04/04}{Introduced macro} % A tilde uses for some texts % \begin{macrocode} \newcommand{\bettertilde}{\raisebox{-1ex}{\textasciitilde}} % \end{macrocode} % \end{macro} % % \begin{macro}{\slashslash} % \changes{v2.0}{2023/04/04}{Introduced macro} % The special slash % \begin{macrocode} \newcommand{\slashslash}{% \raisebox{.53ex}{% \scalebox{.5}{% \rotatebox[origin=c]{18}{$\mathbf{/}$}% }% }% } % \end{macrocode} % \end{macro} % % \begin{macro}{\neq} % \changes{v2.0}{2023/04/04}{Introduced macro} % A better $\neq$ % \begin{macrocode} \renewcommand{\neq}{\mathrel {% \vphantom{=}% \ooalign{\kern.05em\smash{\slashslash}\hidewidth\cr$=$\cr}% }% } % \end{macrocode} % \end{macro} % % \begin{macro}{\keycap} % Taken from: % \url{https://tex.stackexchange.com/questions/55664/fake-small-caps-with-xetex-fontspec/225078} % \begin{macrocode} \newcommand\keycap[1]{\fauxschelper#1 \relax\relax} \def\fauxschelper#1 #2\relax{% \fauxschelphelp#1\relax\relax% \if\relax#2\relax\else\ \fauxschelper#2\relax\fi% } \def\Hscale{.83}\def\Vscale{.72}\def\Cscale{1.00} \def\fauxschelphelp#1#2\relax{% \ifnum`#1>``\ifnum`#1<`\{\scalebox{\Hscale}[\Vscale]{\uppercase{#1}}\else% \scalebox{\Cscale}[1]{#1}\fi\else\scalebox{\Cscale}[1]{#1}\fi% \ifx\relax#2\relax\else\fauxschelphelp#2\relax\fi} % \end{macrocode} % \end{macro} % %\subsection{Page Dimensions and Paragraphing} %\label{sec:page} % % \begin{macro}{\paperheight} % \begin{macro}{\paperwidth} % The trim size: % \begin{macrocode} \setlength{\paperheight}{9.25in} \setlength{\paperwidth}{7in} % \end{macrocode} % \end{macro} % \end{macro} % \begin{macro}{\pdfpaperheight} % \begin{macro}{\pdfpaperwidth} % \begin{macro}{\pdfvorigin} % \begin{macro}{\pdfhorigin} % If we deal with \progname{pdftex}, we can use this information more % creatively. This was inspired by % \progname{memoir}~\cite{Wilson04:Memoir}. % \begin{macrocode} \ifpdf\relax \pdfpageheight=\paperheight \pdfpagewidth=\paperwidth \pdfvorigin=1in \pdfhorigin=1in \fi % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % % \begin{macro}{\topmargin} % \changes{v0.2}{2008/03/03}{Moved down} % \changes{v0.7}{2008/04/04}{Changed dimensions} % \changes{v1.1}{2008/05/24}{Made shorter} % The top margin is 0.625''. We use fake headers of 12pt: % \begin{macrocode} \setlength\topmargin{0.625in} \addtolength\topmargin{-1in} \addtolength\topmargin{-12pt} % \end{macrocode} % \end{macro} % \begin{macro}{\textheight} % This is the height of the text including footnotes, but excluding % running head and foot. % \begin{macrocode} \setlength\textheight{8in} \addtolength{\textheight}{-0.207in} % \end{macrocode} % Now we take care of the first line height: % \begin{macrocode} \addtolength\textheight{\topskip} % \end{macrocode} % \end{macro} % % \begin{macro}{\evensidemargin} % \begin{macro}{\oddsidemargin} % The margins on even and odd pages are 0.687''+0.833'' (margin par % width) + 0.167'' (margin par gap): % \begin{macrocode} \setlength\evensidemargin{0.687in} \addtolength{\evensidemargin}{-1in} \addtolength{\evensidemargin}{0.833in} \addtolength{\evensidemargin}{0.167in} \setlength\oddsidemargin{\evensidemargin} % \end{macrocode} % \end{macro} % \end{macro} % \begin{macro}{\textwidth} % The type area is 5.625'', but this includes side gap: % \begin{macrocode} \setlength\textwidth{5.625in} \addtolength\textwidth{-0.833in} \addtolength\textwidth{-0.167in} % \end{macrocode} % \end{macro} % % \begin{macro}{\parindent} % The paragraph indentation is 0.25'': % \begin{macrocode} \setlength\parindent{0.25in} % \end{macrocode} % \end{macro} % % % % \begin{macro}{\headheight} % \begin{macro}{\headsep} % We do not have headers in these books. Fancyhdr sets |headheight| % to 12pt, so we compensate it above in |\topmargin| % \begin{macrocode} \setlength\headheight{12pt} \setlength\headsep{0pt} % \end{macrocode} % \end{macro} % \end{macro} % % \begin{macro}{\footskip} % The footer is 8.792'' from top % \begin{macrocode} \setlength{\footskip}{9in} \addtolength{\footskip}{-\textheight} \addtolength{\footskip}{0.067in} \addtolength{\footskip}{\baselineskip} \addtolength{\footskip}{-1in} % \end{macrocode} % \end{macro} % % \begin{macro}{\widowpenalty} % \begin{macro}{\clubpenalty} % \changes{v0.3}{2008/03/11}{Changed settings} % We forbid widows and clubs. To prevent too extended pages we use % |\raggedbottom|: % \begin{macrocode} \widowpenalty=10000 \clubpenalty=10000 \raggedbottom % \end{macrocode} % % \end{macro} % \end{macro} % % \begin{macro}{\sochapter} % \changes{v2.0}{2023/04/04}{Introduced macro} % \begin{macro}{\sotitle} % \changes{v2.0}{2023/04/04}{Introduced macro} % \begin{macro}{\sobox} % \changes{v2.0}{2023/04/04}{Introduced macro} % \begin{macro}{\sonote} % \changes{v2.0}{2023/04/04}{Introduced macro} % Some spacing commands. % \begin{macrocode} \sodef\sochapter{}{.150em}{.5em}{1em} \sodef\sotitle{}{.125em}{.5em}{1em} \sodef\sobox{}{.075em}{.5em}{1em} \sodef\sonote{}{.200em}{.5em}{1em} % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % %\subsection{Headers and Footers} %\label{sec:headers} % % % \begin{macro}{\headrulewidth} % \begin{macro}{\footrulewidth} % We do not want decorative rules: % \begin{macrocode} \renewcommand{\headrulewidth}{0pt} \renewcommand{\footrulewidth}{0pt} % \end{macrocode} % \end{macro} % \end{macro} % % % We do not have headers: % \begin{macrocode} \pagestyle{fancy} \lhead{} \rhead{} \chead{} % \end{macrocode} % % The right footer is stuck 0.833''+0.167'' = 1'' to the right % \begin{macrocode} \fancyhfoffset[L]{1in} % \end{macrocode} % % On even pages we put page number and chapter title in footer. % \begin{macrocode} \fancyfoot[RO]{\sffamily \fontsize{6pt}{6pt}% \fontseries{lq}\selectfont\rightmark% \hspace{2em} \futuraboldc \fontsize{9pt}{6pt}\selectfont\thepage} \fancyfoot[LO]{} \fancyfoot[CO]{} % \end{macrocode} % % On even pages we put page number and chapter number in footer: % \begin{macrocode} \fancyfoot[LE]{\futuraboldc \fontsize{9pt}{6pt}% \selectfont\thepage% \fontseries{lq}\sffamily \fontsize{6pt}{6pt}\selectfont% \hspace{2em}\leftmark} \fancyfoot[RE]{} \fancyfoot[CE]{} % \end{macrocode} % % %\subsection{Front Matter} %\label{sec:frontmatter} % % % \begin{macro}{\subtitle} % \changes{v0.5}{2008/03/19}{Introduced the macro} % We use subtitle of the book\dots % \begin{macrocode} \newcommand{\subtitle}[1]{\gdef\@subtitle{#1}} % \end{macrocode} % \end{macro} % \begin{macro}{\@subtitle} % \changes{v0.5}{2008/03/19}{Introduced the macro} % \dots With empty default: % \begin{macrocode} \def\@subtitle{} % \end{macrocode} % \end{macro} % % \begin{macro}{\nostarchlogo} % \changes{v0.5}{2008/03/19}{Introduced the macro} % The logotype of the publisher: % \begin{macrocode} \newcommand{\nostarchlogo}[1]{\gdef\@nostarchlogo{#1}} % \end{macrocode} % \end{macro} % \begin{macro}{\@nostarchlogo} % \changes{v0.5}{2008/03/19}{Introduced the macro} % The default it empty: % \begin{macrocode} \def\@nostarchlogo{} % \end{macrocode} % \end{macro} % \begin{macro}{\nostarchlocation} % \changes{v0.5}{2008/03/19}{Introduced the macro} % Similarly for location: % \begin{macrocode} \newcommand{\nostarchlocation}[1]{\gdef\@nostarchlocation{#1}} % \end{macrocode} % \end{macro} % \begin{macro}{\@nostarchlocation} % \changes{v0.5}{2008/03/19}{Introduced the macro} % The default is SF: % \begin{macrocode} \def\@nostarchlocation{San Francisco} % \end{macrocode} % \end{macro} % % % \begin{macro}{\makehalftitle} % \changes{v0.5}{2008/03/19}{Introduced the macro} % \changes{v0.7}{2008/04/04}{Changed dimensions} % Now we are ready to typeset the half title page. It is flushed % right, cannot be to the left of the page center and must be 0.25'' % indented from the right: % \begin{macrocode} \def\makehalftitle{% \clearpage {\pagestyle{empty}\cleardoublepage}% \thispagestyle{empty}% \null%\vskip1.025in% \leavevmode\noindent\hspace{1.66in}% \begin{minipage}[t]{2.5625in}% \flushright \sffamily\bfseries\fontsize{12\p@}{13\p@}\selectfont \MakeUppercase{\@title}% \end{minipage}} % \end{macrocode} % \end{macro} % % % \begin{macro}{maketitle} % \changes{v0.5}{2008/03/19}{Changed LaTeX default} % \changes{v0.7}{2008/04/04}{Changed dimensions} % Now the main title page: % \begin{macrocode} \def\maketitle{% \bgroup \clearpage {\pagestyle{empty}\cleardoublepage}% \thispagestyle{empty}% \bgroup \list{}{\leftmargin-1in\rightmargin\z@\labelwidth\z@% \labelsep\z@\listparindent\z@\parsep\z@\itemsep\z@% \topsep\z@\partopsep\z@}% \item\relax \centering \null\vskip0.855in% {\dogma \fontsize{36\p@}{37\p@}\selectfont \MakeUppercase{\sotitle{\@title}}\par}% \if\@subtitle\@empty\relax\else {\null\vskip25\p@% \dogma \fontsize{24\p@}{25\p@}\selectfont \@subtitle\par}% \fi \vspace{2.15in}% \vspace{-\baselineskip}% {\futuraheavy\fontsize{18\p@}{22\p@}\selectfont by \@author\par}% \vspace{12\p@}% \vspace{\baselineskip}% \if\@nostarchlogo\@empty\relax\else \includegraphics[height=1.08in]{\@nostarchlogo}\par \fi \vspace{12\p@}% \normalfont\@nostarchlocation\par \endlist \egroup \clearpage\egroup} % \end{macrocode} % \end{macro} % % \begin{macro}{copyrightpage} % \changes{v0.5}{2008/03/19}{Introduced the macro} % This is the page copyright data: % \begin{macrocode} \newenvironment{copyrightpage}{% \clearpage \bgroup \list{}{\leftmargin-1in\rightmargin\z@\labelwidth\z@% \labelsep\z@\listparindent\z@\parsep8\p@\itemsep\z@% \topsep\z@\partopsep\z@}% \item\relax \thispagestyle{empty}% \normalfont\fontsize{8\p@}{10\p@}\selectfont}{% \endlist \egroup \clearpage} % \end{macrocode} % \end{macro} % % \begin{macro}{cipblock} % \changes{v0.5}{2008/03/19}{Introduced the macro} % CIP block is supposed to be in typewriter font. So we use % verbatim: % \begin{macrocode} \newenvironment{cipblock}{% \leavevmode\par\normalfont\fontsize{8\p@}{10\p@}\selectfont \textit{Library of Congress Cataloging-in-Publication Data}\par% \ttfamily\@vobeyspaces\obeylines \parindent\z@\parfillskip\@flushglue\parskip\z@skip}{\par\vskip8pt\relax} % \end{macrocode} % \end{macro} % % % \begin{macro}{dedicationpage} % \changes{v0.5}{2008/03/19}{Introduced the macro} % \changes{v2.0}{2023/04/04}{Rewritten} % Dedication is centered: % \begin{macrocode} \newenvironment{dedicationpage}{% \clearpage \bgroup \list{}{\leftmargin-1in\rightmargin\z@\labelwidth\z@% \labelsep\z@\listparindent\z@\parsep8\p@\itemsep\z@% \topsep\z@\partopsep\z@}% \item\relax \thispagestyle{empty}% \null\vskip1.175in% \centering\normalfont}{% \endlist \egroup \clearpage} % \end{macrocode} % \end{macro} % % %\subsection{Tables of Contents} %\label{sec:toc} % % Standard \LaTeX{} has just one table of contents. We have two. The % table of brief contents will have the extension |tbc|, while the % standard table of contents will have the standard extension |toc|. % % \begin{macro}{\briefcontentsname} % The name for brief contents % \begin{macrocode} \def\briefcontentsname{{Brief Contents}} % \end{macrocode} % % \end{macro} % % \begin{macro}{\contentsname} % Same with |\contentsname| % \begin{macrocode} \def\contentsname{Contents in Detail}% % \end{macrocode} % Special treatment if \progname{babel} is used: % \begin{macrocode} \AtBeginDocument{\@ifpackageloaded{babel}{% \addto\captionsenglish{% \renewcommand{\contentsname}% {Contents in Detail}}}{}} % \end{macrocode} % % \end{macro} % % \begin{macro}{\apptoc} % \changes{v2.0}{2023/04/14}{Added macro} % Changing chapter names in appendix % \begin{macrocode} \newcommand{\apptoc}{\renewcommand{\chaptername}{Appendix}} % \end{macrocode} % \end{macro} % % \begin{macro}{\brieftableofcontents} % \changes{v0.5}{2008/03/19}{Introduced macro} % \changes{v0.7}{2008/04/04}{Changed dimensions} % \changes{v0.8}{2008/04/07}{Changed dimensions} % \changes{v1.1}{2008/05/24}{Added toc name to the verso footers} % This is the new macro: % \begin{macrocode} \newcommand\brieftableofcontents{% \clearpage {\pagestyle{empty}\cleardoublepage}% \bgroup \thispagestyle{empty}% \markboth{\briefcontentsname}{\briefcontentsname}% \null\vskip0.925in% \list{}{\leftmargin-1.0in\rightmargin0.4in\labelwidth\z@% \labelsep\z@\listparindent\z@\parsep\z@\itemsep\z@% \topsep\z@\partopsep\z@}% \item\relax {\centering \dogma\fontsize{16\p@}{18\p@}\selectfont \MakeUppercase{\sochapter{Brief Contents}}\par}\vskip40pt% \@starttoc{tbc}% \endlist \egroup} % \end{macrocode} % % \end{macro} % \begin{macro}{\tableofcontents} % \changes{v0.5}{2008/03/19}{Changed LaTeX default} % \changes{v0.7}{2008/04/04}{Changed dimensions} % \changes{v0.8}{2008/04/07}{Changed dimensions} % \changes{v1.1}{2008/05/24}{Added toc name to the verso footers} % \changes{v1.2}{2008/06/01}{Added toc name to the verso footers} % This is the new macro: % \begin{macrocode} \renewcommand\tableofcontents{% \clearpage {\pagestyle{empty}\cleardoublepage}% \bgroup \thispagestyle{empty}% \markboth{\contentsname}{\contentsname}% \null\vskip0.175in% \list{}{\leftmargin-1.0in\rightmargin0.6in\labelwidth\z@% \labelsep\z@\listparindent\z@\parsep\z@\itemsep\z@% \topsep\z@\partopsep\z@}% \item\relax {\centering \dogma\fontsize{16\p@}{18\p@}\selectfont \MakeUppercase{\sochapter{Contents in Detail}}\par}\vskip18pt% \@starttoc{toc}% \endlist \egroup} % \end{macrocode} % \end{macro} % % \begin{macro}{\@dotsep} % \changes{v0.7}{2008/04/04}{Changed LaTeX default} % \changes{v0.8}{2008/04/07}{Tightened dots} % Standard \LaTeX{} provides 4.5 for the distance between dots. We % will make this tighter: % \begin{macrocode} \renewcommand\@dotsep{1.5} % \end{macrocode} % % \end{macro} % % \begin{macro}{\l@part} % \changes{v0.5}{2008/03/19}{Changed LaTeX default} % This is how we typeset parts in the table of contents % \begin{macrocode} \renewcommand*\l@part[2]{% \ifnum \c@tocdepth >-2\relax \addpenalty{-\@highpenalty}% \addvspace{28\p@}% \begingroup \parindent \z@ \rightskip \@pnumwidth \parfillskip -\@pnumwidth {\leavevmode \sffamily\bfseries\fontsize{12\p@}{14\p@}\selectfont #1}\par \nobreak \global\@nobreaktrue \everypar{\global\@nobreakfalse\everypar{}}% \endgroup \fi} % \end{macrocode} % \end{macro} % \begin{macro}{\l@chapter} % \changes{v0.5}{2008/03/19}{Changed LaTeX default} % This is how we typeset chapters in the table of contents % \begin{macrocode} \renewcommand*\l@chapter[2]{% \ifnum \c@tocdepth >\m@ne \addpenalty{-\@highpenalty}% \vskip 20\p@ \setlength\@tempdima{1.5em}% \begingroup \parindent \z@ \rightskip \@pnumwidth \parfillskip -\@pnumwidth \leavevmode \sffamily \bfseries \fontsize{10\p@}{12\p@}\selectfont{#1}% \nobreak\hfil \nobreak\hb@xt@\@pnumwidth{\hss #2}\par \vskip4\p@\penalty\@highpenalty \endgroup \fi} % \end{macrocode} % \end{macro} % % \begin{macro}{\sectionnumberwidth} % \changes{v1.3}{2008/06/06}{Introduced the length} % The number width for sections. Normally the width of |99.99| % \begin{macrocode} \newlength{\sectionnumberwidth} \settowidth{\sectionnumberwidth}{% \futurabook\fontsize{9\p@}{11\p@}\selectfont 99.99} % \end{macrocode} % \end{macro} % \begin{macro}{\boldsectionnumberwidth} % \changes{v2.0}{2023/04/06}{Introduced the length} % The number width for bold sections. Normally the width of |99.99| % \begin{macrocode} \newlength{\boldsectionnumberwidth} \settowidth{\boldsectionnumberwidth}{% \futuraheavy\fontsize{9\p@}{11\p@}\selectfont 99.99} % \end{macrocode} % \end{macro} % \begin{macro}{\subsectionnumberwidth} % \changes{v1.3}{2008/06/06}{Introduced the length} % The number width for subsections. Normally the width of % |99.99.99| % \begin{macrocode} \newlength{\subsectionnumberwidth} \settowidth{\subsectionnumberwidth}{% \futurabook\fontsize{9\p@}{11\p@}\selectfont 99.99.99} % \end{macrocode} % \end{macro} % % \begin{macro}{\l@section} % \changes{v0.5}{2008/03/19}{Changed LaTeX default} % \changes{v1.3}{2008/06/06}{Made number width user settable} % This is how we typeset sections in the table of contents % \begin{macrocode} \renewcommand{\l@section}[2]{\@dottedtocline{1}{\z@}{% \sectionnumberwidth}{% \futurabook\fontsize{9\p@}{11\p@}\selectfont#1}{% \futurabook\fontsize{9\p@}{11\p@}\selectfont#2}} % \end{macrocode} % \end{macro} % % \begin{macro}{\l@subsection} % \changes{v0.5}{2008/03/19}{Changed LaTeX default} % \changes{v1.1}{2008/05/24}{Changed numwidth} % \changes{v1.2}{2008/06/01}{Changed numwidth again} % \changes{v1.3}{2008/06/06}{Made number width user settable} % This is how we typeset subsections in the table of contents % \begin{macrocode} \renewcommand{\l@subsection}[2]{\@dottedtocline{2}{0.5in}% {\subsectionnumberwidth}{% \futurabook\fontsize{9\p@}{11\p@}\selectfont#1}{% \futurabook\fontsize{9\p@}{11\p@}\selectfont#2}} % \end{macrocode} % \end{macro} % % \begin{macro}{\l@boldsection} % \changes{v2.0}{2023/04/06}{Introduced the macro} % This is how we typeset bold sections in the table of contents % \begin{macrocode} \newcommand*\l@boldsection[2]{{\bfseries\@dottedtocline{1}{\z@}{% \boldsectionnumberwidth}{% \futuraheavy\fontsize{9\p@}{11\p@}\selectfont#1}{% \futuraheavy\fontsize{9\p@}{11\p@}\selectfont#2}}} % \end{macrocode} % \end{macro} % % % \begin{macro}{\l@bpart} % \changes{v0.6}{2008/03/21}{Introduced macro} % There is a special formatting of parts in the brief table of % contents: % \begin{macrocode} \newcommand*\l@bpart[2]{% \ifnum \c@tocdepth >-2\relax \addpenalty{-\@highpenalty}% \addvspace{14\p@}% \begingroup \parindent \z@ \rightskip \@pnumwidth \parfillskip -\@pnumwidth {\leavevmode \futuraheavy\fontsize{9\p@}{14\p@}\selectfont #1}\par\vskip7\p@% \nobreak \global\@nobreaktrue \everypar{\global\@nobreakfalse\everypar{}}% \endgroup \fi} % \end{macrocode} % \end{macro} % % \begin{macro}{\@pnumwidth} % \changes{v2.0}{2023/04/08}{Redefined macro} % \begin{macrocode} \renewcommand{\@pnumwidth}{17pt} % \end{macrocode} % \end{macro} % % \begin{macro}{\l@bchapter} % \changes{v0.6}{2008/03/21}{Introduced macro} % There is a special formatting of chapters in the brief table of % contents: % \begin{macrocode} \newcommand*\l@bchapter[2]{% \ifnum \c@tocdepth >\m@ne \addpenalty{-\@highpenalty}% \setlength\@tempdima{1.5em}% \begingroup \parindent \z@ \rightskip \@pnumwidth \parfillskip -\@pnumwidth \leavevmode \futurabook\fontsize{9\p@}{14\p@}\selectfont #1\nobreak\leaders\hbox{$\m@th \mkern \@dotsep mu\hbox{.}\mkern \@dotsep mu$}\hfill \nobreak\hb@xt@\@pnumwidth{\hss #2}\par \penalty\@highpenalty \endgroup \fi} % \end{macrocode} % \end{macro} % % %\subsection{Main Matter} %\label{sec:mainmatter} % % \begin{macro}{\mainmatter} % \changes{v0.6}{2008/03/19}{Changed LaTeX default} % We redefine |\mainmatter| to take care of that blank verso % page\dots % \begin{macrocode} \renewcommand\mainmatter{% \clearpage {\thispagestyle{empty}\cleardoublepage}% \@mainmattertrue \pagenumbering{arabic}} % \end{macrocode} % \end{macro} % % %\subsection{Back Matter} %\label{sec:backmatter} % % \begin{macro}{\backmatter} % \changes{v0.6}{2008/03/21}{Changed LaTeX default} % We redefine |\backmatter| to take care of that blank verso % page\dots % \begin{macrocode} \renewcommand\backmatter{% \clearpage {\thispagestyle{empty}\cleardoublepage}% \@mainmatterfalse} % \end{macrocode} % \end{macro} % % %\subsection{Sectioning} %\label{sec:sectioning} % % We do not number sections and below: % \begin{macrocode} \setcounter{secnumdepth}{0} % \end{macrocode} % % \begin{macro}{\sectionmark} % Our section commands do not mark: % \begin{macrocode} \def\sectionmark#1{}% % \end{macrocode} % \end{macro} % % % Chapters, unlike the ones in~\cite{classes}, have \emph{two} obligatory % arguments. The second argument is the command to fill the ``circular % graphics''. Otherwise we follow the design in~\cite{classes}. One % problem, however: we \emph{cannot} use |\secdef| because we have % three arguments, not two. % % % \begin{macro}{\if@firstpara} % We introduce a macro to get special typesetting for the first % paragraph after a part or a chapter begins: % \begin{macrocode} \newif\if@firstpara \@firstparafalse % \end{macrocode} % \end{macro} % % \begin{macro}{\turnoffbigpara} % \changes{v2.0}{2023/04/01}{Introduced macro} % And the code to manually turn it off % \begin{macrocode} \newcommand{\turnoffbigpara}{\@firstparafalse} % \end{macrocode} % \end{macro} % % \begin{macro}{\@chapterart} % We also keep track of the current artwork for chapter start: % \begin{macrocode} \def\@chapterart{} % \end{macrocode} % \end{macro} % % \begin{macro}{\secdef} % \changes{v0.6}{2008/03/21}{Changed LaTeX default} % The standard \LaTeX{} |secdef| assumes that starred commands have no % optional argument. This is not right for us: % \begin{macrocode} \def\secdef#1#2{\@ifstar{\@dblarg{#2}}{\@dblarg{#1}}} % \end{macrocode} % % \end{macro} % % % \begin{macro}{\part} % \changes{v0.5}{2008/03/16}{Changed LaTeX default} % Our parts differ from the ones in standard LaTeX since we use empty % pagestyle rather than plain in part pages. The trick with % |\cleardoublepage| is from~\cite{Oostrum04:Fancyhdr} % \begin{macrocode} \renewcommand\part{% \clearpage {\pagestyle{empty}\cleardoublepage}% \everypar{}% \markboth{}{}% \def\@chapterart{}% \thispagestyle{empty}% \null\vskip0.715in% \secdef\@part\@spart} % \end{macrocode} % \end{macro} % % \begin{macro}{\@part} % \changes{v0.5}{2008/03/16}{Changed LaTeX default} % \changes{v0.7}{2008/04/04}{Changed dimensions} % This code is used when we have a numbered part. % \begin{macrocode} \def\@part[#1]#2{% \ifnum \c@secnumdepth >-2\relax \refstepcounter{part}% \addcontentsline{toc}{part}{\MakeUppercase{\partname} \thepart\protect\linebreak\penalty\@highpenalty\MakeUppercase{#1}}% \addcontentsline{tbc}{bpart}{\MakeUppercase{\partname~\thepart: \futuraheavy #1}}% \else \addcontentsline{toc}{part}{\MakeUppercase{#1}}% \addcontentsline{tbc}{bpart}{\MakeUppercase{\futuraheavy #1}}% \fi {\centering \interlinepenalty \@M \normalfont \ifnum \c@secnumdepth >-2\relax \futuraboldc\fontsize{80pt}{80pt}\selectfont \MakeUppercase{\partname\nobreakspace\thepart}% \par \vskip 0.45in% \fi \dogma \fontsize{16pt}{16pt}\selectfont \MakeUppercase{\sochapter{#2}}\par}% \@endpart} % \end{macrocode} % \end{macro} % % \begin{macro}{\@spart} % \changes{v0.5}{2008/03/16}{Changed LaTeX default} % This is used for starred parts (probably not something we are % going to encounter\dots) % \begin{macrocode} \def\@spart[#1]#2{% \addcontentsline{toc}{part}{\MakeUppercase{#1}}% \addcontentsline{tbc}{bpart}{\MakeUppercase{#1}}% {\centering \dogma \fontsize{16pt}{16pt}\selectfont \MakeUppercase{\sochapter{#2}}\par}% \@endpart} % \end{macrocode} % \end{macro} % % \begin{macro}{\@endpart} % \changes{v0.5}{2008/03/16}{Changed LaTeX default} % When part is finished, we change the settings of the first paragraph: % \begin{macrocode} \def\@endpart{% \@afterindentfalse \vskip49\p@% \@firstparatrue \@afterheading} % \end{macrocode} % % \end{macro} % % \begin{macro}{\chapter} % \changes{v0.6}{2008/03/21}{Reverted to standard interface} % First, we suppress floats, set up empty page style and delete % indentation after the chapter. Then we check whether the chapter is % starred: % \begin{macrocode} \def\chapter{% \clearpage {\pagestyle{empty}\cleardoublepage}% \everypar{}% \thispagestyle{empty}% \global\@topnum\z@ \@afterindentfalse \gdef\@chapterart{}% \secdef\@chapter\@schapter} % \end{macrocode} % \end{macro} % % % \begin{macro}{\@chapter} % \changes{v0.2}{2008/03/04}{Moved up} % \changes{v0.6}{2008/03/21}{Reverted to standard interface} % \changes{v1.3}{2008/06/06}{Corrected a stupid mistake: put % refstepcounter out of a group} % The actual work is done by |\@chapter| macro. % \begin{macrocode} \def\@chapter[#1]#2{% \vspace*{0.622in} \ifnum \c@secnumdepth > \m@ne \refstepcounter{chapter}% \typeout{Chapter:\thechapter\space\@currentlabel}% \markboth{\@chapapp~\thechapter}{#1}% \typeout{\@chapapp\space\thechapter.}% \addcontentsline{toc}{chapter}{\thechapter% \protect\linebreak\penalty\@highpenalty \MakeUppercase{#1}}% \addcontentsline{tbc}{bchapter}{% \chaptername~\thechapter:~#1}% {\centering \futuraboldc\fontsize{120pt}{120pt} \selectfont \thechapter\par\nobreak\vskip27pt}% \else \addcontentsline{toc}{chapter}{% \MakeUppercase{#1}}% \addcontentsline{tbc}{bchapter}{#1}% \markboth{#1}{#1}% \fi {\centering \dogma\fontsize{16pt}{18pt}\selectfont \MakeUppercase{\sochapter{#2}}\par}\nobreak\vskip25pt\relax% \@firstparatrue \@afterheading}% % \end{macrocode} % \end{macro} % % \begin{macro}{\@schapter} % \changes{v0.6}{2008/03/21}{Reverted to standard interface} % \changes{v0.7}{2008/04/04}{Changed dimensions} % This is used when we have a starred chapter: % \begin{macrocode} \def\@schapter[#1]#2{% \vspace*{2.747in} {\centering \phantomsection \addcontentsline{toc}{chapter}{% \MakeUppercase{#1}}% \addcontentsline{tbc}{bchapter}{#1}% \markboth{#1}{#1}% {\fontsize{16pt}{18pt}\selectfont \MakeUppercase{\dogma \sochapter{#2}}\par}}\nobreak\vskip25pt\relax% \@firstparatrue \@afterheading}% % \end{macrocode} % \end{macro} % % \begin{macro}{\@afterheading} % \changes{v0.3}{2008/03/12}{Moved the circle art} % \changes{v0.4}{2008/03/14}{Added special treatment for the case of % empty chapter art} % \changes{v0.7}{2008/04/04}{Changed dimensions} % We cannot use the standard |\@afterheading| since we want to put the % first paragraph in larger font and put there the artwork. So we % take |\@afterheading| code and patch it: % \begin{macrocode} \def\@afterheading{% \@nobreaktrue \everypar{% \if@nobreak \@nobreakfalse \clubpenalty \@M \setbox\z@\lastbox \else \clubpenalty \@clubpenalty \everypar{}% \fi \if@firstpara % \end{macrocode} % The first paragraph has a special font and artwork in the beginning: % \begin{macrocode} \rule{\z@}{49\p@}% \ifx\@chapterart\@empty% \else \makebox[0pt][r]{\raisebox{-0.5in}[0pt][0pt]{% \@chapterart\hspace{0.21in}}}% \parshape=5 0.963in 3.622in 0.913in 3.672in 0.813in 3.772in 0.563in 4.022in 0in \textwidth \fi \fontsize{14pt}{16.5pt}\selectfont% \parskip=3pt \else \parskip=0pt \normalsize\selectfont \fi \@firstparafalse}}% % \end{macrocode} % \end{macro} % % \begin{macro}{\chapterwithquote} % \changes{v2.0}{2023/04/08}{Introduced the command} % \begin{macrocode} \def\chapterwithquote{% \clearpage {\pagestyle{empty}\cleardoublepage}% \everypar{}% \thispagestyle{empty}% \global\@topnum\z@ \@afterindentfalse \gdef\@chapterart{}% \secdef\@chapterwithquote\@schapter} % \end{macrocode} % \end{macro} % \begin{macro}{\@chapterwithquote} % \changes{v2.0}{2023/04/08}{Introduced the command} % \begin{macrocode} \def\@chapterwithquote[#1]#2#3#4{% \vspace*{0.622in} \ifnum \c@secnumdepth > \m@ne \refstepcounter{chapter}% \typeout{Chapter:\thechapter\space\@currentlabel}% \markboth{\@chapapp~\thechapter}{#1}% \typeout{\@chapapp\space\thechapter.}% \addcontentsline{toc}{chapter}{\thechapter% \protect\linebreak\penalty\@highpenalty \MakeUppercase{#1}}% \addcontentsline{tbc}{bchapter}{% \chaptername~\thechapter:~#1}% {\centering \futuraboldc\fontsize{120pt}{120pt} \selectfont \thechapter\par\nobreak\vskip27pt}% \else \addcontentsline{toc}{chapter}{% \MakeUppercase{#1}}% \addcontentsline{tbc}{bchapter}{#1}% \markboth{#1}{#1}% \fi {\centering \dogma\fontsize{16pt}{18pt}\selectfont \MakeUppercase{\sochapter{#2}}\par\vspace{.1in}\normalfont\fontsize{9pt}{11pt}\selectfont\textit{#3}\par\textit{\textemdash#4}\par}\nobreak\vskip25pt\relax% \@firstparatrue \@afterheading}% % \end{macrocode} % \end{macro} % % \begin{macro}{\chapterart} % \changes{v0.6}{2008/03/21}{Introduced the command} % This creates the chapterart: % \begin{macrocode} \newcommand{\chapterart}[1]{\gdef\@chapterart{#1}}% % \end{macrocode} % \end{macro} % % \begin{macro}{\chapterartfile} % \changes{v0.6}{2008/03/21}{Introduced the command} % The simplified version of |\chapterart|: % \begin{macrocode} \newcommand{\chapterartfile}[1]{\gdef\@chapterart{% \includegraphics[width=1.264in]{#1}}}% % \end{macrocode} % % \end{macro} % % % \begin{macro}{\section} % \changes{v0.3}{2008/03/09}{Changed indentation} % Sections correspond to |HeadA| in our specs. We use |\everypar{}| % in case section starts just after chapter start. % \begin{macrocode} \renewcommand{\section}{\everypar{}% \@startsection{section}{1}{-0.75in}{16pt}{6pt}{% \sffamily \bfseries \fontsize{12pt}{16pt}\selectfont}}% % \end{macrocode} % \end{macro} % % \begin{macro}{\subsection} % Subsections correspond to |HeadB| in our specs: % \begin{macrocode} \renewcommand{\subsection}{\everypar{}% \@startsection{subsection}{2}{0pt}{14pt}{4pt}{% \futuraboldcoblique \fontsize{12pt}{17pt}\selectfont}}% % \end{macrocode} % \end{macro} % % % \begin{macro}{\subsubsection} % Subsubsections correspond to |HeadC| in our specs: % \begin{macrocode} \renewcommand{\subsubsection}{\everypar{}% \@startsection{subsubsection}{3}{0pt}{10pt}{2pt}{% \futuraboldc \fontsize{10pt}{14pt}% \selectfont}}% % \end{macrocode} % \end{macro} % % We do not redefine levels below, leaving the options % from~\cite{classes} in place. % % % %\subsection{Lists} %\label{sec:lists} % % This follows design of~\cite{classes} with the values from our % specifications: % \begin{macro}{\leftmargin} % \begin{macro}{\leftmargini} % \begin{macro}{\leftmarginii} % \begin{macro}{\leftmarginiii} % \begin{macro}{\leftmarginiv} % The host of |\leftmargin| commands: % \begin{macrocode} \setlength{\leftmargin}{0.25in} \setlength{\leftmargini}{0.25in} \setlength{\leftmarginii}{0.25in} \setlength{\leftmarginiii}{0.25in} \setlength{\leftmarginiv}{0.25in} % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % % \begin{macro}{\rightmargin} % Right margin is always zero: % \begin{macrocode} \setlength{\rightmargin}{0pt} % \end{macrocode} % \end{macro} % % % \begin{macro}{\@listi} % \begin{macro}{\@listI} % This is the default list on the first level % \begin{macrocode} \def\@listi{\leftmargin\leftmargini \labelwidth\leftmargini\relax \advance\labelwidth-\labelsep\relax \parsep0\p@\relax \topsep6\p@\relax \itemsep4\p@\relax} \let\@listI\@listi % \end{macrocode} % \end{macro} % \end{macro} % % \begin{macro}{\@listii} % \begin{macro}{\@listiii} % \begin{macro}{\@listiv} % \begin{macro}{\@listv} % \begin{macro}{\@listvi} % And the lists for the next levels: % \begin{macrocode} \def\@listii{\leftmargin\leftmarginii \labelwidth\leftmarginii \advance\labelwidth-\labelsep \parsep0\p@\relax \topsep0\p@\relax \itemsep0\p@\relax} \def\@listiii{\leftmargin\leftmarginiii \labelwidth\leftmarginiii \advance\labelwidth-\labelsep \parsep0\p@\relax \topsep0\p@\relax \itemsep0\p@\relax} \def\@listiv{\leftmargin\leftmarginiv \labelwidth\leftmarginiv \advance\labelwidth-\labelsep \parsep0\p@\relax \topsep0\p@\relax \itemsep0\p@\relax} \def\@listv{\leftmargin\leftmarginv \labelwidth\leftmarginv \advance\labelwidth-\labelsep \parsep0\p@\relax \topsep0\p@\relax \itemsep0\p@\relax} \def\@listvi{\leftmargin\leftmarginvi \labelwidth\leftmarginvi \advance\labelwidth-\labelsep \parsep0\p@\relax \topsep0\p@\relax \itemsep0\p@\relax} % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % % \begin{macro}{itemize} % \changes{v0.2}{2008/03/03}{Flush left bullets} % We make bullets flushleft: % \begin{macrocode} \def\itemize{% \ifnum \@itemdepth >\thr@@\@toodeep\else \advance\@itemdepth\@ne \edef\@itemitem{labelitem\romannumeral\the\@itemdepth}% \expandafter \list \csname\@itemitem\endcsname {\def\makelabel##1{##1}}% \fi} % \end{macrocode} % % \end{macro} % % \begin{macro}{enumerate} % \changes{v0.2}{2008/03/03}{Flush left numbers} % We make numbering flushleft: % \begin{macrocode} \def\enumerate{% \ifnum \@enumdepth >\thr@@\@toodeep\else \advance\@enumdepth\@ne \edef\@enumctr{enum\romannumeral\the\@enumdepth}% \expandafter \list \csname label\@enumctr\endcsname {\usecounter\@enumctr\def\makelabel##1{##1}}% \fi} % \end{macrocode} % % \end{macro} % % \begin{macro}{description} % \changes{v2.0}{2023/04/08}{Redefined} % \begin{macrocode} \renewenvironment{description}% {\list{}{\labelwidth=0pt \leftmargin=18pt \let\makelabel\descriptionlabel}} {\endlist} % \end{macrocode} % \end{macro} % % \begin{macro}{quotation} % In |quotation| environment the paragraphs are indented. We use % 9pt Roman for quotations: % \begin{macrocode} \renewenvironment{quotation}{% \list{}{\listparindent\parindent\relax \itemindent\listparindent\relax \rightmargin0.5in\relax \leftmargin0.5in\relax}% \item\fontsize{9pt}{11pt}\selectfont}{\endlist} % \end{macrocode} % \end{macro} % % % \begin{macro}{quote} % Quote is for short quotations without indentations: % \begin{macrocode} \renewenvironment{quote}{% \list{}{\listparindent0pt\relax \itemindent\listparindent\relax \rightmargin0.5in\relax \leftmargin0.5in\relax}% \item\fontsize{9pt}{11pt}\selectfont}{\endlist} % \end{macrocode} % \end{macro} % % \begin{macro}{\aside} % \changes{v2.2}{2023/06/10}{Added macro} % An environment for asides. Italics with the name (the mandatory % arg) on the margin % \begin{macrocode} \newenvironment{aside}[1]{% \list{\makebox[0pt][r]{\dogma \fontsize{7.5pt}{12pt} \colorbox{black}{\textcolor{white}{\sonote{#1}}}\hspace{2em}}}{\listparindent0pt\relax \topsep9\p@\relax \itemindent0\p@\relax \rightmargin0\p@\relax \leftmargin0\p@\relax \labelwidth0\p@\relax \labelsep0\p@}% \item\itshape}{\vspace{-3pt}\endlist} % \end{macrocode} % \end{macro} % % \begin{macro}{\note} % \changes{v2.2}{2023/06/10}{Redefined using generic} % Note is in italics with % the word ``NOTE'' on the margin: % \begin{macrocode} \newenvironment{note}{\begin{aside}{NOTE}}{\end{aside}} % \end{macrocode} % \end{macro} % \begin{macro}{\warning} % \changes{v2.2}{2023/06/10}{Defined using generic} % Warning is in italics with % the word ``WARNING'' on the margin: % \begin{macrocode} \newenvironment{warning}{\begin{aside}{WARNING}}{\end{aside}} % \end{macrocode} % \end{macro} % % \begin{macro}{plainlist} % \changes{v2.0}{2023/04/08}{Added macro} \newenvironment{plainlist}{% \renewcommand{\descriptionlabel}[1]{\hspace{\labelsep}\textbf{##1}} % Add em space to description label \begin{description}% }{% \renewcommand{\descriptionlabel}[1]{\hspace{\labelsep}\textbf{##1 \quad}} % Add em space to description label \end{description}% } % \end{macro} % %\subsection{Footnotes} %\label{sec:footnotes} % % \begin{macro}{\footnoterule} % \changes{v0.3}{2008/03/11}{Increased kern above the rule} % \changes{v1.1}{2008/06/01}{Increased kern below the rule} % We want one inch by 0.25 footnote rule: % \begin{macrocode} \renewcommand\footnoterule{% \kern6\p@ \hrule height 0.25pt depth 0pt width 1in \kern2\p@} % \end{macrocode} % \end{macro} % % \begin{macro}{\@footnotetext} % \changes{v0.3}{2008/03/11}{Changed LaTeX default} % We want 4pt between footnotes. Unfortunately the standard % functions introduces |\@finalstrut|, which we do not need % here\dots % \begin{macrocode} \long\def\@footnotetext#1{\insert\footins{% \reset@font\footnotesize \interlinepenalty\interfootnotelinepenalty \splittopskip\footnotesep \splitmaxdepth \dp\strutbox \floatingpenalty \@MM \hsize\columnwidth \@parboxrestore \protected@edef\@currentlabel{% \csname p@footnote\endcsname\@thefnmark }% \color@begingroup \@makefntext{% \rule\z@{13.5pt}\ignorespaces#1}% \color@endgroup}}% % \end{macrocode} % \end{macro} % % \begin{macro}{\footins} % \changes{v0.3}{2008/03/11}{Changed LaTeX defaults} % We make some space between footnotes: % \begin{macrocode} \setlength{\skip\footins}{20\p@ \@plus 4\p@ \@minus 0\p@} % \end{macrocode} % % \end{macro} % % % \begin{macro}{\@makefntext} % \changes{v1.1}{2008/05/24}{Added space between footnote mark and % footnote text} % We do not indent the footnotes: % \begin{macrocode} % \renewcommand\@makefntext[1]{% % \parindent 0\p@% % \RaggedRightParindent0\p@% % \noindent % \@makefnmark\space#1} \renewcommand\@makefntext[1]{% \@thefnmark.~#1} % \end{macrocode} % \end{macro} % % %\subsection{Tables, Figures and Listings} %\label{sec:tbl_fig} % % \begin{macro}{\thefigure} % We want dash instead of dot between chapter number and figure % number: % \begin{macrocode} \renewcommand \thefigure {\ifnum \c@chapter>\z@ \thechapter-\fi \@arabic\c@figure} % \end{macrocode} % \end{macro} % \begin{macro}{\thetable} % We want dash instead of dot between chapter number and table % number: % \begin{macrocode} \renewcommand \thetable {\ifnum \c@chapter>\z@ \thechapter-\fi \@arabic\c@table} % \end{macrocode} % \end{macro} % \begin{macro}{\thelistings} % \changes{v1.4}{2020/04/24}{Added \cs{AtBeginDocument}} % And the same for listings. Note that listings package uses % \cs{AtBeginDocument}, so we need to postpone this % \begin{macrocode} \AtBeginDocument{% \renewcommand \thelstlisting {\ifnum \c@chapter>\z@ \thechapter-\fi \@arabic\c@lstlisting}% } % \end{macrocode} % \end{macro} % % Default listings settings % \begin{macrocode} \lstset{ frame = lines, showstringspaces=false, tabsize=4, title=\lstname, numbers = none, caption={}, literate={\ }{{\ }}1{"}{\textquotedbl}1, escapeinside={(@}{@)}, captionpos=b, basicstyle=\ttfamily, columns=fullflexible, moredelim=[is][\bfseries]{***}{***}, moredelim=[is][\itshape]{___}{___}, moredelim=[is][\bfseries\itshape]{&&&}{&&&}, aboveskip=8pt, } % \end{macrocode} % % \begin{macro}{codewide} % \changes{v2.0}{2023/4/08}{Added environment} % \begin{macrocode} \lstnewenvironment {codewide}[1][] { \renewcommand{\codewingding}[1] {\ding{\the\numexpr ##1 + 181 \relax}} \captionsetup[lstlisting]{font=nostarchfigfont,singlelinecheck=off, aboveskip=4pt, belowskip=-12pt, margin=-70pt} \lstset{ frame = lines, showstringspaces=false, tabsize=4, title=\lstname, numbers = none, literate={\ }{{\ }}1{"}{\textquotedbl}1, escapeinside={(@}{@)}, captionpos=b, caption={}, basicstyle=\ttfamily, columns=fullflexible, moredelim=[is][\bfseries]{***}{***}, moredelim=[is][\itshape]{___}{___}, moredelim=[is][\bfseries\itshape]{&&&}{&&&}, xleftmargin=-70pt, aboveskip=8pt, #1 }} { \renewcommand{\codewingding}[1] {\vbox{\llap{\wingding{#1}\hskip 0.5em}}} \captionsetup[lstlisting]{font=nostarchfigfont,singlelinecheck=off, aboveskip=4pt, belowskip=0pt, margin=0pt}} % \end{macrocode} % \end{macro} % % Setting up longtables % \begin{macrocode} \def\LTleft{\z@} \def\LTright{\fill} % \end{macrocode} % % \begin{macro}{\ifnostarch@overridecaptionwidth} % \changes{v2.1}{2023/04/09}{Introduced macro} % Whether the user wants to override automatically selected caption % width % \begin{macrocode} \newif\ifnostarch@overridecaptionwidth \nostarch@overridecaptionwidthfalse % \end{macrocode} % \end{macro} % % \begin{macro}{\nostarch@captionwidth} % \changes{v2.1}{2023/04/09}{Introduced macro} % The width of the caption. Either set by the user or measured % \begin{macrocode} \newlength\nostarch@captionwidth % \end{macrocode} % \end{macro} % % \begin{macro}{\NextCaptionWidth} % \changes{v2.1}{2023/04/09}{Introduced macro} % A user-level command to set the caption width % \begin{macrocode} \newcommand\NextCaptionWidth[1]{% \global\nostarch@overridecaptionwidthtrue \global\setlength{\nostarch@captionwidth}{#1}% } % \end{macrocode} % \end{macro} % % \begin{macro}{\nostarch@measurecaptionwidth} % \changes{v2.1}{2023/04/09}{Introduced macro} % We set \cs{nostarch@captionwidth} to the width of the last box % unless the flag \cs{ifnostarch@overridecaptionwidth} is set. At the % end we set the flag to false. % \begin{macrocode} \newcommand\nostarch@measurecaptionwidth{% \ifnostarch@overridecaptionwidth\else \par \setbox\@tempboxa\lastbox \setbox\@tempboxa=\hbox{\unhbox\@tempboxa}% \global\setlength{\nostarch@captionwidth}{\wd\@tempboxa}% \box\@tempboxa\par \fi \global\nostarch@overridecaptionwidthfalse } % \end{macrocode} % \end{macro} % % We measure the width at the begin of the figure caption. Note that % the cs{AtBeginCaption} hook is too late for us. % \begin{macrocode} \AtBeginDocument{% \pretocmd{\caption}{\def\@tempa{figure}% \ifx\@tempa\@captype\relax \nostarch@measurecaptionwidth \fi}{}{}} % \end{macrocode} % % % We declare the caption format for figures and tables % \begin{macrocode} \DeclareCaptionFormat*{nostarchfigtblformat}{% \parbox{\nostarch@captionwidth}{#1#2#3}} % \end{macrocode} % % Tables are more complex, because captions are \emph{before} the % tables. Therefore we need to write the width into aux file and read % it from there. Most of the ideas here are stolen from % \textsl{longtable} code. % % \begin{macro}{\nostarch@tbl@warn} % \changes{v2.1}{2023/04/10}{Introduced macro} % Whether to ask the user for rerun due to changed widths % \begin{macrocode} \def\nostarch@tbl@warn{} \AtEndDocument{\nostarch@tbl@warn} % \end{macrocode} % \end{macro} % % \begin{macro}{\c@nostarch@tbl} % \changes{v2.1}{2023/04/10}{Introduced macro} % We write the table width into the macro \cs{nostarch@tbl@N}, where % $N$ is the roman representation of the table number % \begin{macrocode} \newcounter{nostarch@tbl} % \end{macrocode} % \end{macro} % % \begin{macro}{\nostarch@read@tbl@width} % \changes{v2.1}{2023/04/10}{Introduced macro} % At the beginning of table environment we read the latest value of the % width for the given table and set the caption size % \begin{macrocode} \newcommand\nostarch@read@tbl@width{% \stepcounter{nostarch@tbl}% \expandafter\ifx\csname nostarch@tbl@\romannumeral\c@nostarch@tbl\endcsname\relax \edef\@tempa{\the\textwidth}% \else \edef\@tempa{\csname nostarch@tbl@\romannumeral\c@nostarch@tbl\endcsname}% \fi \expandafter\setlength\expandafter\nostarch@captionwidth\expandafter{\@tempa}% } \AtBeginEnvironment{table}{\nostarch@read@tbl@width} % \end{macrocode} % \end{macro} % % \begin{macro}{\nostarch@save@tbl@width} % \changes{v2.1}{2023/04/10}{Introduced macro} % At the end of the table environment we measure the width of the last % box and write it in the aux file. % \begin{macrocode} \newcommand\nostarch@save@tbl@width{% \nostarch@measurecaptionwidth \if@filesw \immediate\write\@auxout{% \gdef\expandafter\noexpand\csname nostarch@tbl@\romannumeral\c@nostarch@tbl\endcsname {\the\nostarch@captionwidth}}% \fi \expandafter\ifx\csname nostarch@tbl@\romannumeral\c@nostarch@tbl\endcsname\relax \edef\@tempa{\the\textwidth}% \else \edef\@tempa{\csname nostarch@tbl@\romannumeral\c@nostarch@tbl\endcsname}% \fi \expandafter\ifdim\@tempa=\nostarch@captionwidth\else \gdef\nostarch@tbl@warn{\ClassWarningNoLine{nostarch} {Table widths have changed. Rerun LaTeX.}} \fi } \pretocmd{\endtable}{\nostarch@save@tbl@width}{}{} % \end{macrocode} % \end{macro} % % The |H| specifier from the |float| package redefines the end of the % float, so we need to patch it too % \begin{macrocode} \pretocmd{\float@endH}{\def\@tempa{table}% \ifx\@tempa\@captype\nostarch@save@tbl@width\fi}{}{} % \end{macrocode} % % \begin{macro}{\nostarch@read@LT@width} % \changes{v2.1}{2023/04/10}{Introduced macro} % The long table version of setting caption width is different, % because a longtable knows its width. % \begin{macrocode} \def\nostarch@read@LT@width{% \ifnostarch@overridecaptionwidth\else \global\setlength{\nostarch@captionwidth}{\z@}% \bgroup \def\LT@entry##1##2{% \global\addtolength{\nostarch@captionwidth}{##2}}% \csname LT@\romannumeral\c@LT@tables\endcsname \egroup \fi \global\nostarch@overridecaptionwidthfalse } \AtBeginDocument{\pretocmd{\caption@LT@config}{\global\rownum=1\relax \nostarch@read@LT@width}{}{}} \AtBeginEnvironment{longtable}{\global\rownum=0\relax} % \end{macrocode} % \end{macro} % % % Fonts for captions % \begin{macrocode} \DeclareCaptionFont{nostarchfigfont}{\sffamily \itshape \fontsize{8.5pt}{9pt}\selectfont} \DeclareCaptionFont{nostarchtabfont}{\futurabook \fontsize{9pt}{9pt}\selectfont} % \end{macrocode} % And the setup % \begin{macrocode} \captionsetup[figure]{font=nostarchfigfont,singlelinecheck=off, aboveskip=8pt,belowskip=-8pt, format=nostarchfigtblformat} \captionsetup[lstlisting]{font=nostarchfigfont,singlelinecheck=off, aboveskip=4pt, belowskip=0pt} \captionsetup[table]{font=nostarchtabfont,singlelinecheck=off, aboveskip=0pt,belowskip=4pt, labelfont=bf, format=nostarchfigtblformat} % \end{macrocode} % % \begin{macro}{\captionlst} % \begin{macro}{\boxlst} % \begin{macro}{\tablelst} \newcommand{\captionlst}[1]{{\ttfamily \itshape \fontsize{10pt}{9pt}\selectfont #1}} \newcommand{\boxlst}[1]{{\ttfamily \fontsize{10pt}{9pt}\selectfont #1}} \newcommand{\tablelst}[1]{{\ttfamily \fontsize{10pt}{9pt}\selectfont #1}} % \end{macro} % \end{macro} % \end{macro} % % \begin{macro}{\tbfont} % This is the font used for table body: % \begin{macrocode} \def\tbfont{% \futurabook\fontsize{8.5pt}{10pt}\selectfont} % \end{macrocode} % \end{macro} % % \begin{macro}{\thfont} % Font for table headers: % \begin{macrocode} \def\thfont{% \futuraheavy\fontsize{9pt}{10pt}\selectfont} % \end{macrocode} % \end{macro} % \begin{macrocode} \AtBeginEnvironment{tabular}{\tbfont} \AtBeginEnvironment{longtable}{\tbfont} % \end{macrocode} % % \begin{macro}{\heawyrulewidth} % \begin{macro}{\lightrulewidth} % \begin{macro}{\cmidrulewidth} % Changing \progname{booktabs} defaults: % \begin{macrocode} \heavyrulewidth=3\p@ \lightrulewidth=1\p@ \cmidrulewidth=1.5\p@ % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % % % \begin{macro}{\bottomrule} % Our |\bottomrule| is thin: % \begin{macrocode} \def\bottomrule{\noalign{\ifnum0=`}\fi \@aboverulesep=\aboverulesep \global\@belowrulesep=\belowbottomsep \global\@thisruleclass=\@ne \@ifnextchar[{\@BTrule}{\@BTrule[\lightrulewidth]}} % \end{macrocode} % \end{macro} % % % \begin{macro}{\belowrulesep} % \begin{macro}{\belowbottomsep} % \begin{macro}{\abovetopsep} % Again redefining \progname{booktabs}: % \begin{macrocode} \belowrulesep=0.7ex \belowbottomsep=0.65pt \aboverulesep=0.7ex \abovetopsep=0.65pt % \end{macrocode} % % \end{macro} % \end{macro} % \end{macro} % % \begin{macro}{tablewide} % Wide table % \begin{macrocode} \newenvironment{tablewide}[1][] { \captionsetup[table]{font=nostarchtabfont,singlelinecheck=off, aboveskip=0pt,belowskip=4pt, labelfont=bf, margin=-70pt} \begin{table}[#1] } { \end{table} \captionsetup[table]{font=nostarchtabfont,singlelinecheck=off, aboveskip=0pt,belowskip=4pt, labelfont=bf, margin=0pt} } % \end{macrocode} % \end{macro} % % \begin{macro}{tabularwide} % Wide tabular % \begin{macrocode} \newenvironment{tabularwide}[1] { \hspace*{-72pt} \begin{tabular}{#1} } { \end{tabular} } % \end{macrocode} % \end{macro} % % \begin{macro}{figurewide} % Wide figure % \begin{macrocode} \newenvironment{figurewide}[1][] { \captionsetup[figure]{font=nostarchfigfont,singlelinecheck=off, aboveskip=8pt,belowskip=-8pt, margin=-70pt} \begin{figure}[#1] \hspace*{-70pt} } { \end{figure} \captionsetup[figure]{font=nostarchfigfont,singlelinecheck=off, aboveskip=8pt,belowskip=-8pt} } % \end{macrocode} % \end{macro} % % Setting up colors in tables % \begin{macrocode} \rowcolors[]{1}{}{nspgray} % \end{macrocode} % % We extend the height of the rows and delete the space arounr rules % \begin{macrocode} \setlength{\aboverulesep}{0pt} \setlength{\belowrulesep}{0pt} \setlength{\extrarowheight}{.8ex} % \end{macrocode} % %\subsection{Verbatim, url and Listings Customization} %\label{sec:verbatim} % % \begin{macro}{Code} % This is for framed code: % \begin{macrocode} \DefineVerbatimEnvironment{Code}{Verbatim}{frame=lines,framerule=0.25pt, commandchars=\\\{\}} % \end{macrocode} % \end{macro} % % % \begin{macro}{\FV@ListParameterHook} % The skip before code is too large for us % \begin{macrocode} \FV@AddToHook\FV@ListParameterHook{\vspace{-6pt}} % \end{macrocode} % \end{macro} % % We also enable verbatim footnotes. % \begin{macrocode} \VerbatimFootnotes % \end{macrocode} % % %\subsection{Boxes and projects} %\label{sec:boxes} % % Various boxes. % % \begin{macro}{nspgray} % The color for boxes % \begin{macrocode} \definecolor{nspgray}{cmyk}{0, 0, 0, 0.1} % \end{macrocode} % \end{macro} % % And various mdframed styled boxes % \begin{macrocode} \mdfdefinestyle{nspbox}{% linecolor=black, outerlinewidth=1pt, roundcorner=5pt, innertopmargin=\baselineskip, innerbottommargin=\baselineskip, innerrightmargin=18pt, innerleftmargin=18pt, backgroundcolor=nspgray, everyline=true } \mdfdefinestyle{custombox}{% linecolor=black, outerlinewidth=1pt, roundcorner=5pt, innertopmargin=\baselineskip, innerbottommargin=\baselineskip, innerrightmargin=18pt, innerleftmargin=18pt, everyline=true } \newenvironment{nspbox}[1] {\begin{mdframed}[style=nspbox] \begin{center} {\dogma \fontsize{9pt}{15pt} \MakeUppercase{\sobox{#1}}} \end{center} \begin{flushright} \begin{flushleft} \parskip=.5\baselineskip \tbfont } {\end{flushleft}\end{flushright} \end{mdframed}} \newenvironment{nspboxcontinued} {\begin{mdframed}[style=nspbox] \begin{flushright} \begin{flushleft} \parskip=.5\baselineskip \tbfont } { \end{flushleft} \end{flushright} \end{mdframed}} \newenvironment{custombox}[1] {\begin{mdframed}[style=custombox] \begin{center} {\dogma \fontsize{9pt}{15pt} \MakeUppercase{\sobox{#1}}} \end{center} \begin{flushright} \begin{flushleft} \parskip=.5\baselineskip \tbfont } {\end{flushleft}\end{flushright} \end{mdframed}} \newenvironment{customboxcontinued} {\begin{mdframed}[style=custombox] \begin{flushright} \begin{flushleft} \parskip=.5\baselineskip \tbfont } { \end{flushleft} \end{flushright} \end{mdframed}} \newcommand{\continued}[0]{% {\begin{flushright}% \emph{(continued)}% \end{flushright}}% } % \end{macrocode} % % % Project stuff % \begin{macrocode} \newcounter{project} \stepcounter{project} \newcommand{\projecthead}[1]{ \vspace{16pt}% \noindent% \hspace{-.75in}% \addcontentsline{toc}{boldsection}{Project~\#\theproject: #1}% {\sffamily\bfseries\fontsize{12pt}{16pt}\selectfont \colorbox{black}{\textcolor{white}{Project~\#\theproject: #1}}}% \vspace{6pt}% \@afterindentfalse\@afterheading% \refstepcounter{project}% } % \end{macrocode} % % Urls are typeset in italics, with upper tilde, and according to the % following rules: URLs should break \emph{before} periods, % underscores, equal signs, ampersands, and hyphens but \emph{after} % colons, slashes and hash marks. Also, we do not allow splitting % before slashes. % \begin{macro}{\UrlFont} % \changes{v2.1}{2023/04/08}{Redefined macro} % Urls are in italic % \begin{macrocode} \def\UrlFont{\itshape} % \end{macrocode} % \end{macro} % \begin{macro}{\UrlTildeSpecial} % \changes{v2.1}{2023/04/08}{Redefined macro} % \begin{macrocode} \def\UrlTildeSpecial{\do\~{\raise.2ex\hbox{\m@th$\scriptstyle\sim$}}} \let\Url@force@Tilde\UrlTildeSpecial % \end{macrocode} % \end{macro} % \begin{macro}{\UrlBreaks} % \changes{v2.1}{2023/04/08}{Redefined macro} % \changes{v2.1}{2023/04/10}{Moved slashes to specials} % Breaks after colons, slashes, hash marks. Colons are defined in % \cs{UrlBigBreaks}, so we need the other signs. We also add some % other signs here % \begin{macrocode} \def\UrlBreaks{\do\#\do\\\do\>\do\]\do\)\do\}} % \end{macrocode} % \end{macro} % \begin{macro}{\UrlSpecials} % \changes{v2.1}{2023/04/08}{Redefined macro} % \changes{v2.1}{2023/04/11}{Added slashes and double quote} % \changes{v2.3}{2023/06/18}{Moved out opening braces for % compatibility with amsmath} % \changes{v2.4}{2023/07/19}{Restored opening brackets using David % Carlisle's advice} % We add to macro special treatment of the chars with breaking URLs. % Slashes are interesting: we allow breaking after them, but not % before, even after other slashes or colons % \emph{before} them % \begin{macrocode} \g@addto@macro{\UrlSpecials}{% \do\.{\penalty\UrlBreakPenalty\mathchar46\relax}% \do\_{\penalty\UrlBreakPenalty\mathchar95\relax}% \do\={\penalty\UrlBreakPenalty\mathchar61\relax}% \do\&{\penalty\UrlBreakPenalty\mathchar38\relax}% \do\-{\penalty\UrlBreakPenalty\mathchar45\relax}% \do\!{\penalty\UrlBreakPenalty\mathchar33\relax}% \do\?{\penalty\UrlBreakPenalty\mathchar63\relax}% \do\|{\penalty\UrlBreakPenalty\mathchar124\relax}% \do\,{\penalty\UrlBreakPenalty\mathchar44\relax}% \do\;{\penalty\UrlBreakPenalty\mathchar59\relax}% \do\@{\penalty\UrlBreakPenalty\mathchar64\relax}% \do\'{\penalty\UrlBreakPenalty\mathchar39\relax}% \do\"{\penalty\UrlBreakPenalty\mathchar34\relax}% \do\+{\penalty\UrlBreakPenalty\mathchar43\relax}% \do\<{\penalty\UrlBreakPenalty\mathchar60\relax}% \do\[{\penalty\UrlBreakPenalty\mathchar91\relax}% \do\({\penalty\UrlBreakPenalty\mathchar40\relax}% \do\{{\penalty\UrlBreakPenalty\mathchar123\relax}% \do\/{\unpenalty\penalty\@M\mathchar47\penalty\UrlBreakPenalty}% } % \end{macrocode} % \end{macro} % % \begin{macro}{\UrlNoBreaks} % \changes{v2.1}{2023/04/08}{Redefined macro} % \changes{v2.3}{2023/06/18}{Removed redefinition} % We do not allow breaks in urls after brackets % \begin{macrocode} % \def\UrlNoBreaks{} % Rolled back redefinition % \end{macrocode} % \end{macro} % % \begin{macro}{\Url@MathSetup} % \changes{v2.4}{2023/07/19}{Added to the macro} % Amsmath redefines math catcodes every math expression. This lead to % incompatibility. By David Carlisle's advice, we reset this % resetting. We add this to the macro that is called at the beginning % of every url % \begin{macrocode} \g@addto@macro{\Url@MathSetup}{\let\resetMathstrut@\relax} % \end{macrocode} % \end{macro} % %\subsection{Margin notes} %\label{sec:margins} % % Filenames on margins % \begin{macrocode} \renewcommand*{\marginfont}{\sffamily\itshape\fontsize{8.5}{10}\selectfont} \renewcommand*{\marginnotevadjust}{-\baselineskip} \newcommand{\marginwingding}[1]{{\fontsize{10pt}{12pt}\selectfont \wingding{#1}}} % \end{macrocode} % % Code below makes the margin note always on the left, taken from: % \url{https://tex.stackexchange.com/questions/472728/marginnote-always-on-left-side-of-the-page} % \begin{macrocode} \long\def\@mn@@@marginnote[#1]#2[#3]{% \begingroup \ifmmode\mn@strut\let\@tempa\mn@vadjust\else \if@inlabel\leavevmode\fi \ifhmode\mn@strut\let\@tempa\mn@vadjust\else\let\@tempa\mn@vlap\fi \fi \@tempa{% \vbox to\z@{% \vss \@mn@margintest \if@reversemargin\if@tempswa \@tempswafalse \else \@tempswatrue \fi\fi \llap{% \vbox to\z@{\kern\marginnotevadjust\kern #3 \vbox to\z@{% \hsize\marginparwidth \linewidth\hsize \kern-\parskip %\mn@parboxrestore \marginfont\raggedleftmarginnote\strut\hspace{\z@}% \ignorespaces#1\endgraf \vss }% \vss }% \if@mn@verbose \PackageInfo{marginnote}{xpos seems to be \@mn@currxpos}% \fi \begingroup \ifx\@mn@currxpos\relax\else\ifx\@mn@currpos\@empty\else \kern\@mn@currxpos \fi\fi \ifx\@mn@currpage\relax \let\@mn@currpage\@ne \fi \if@twoside\ifodd\@mn@currpage\relax \kern-\oddsidemargin \else \kern-\evensidemargin \fi \else \kern-\oddsidemargin \fi \kern-1in \endgroup \kern\marginparsep }% }% }% \endgroup } % \end{macrocode} % %\subsection{Bibliography} %\label{sec:biblio} % % \begin{macro}{\bibsection} % \changes{v0.6}{2008/03/22}{Introduced the macro} % We actually use chapter for bibliographic sections, but here we % try to be nice to \progname{natbib}: % \begin{macrocode} \AtBeginDocument{ \def\bibsection{% \clearpage {\pagestyle{empty}\cleardoublepage}% \everypar{}% \thispagestyle{empty}% \global\@topnum\z@ \@afterindentfalse \gdef\@chapterart{}% \@nschapterpreamble \vspace*{0.622in}% \addcontentsline{toc}{chapter}{\MakeUppercase{\bibname}}% \addcontentsline{tbc}{bchapter}{\bibname}% {\centering {\dogma\fontsize{16pt}{20pt}\selectfont \MakeUppercase{\sochapter{\bibname}}\par}}\nobreak\vskip25pt\relax% \@mkboth{\bibname}{\bibname}}}% % \end{macrocode} % % \end{macro} % % % \begin{macro}{thebibliography} % \changes{v0.6}{2008/03/22}{Introduced the macro} % We want bibliography to be in the table of contents: % \begin{macrocode} \renewenvironment{thebibliography}[1]{% \bibsection \list{\@biblabel{\@arabic\c@enumiv}}% {\settowidth\labelwidth{\@biblabel{#1}}% \leftmargin\labelwidth \advance\leftmargin\labelsep \@openbib@code \usecounter{enumiv}% \let\p@enumiv\@empty \renewcommand\theenumiv{\@arabic\c@enumiv}}% \sloppy \clubpenalty4000 \@clubpenalty \clubpenalty \widowpenalty4000% \sfcode`\.\@m} {\def\@noitemerr {\@latex@warning{Empty `thebibliography' environment}}% \endlist} % \end{macrocode} % % \end{macro} % %\subsection{Index} %\label{sec:index} % % \begin{macro}{\term} % \changes{v2.0}{2023/04/04}{Introduced the macro} % An indexed term % \begin{macrocode} \newcommand{\term}[1]{\emph{#1}\index{#1}} % \end{macrocode} % \end{macro} % % \begin{macro}{theindex} % \changes{v0.6}{2008/03/22}{Introduced the macro} % We want our index to be in the table of contents too: % \begin{macrocode} \renewenvironment{theindex}{% \clearpage {\pagestyle{empty}\cleardoublepage}% \everypar{}% \thispagestyle{empty}% \global\@topnum\z@ \@afterindentfalse \gdef\@chapterart{}% \if@twocolumn \@restonecolfalse \else \@restonecoltrue \fi \twocolumn[% \@nschapterpreamble \vspace*{0.622in}% \addcontentsline{toc}{chapter}{\MakeUppercase{\indexname}}% \addcontentsline{tbc}{bchapter}{\indexname}% {\centering {\dogma% \fontsize{16pt}{20pt}\selectfont \MakeUppercase{\sochapter{\indexname}}\par}}% \nobreak\vskip25pt\relax]% \@mkboth{\indexname}% {\indexname}% \parindent\z@ \parskip\z@ \@plus .3\p@\relax \columnseprule \z@ \columnsep 0.25in% \let\item\@idxitem} {\if@restonecol\onecolumn\else\clearpage\fi} % \end{macrocode} % \end{macro} % % \begin{macro}{\@idxitem} % \changes{v0.6}{2008/03/22}{Changed default} % This is how we format level 1 index entries: % \begin{macrocode} \renewcommand\@idxitem{% \par\hangindent0.45in\normalfont\fontsize{9.5\p@}{11.5\p@}\selectfont \raggedright} % \end{macrocode} % \end{macro} % \begin{macro}{\subitem} % \changes{v0.6}{2008/03/22}{Changed default} % Level 2 entries: % \begin{macrocode} \renewcommand\subitem{\@idxitem \hspace*{0.15in}} % \end{macrocode} % \end{macro} % \begin{macro}{\subsubitem} % \changes{v0.6}{2008/03/22}{Changed default} % Level 3 entries: % \begin{macrocode} \renewcommand\subsubitem{\@idxitem \hspace*{0.3in}} % \end{macrocode} % \end{macro} % \begin{macro}{\indexspace} % \changes{v0.6}{2008/03/22}{Changed default} % The space between the groups % \begin{macrocode} \renewcommand\indexspace{\par \vskip 14\p@\relax} % \end{macrocode} % \end{macro} % \begin{macro}{\indexgroup} % \changes{v0.6}{2008/03/22}{Introduced the macro} % When an index starts a new letter, we call this macro: % \begin{macrocode} \newcommand\indexgroup[1]{{\futuraboldc \fontseries{bc}\fontsize{11\p@}{13\p@}\selectfont#1}\par\vskip4\p@} % \end{macrocode} % \end{macro} % % % %\subsection{Update Page and Colophon} %\label{sec:update_colophon} % % \begin{macro}{\updatesname} % \changes{v0.6}{2008/03/22}{Introduced the macro} % Just the name for updates: % \begin{macrocode} \def\updatesname{Updates} % \end{macrocode} % % \end{macro} % % % \begin{macro}{\updatespage} % \changes{v0.6}{2008/03/22}{Introduced the macro} % This is the command that start update page. It looks like % chapter, but it does not mark the pages or appear in the tables of % contents: % \begin{macrocode} \newcommand\updatespage{% \clearpage {\pagestyle{empty}\cleardoublepage}% \everypar{}% \thispagestyle{empty}% \global\@topnum\z@ \gdef\@chapterart{}% \vspace*{1.875in}% {\centering \dogma% \fontsize{16pt}{20pt}\selectfont \MakeUppercase{\sochapter{\updatesname}}\par\nobreak\vskip40\p@}% \@nobreaktrue \everypar{% \if@nobreak \@nobreakfalse \clubpenalty \@M \setbox\z@\lastbox \else \clubpenalty \@clubpenalty \everypar{}% \fi}} % \end{macrocode} % \end{macro} % % % \begin{macro}{\colophonname} % \changes{v0.6}{2008/03/22}{Introduced the macro} % Just the name for colophon: % \begin{macrocode} \def\colophonname{Colophon} % \end{macrocode}% % \end{macro} % % % \begin{macro}{\colophon} % Colophon does not start a separate page: % \changes{v0.6}{2008/03/22}{Introduced the macro} % \begin{macrocode} \newcommand\colophon{% \everypar{}% \global\@topnum\z@ \gdef\@chapterart{}% \vspace*{0.875in}% %{\centering %\dogma% % \fontsize{16pt}{20pt}\selectfont %\MakeUppercase{\sochapter{\colophonname}}\par\nobreak\vskip40\p@}% \@nobreaktrue \everypar{% \if@nobreak \@nobreakfalse \clubpenalty \@M \setbox\z@\lastbox \else \clubpenalty \@clubpenalty \everypar{}% \fi}\par The fonts used in \emph{\@title} are New Baskerville, Futura, The Sans Mono Condensed, and Dogma. The book was typeset with \LaTeXe{} package \texttt{nostarch} by Boris Veytsman with many additions by Alex Freed and other members of the \emph{No Starch Press} team \emph{(\csname ver@nostarch.cls\endcsname).}\par} % \end{macrocode} % \end{macro} % %\subsection{End of Class} %\label{end} % % % \begin{macrocode} % % \end{macrocode} % %\subsection{Dealing with \progname{hyperref}} %\label{sec:hyperref} % % \changes{v0.6}{2008/03/22}{Introduced package \progname{nshyper}} % First, we load \progname{hyperref} with right options. I do not % know why bookmarks do not work, but this is important to switch off: % \begin{macrocode} %<*nshyper> \RequirePackage[breaklinks,colorlinks,linkcolor=black, citecolor=black,pagecolor=black,urlcolor=black,hyperindex]{hyperref} % \end{macrocode} % % \progname{hyperref} expects the starred parts and chapters to have % only one argument---but we have two! % \begin{macrocode} \AtBeginDocument{% \def\@schapter[#1]#2{% \H@old@schapter[#1]{#2}% \@nschapterpreamble}% \def\@spart[#1]#2{% \H@old@spart[#1]{#2}% \Hy@GlobalStepCount\Hy@linkcounter \xdef\@currentHref{part*.\the\Hy@linkcounter}% \Hy@raisedlink{\hyper@anchorstart{\@currentHref}\hyper@anchorend}}}% % \end{macrocode} % We change the preamble for bibliography and index: % \begin{macrocode} \def\@nschapterpreamble{% \begingroup \let\@mkboth\@gobbletwo \Hy@GlobalStepCount\Hy@linkcounter \xdef\@currentHref{\Hy@chapapp*.\the\Hy@linkcounter}% \Hy@raisedlink{\hyper@anchorstart{\@currentHref}\hyper@anchorend}% \endgroup} % \end{macrocode} % % We can add information about the file to the pdf metadata as well: % \begin{macrocode} \let\ns@old@maketitle\maketitle \def\maketitle{% \hypersetup{pdfauthor=\@author, pdftitle=\@title}% \ns@old@maketitle} % % \end{macrocode} % % %\subsection{\progname{MakeIndex} Style File} %\label{sec:makeindex} % \changes{v0.6}{2008/03/23}{Added \progname{MakeIndex} style} % % These lines will produce some warnings when % running Makeindex as they try to cover two different % versions of the program: % \begin{macrocode} %<*ist> lethead_prefix "\\indexgroup{" lethead_suffix "}\\nopagebreak\n" lethead_flag 1 heading_prefix "\\indexgroup{" heading_suffix "}\\nopagebreak\n" headings_flag 1 % % \end{macrocode} % % %\Finale %\clearpage % %\PrintChanges %\clearpage %\PrintIndex % \endinput