|
26 | 26 | \parindent = 0mm |
27 | 27 | \parskip = 2mm |
28 | 28 |
|
| 29 | +\pagestyle{empty} % start this way; change for |
| 30 | +\pagenumbering{roman} % ToC & chapters |
| 31 | +\setcounter{secnumdepth}{1} |
| 32 | + |
29 | 33 | % old code font selections: |
30 | 34 | \let\codefont=\tt |
31 | 35 | \let\sectcodefont=\tt |
|
36 | 40 | % Variable used by begin code command |
37 | 41 | \newlength{\codewidth} |
38 | 42 |
|
| 43 | +\newcommand{\examplevspace}{2mm} |
| 44 | +\newcommand{\exampleindent}{1cm} |
39 | 45 | % Command to start a code block (follow this by \begin{verbatim}) |
40 | | -\newcommand{\bcode}{ |
41 | | - % Calculate the text width for the minipage: |
42 | | - \setlength{\codewidth}{\linewidth} |
43 | | - \addtolength{\codewidth}{-\parindent} |
44 | | - % |
45 | | - \par |
46 | | - \vspace{3mm} |
47 | | - \indent |
48 | | - \begin{minipage}[t]{\codewidth} |
| 46 | +\newcommand{\b@code}{% |
| 47 | + \begingroup% |
| 48 | + \setlength{\parindent}\exampleindent% |
| 49 | + % Calculate the text width for the minipage: |
| 50 | + \setlength{\codewidth}{\linewidth}% |
| 51 | + \addtolength{\codewidth}{-\parindent}% |
| 52 | + % |
| 53 | + \par% |
| 54 | + \vspace\examplevspace% |
| 55 | + \indent% |
| 56 | + \begin{minipage}[t]{\codewidth}% |
| 57 | + \small% |
49 | 58 | } |
50 | 59 |
|
51 | 60 | % Command to end a code block (precede this by \end{verbatim}) |
52 | | -\newcommand{\ecode}{ |
53 | | - \end{minipage} |
54 | | - \vspace{3mm} |
55 | | - \par |
56 | | - \noindent |
| 61 | +\newcommand{\e@code}{% |
| 62 | + \end{minipage}% |
| 63 | + \endgroup% |
57 | 64 | } |
58 | 65 |
|
| 66 | +\let\OldVerbatim=\verbatim |
| 67 | +\let\OldEndVerbatim=\endverbatim |
| 68 | +\renewcommand{\verbatim}{\b@code\OldVerbatim} |
| 69 | +\renewcommand{\endverbatim}{\OldEndVerbatim\e@code} |
| 70 | + |
| 71 | +% Augment the sectioning commands used to get our own font family in |
| 72 | +% place: |
| 73 | +\newcommand{\HeaderFamily}{\sffamily} |
| 74 | +\renewcommand{\section}{\@startsection {section}{1}{\z@}% |
| 75 | + {-3.5ex \@plus -1ex \@minus -.2ex}% |
| 76 | + {2.3ex \@plus.2ex}% |
| 77 | + {\reset@font\Large\HeaderFamily}} |
| 78 | +\renewcommand{\subsection}{\@startsection{subsection}{2}{\z@}% |
| 79 | + {-3.25ex\@plus -1ex \@minus -.2ex}% |
| 80 | + {1.5ex \@plus .2ex}% |
| 81 | + {\reset@font\large\HeaderFamily}} |
| 82 | +\renewcommand{\subsubsection}{\@startsection{subsubsection}{3}{\z@}% |
| 83 | + {-3.25ex\@plus -1ex \@minus -.2ex}% |
| 84 | + {1.5ex \@plus .2ex}% |
| 85 | + {\reset@font\normalsize\HeaderFamily}} |
| 86 | +\renewcommand{\paragraph}{\@startsection{paragraph}{4}{\z@}% |
| 87 | + {3.25ex \@plus1ex \@minus.2ex}% |
| 88 | + {-1em}% |
| 89 | + {\reset@font\normalsize\HeaderFamily}} |
| 90 | +\renewcommand{\subparagraph}{\@startsection{subparagraph}{5}{\parindent}% |
| 91 | + {3.25ex \@plus1ex \@minus .2ex}% |
| 92 | + {-1em}% |
| 93 | + {\reset@font\normalsize\HeaderFamily}} |
| 94 | + |
| 95 | + |
59 | 96 | % Underscore hack (only act like subscript operator if in math mode) |
60 | 97 | % |
61 | 98 | % The following is due to Mark Wooding (the old version didn't work with |
|
72 | 109 | \expandafter\endgroup\next |
73 | 110 |
|
74 | 111 | % |
75 | | -% This is the old hack, which didn't work with 2e. |
76 | | -% If you're still using Latex 2.09, you can give it a try if the above fails. |
| 112 | +% This is the old hack, which didn't work with 2e. |
| 113 | +% You should not need this since the rest of the documentation is now |
| 114 | +% LaTeX2e-only. |
77 | 115 | % |
78 | 116 | %\def\_{\ifnum\fam=\ttfamily \char'137\else{\tt\char'137}\fi} |
79 | 117 | %\catcode`\_=12 |
80 | 118 | %\catcode`\_=\active\def_{\ifnum\fam=\ttfamily \char'137 \else{\tt\char'137}\fi} |
81 | 119 |
|
82 | 120 |
|
| 121 | + |
83 | 122 | %% Lots of index-entry generation support. |
84 | 123 |
|
85 | | -% Command to wrap around stuff that refers to function/module/attribute names |
86 | | -% in the index. Default behavior: like \code{}. To just keep the index |
87 | | -% entries in the roman font, uncomment the second definition to use instead; |
88 | | -% it matches O'Reilly style more. |
| 124 | +% Command to wrap around stuff that refers to function / module / |
| 125 | +% attribute names in the index. Default behavior: like \code{}. To |
| 126 | +% just keep the index entries in the roman font, uncomment the second |
| 127 | +% definition to use instead; it matches O'Reilly style more. |
| 128 | +% |
89 | 129 | \newcommand{\idxcode}[1]{\codefont{#1}} |
90 | 130 | %\renewcommand{\idxcode}[1]{#1} |
91 | 131 |
|
|
103 | 143 | \index{#4!#1 #2 #3} |
104 | 144 | } |
105 | 145 |
|
106 | | -% Command to generate a reference to a function, statement, keyword, operator |
| 146 | +% Command to generate a reference to a function, statement, keyword, |
| 147 | +% operator. |
107 | 148 | \newcommand{\stindex}[1]{\indexii{statement}{#1@{\idxcode{#1}}}} |
108 | 149 | \newcommand{\opindex}[1]{\indexii{operator}{#1@{\idxcode{#1}}}} |
109 | 150 | \newcommand{\exindex}[1]{\indexii{exception}{#1@{\idxcode{#1}}}} |
|
129 | 170 | \newcommand{\stmodindex}[1]{\defmodindex{#1}{standard }} |
130 | 171 |
|
131 | 172 | % Additional string for an index entry |
132 | | -\newcommand{\indexsubitem}{} |
133 | | -\newcommand{\setindexsubitem}[1]{\renewcommand{\indexsubitem}{#1}} |
134 | | -\newcommand{\ttindex}[1]{\index{#1@{\idxcode{#1}} \indexsubitem}} |
| 173 | +\newcommand{\index@subitem}{} |
| 174 | +\newcommand{\setindexsubitem}[1]{\renewcommand{\index@subitem}{#1}} |
| 175 | +\newcommand{\ttindex}[1]{\index{#1@{\idxcode{#1}} \index@subitem}} |
135 | 176 |
|
136 | 177 |
|
137 | 178 | % from user-level, fulllineitems should be called as an environment |
|
146 | 187 | % \begin{cfuncdesc}{type}{name}{arglist} |
147 | 188 | % ... description ... |
148 | 189 | % \end{cfuncdesc} |
149 | | -\newcommand{\cfuncline}[3]{\item[\code{#1 #2(\varvars{#3})}]\ttindex{#2}} |
| 190 | +\newcommand{\cfuncline}[3]{\item[\code{#1 \bfcode{#2}(\varvars{#3})}]\ttindex{#2}} |
150 | 191 | \newcommand{\cfuncdesc}[3]{\fulllineitems\cfuncline{#1}{#2}{#3}} |
151 | 192 | \let\endcfuncdesc\endfulllineitems |
152 | 193 |
|
153 | | -\newcommand{\cvarline}[2]{\item[\code{#1 #2}]\ttindex{#2}} |
| 194 | +\newcommand{\cvarline}[2]{\item[\code{#1 \bfcode{#2}}]\ttindex{#2}} |
154 | 195 | \newcommand{\cvardesc}[2]{\fulllineitems\cvarline{#1}{#2}} |
155 | 196 | \let\endcvardesc\endfulllineitems |
156 | 197 |
|
157 | | -\newcommand{\ctypeline}[1]{\item[\code{#1}]\ttindex{#1}} |
| 198 | +\newcommand{\ctypeline}[1]{\item[\bfcode{#1}]\ttindex{#1}} |
158 | 199 | \newcommand{\ctypedesc}[1]{\fulllineitems\ctypeline{#1}} |
159 | 200 | \let\endctypedesc\endfulllineitems |
160 | 201 |
|
161 | 202 | % funcdesc should be called as an \begin{funcdesc} ... \end{funcdesc} |
162 | | -\newcommand{\funcline}[2]{\item[\code{#1(\varvars{#2})}]\ttindex{#1}} |
| 203 | +\newcommand{\funcline}[2]{\item[\code{\bfcode{#1}(\varvars{#2})}]\ttindex{#1}} |
163 | 204 | \newcommand{\funcdesc}[2]{\fulllineitems\funcline{#1}{#2}} |
164 | 205 | \let\endfuncdesc\endfulllineitems |
165 | | -\newcommand{\optional}[1]{{\textnormal{\Large[}}{#1}\hspace{0.5mm}{\textnormal{\Large]}} } |
| 206 | +\newcommand{\optional}[1]{{\textnormal{\Large[}}{#1}\hspace{0.5mm}{\textnormal{\Large]}}} |
166 | 207 |
|
167 | 208 |
|
168 | 209 | % same for excdesc |
169 | | -\newcommand{\excline}[1]{\item[\code{#1}]\ttindex{#1}} |
| 210 | +\newcommand{\excline}[1]{\item[\bfcode{#1}]\ttindex{#1}} |
170 | 211 | \newcommand{\excdesc}[1]{\fulllineitems\excline{#1}} |
171 | 212 | \let\endexcdesc\endfulllineitems |
172 | 213 |
|
173 | 214 | % same for datadesc |
174 | | -\newcommand{\dataline}[1]{\item[\code{#1}]\ttindex{#1}} |
| 215 | +\newcommand{\dataline}[1]{\item[\bfcode{#1}]\ttindex{#1}} |
175 | 216 | \newcommand{\datadesc}[1]{\fulllineitems\dataline{#1}} |
176 | 217 | \let\enddatadesc\endfulllineitems |
177 | 218 |
|
178 | 219 |
|
179 | 220 | % opcodedesc should be called as an \begin{opcodedesc} ... \end{opcodedesc} |
180 | | -\newcommand{\opcodeline}[2]{\item[\code{#1\quad\varvars{#2}}]\ttindex{#1}} |
| 221 | +\newcommand{\opcodeline}[2]{\item[\bfcode{#1}\quad\var{#2}]} |
181 | 222 | \newcommand{\opcodedesc}[2]{\fulllineitems\opcodeline{#1}{#2}} |
182 | 223 | \let\endopcodedesc\endfulllineitems |
183 | 224 |
|
184 | 225 |
|
185 | 226 | \let\nodename=\label |
186 | 227 |
|
187 | | -%% For these commands, use \command{} to get the typography right, not |
188 | | -%% {\command}. This works better with the texinfo translation. |
| 228 | +% For these commands, use \command{} to get the typography right, not |
| 229 | +% {\command}. This works better with the texinfo translation. |
189 | 230 | \newcommand{\ABC}{{\sc abc}} |
190 | 231 | \newcommand{\UNIX}{{\sc Unix}} |
191 | 232 | \newcommand{\POSIX}{POSIX} |
|
199 | 240 | \newcommand{\code}[1]{{\@vobeyspaces\@noligs\def\{{\char`\{}\def\}{\char`\}}\def\~{\char`\~}\def\^{\char`\^}\def\e{\char`\\}\def\${\char`\$}\def\#{\char`\#}\def\&{\char`\&}\def\%{\char`\%}% |
200 | 241 | \mbox{\codefont{#1}}}} |
201 | 242 |
|
| 243 | +\newcommand{\bfcode}[1]{\code{\bfseries#1}} %bold-faced code font |
202 | 244 | \newcommand{\kbd}[1]{\mbox{\tt #1}} |
203 | 245 | \newcommand{\key}[1]{\mbox{\tt #1}} |
204 | 246 | \newcommand{\samp}[1]{\mbox{`\code{#1}'}} |
205 | | -% This weird definition of \var{} allows it to always appear in roman italics, |
206 | | -% and won't get funky in code fragments when we play around with fonts. |
207 | | -\newcommand{\var}[1]{\mbox{\textrm{\textit{#1\/}}}} |
| 247 | +% This weird definition of \var{} allows it to always appear in roman |
| 248 | +% italics, and won't get funky in code fragments when we play around |
| 249 | +% with fonts. |
| 250 | +\newcommand{\var}[1]{\mbox{\normalsize\textrm{\textit{#1\/}}}} |
208 | 251 | \newcommand{\dfn}[1]{{\em #1\/}} |
209 | 252 | \renewcommand{\emph}[1]{{\em #1\/}} |
210 | 253 | \newcommand{\strong}[1]{{\bf #1}} |
211 | 254 | % let's experiment with a new font: |
212 | | -\newcommand{\file}[1]{\mbox{`\textsf{#1}'}} |
| 255 | +\newcommand{\file}[1]{\mbox{`\small\textsf{#1}'}} |
| 256 | +\newcommand{\url}[1]{\mbox{\small\textsf{#1}}} |
| 257 | +\let\email=\url |
213 | 258 |
|
214 | 259 | \newcommand{\varvars}[1]{{\def\,{\/{\char`\,}}\var{#1}}} |
215 | 260 |
|
216 | 261 | \newif\iftexi\texifalse |
217 | 262 | \newif\iflatex\latextrue |
218 | 263 |
|
219 | | -% Proposed new macros: These should be used for all references to identifiers |
220 | | -% which are used to refer to instances of specific language constructs. See |
221 | | -% the names for specific semantic assignments. |
| 264 | +% These should be used for all references to identifiers which are |
| 265 | +% used to refer to instances of specific language constructs. See the |
| 266 | +% names for specific semantic assignments. |
222 | 267 | % |
223 | | -% For now, don't do anything really fancy with them; just use them as logical |
224 | | -% markup. This might change in the future. |
| 268 | +% For now, don't do anything really fancy with them; just use them as |
| 269 | +% logical markup. This might change in the future. |
225 | 270 | % |
226 | 271 | \let\module=\code |
227 | 272 | \let\keyword=\code |
|
236 | 281 |
|
237 | 282 | \newcommand{\manpage}[2]{{\emph{#1}(#2)}} |
238 | 283 | \newcommand{\rfc}[1]{RFC #1\index{RFC!RFC #1}} |
239 | | -\let\email=\code |
240 | | -\let\url=\code |
| 284 | +\newcommand{\program}[1]{\strong{#1}} |
241 | 285 |
|
242 | 286 |
|
243 | 287 | \newenvironment{tableii}[4]{\begin{center}\def\lineii##1##2{\csname#2\endcsname{##1}&##2\\}\begin{tabular}{#1}\hline#3\\ |
|
255 | 299 | % Sample usage: |
256 | 300 | % \begin{seealso} |
257 | 301 | % \seemodule{rand}{Uniform random number generator}; % Module xref |
258 | | -% \seetext{{\em Encyclopedia Britannica}}. % Ref to a book |
| 302 | +% \seetext{\emph{Encyclopedia Britannica}}. % Ref to a book |
259 | 303 | % \end{seealso} |
260 | 304 |
|
261 | | -\newenvironment{seealso}[0]{{\bf See Also:}\par}{\par} |
| 305 | +\newenvironment{seealso}[0]{\strong{See Also:}\par}{\par} |
262 | 306 | \newcommand{\seemodule}[2]{\ref{module-#1}: \module{#1}\quad(#2)} |
263 | 307 | \newcommand{\seetext}[1]{\par{#1}} |
264 | 308 |
|
265 | | -% Fix the theindex environment to add an entry to the Table of Contents; |
266 | | -% this is much nicer than just having to jump to the end of the book and |
267 | | -% flip around, especially with multiple indexes. |
| 309 | +% Fix the theindex environment to add an entry to the Table of |
| 310 | +% Contents; this is much nicer than just having to jump to the end of |
| 311 | +% the book and flip around, especially with multiple indexes. |
268 | 312 | % |
269 | 313 | \let\OldTheindex=\theindex |
270 | 314 | \renewcommand{\theindex}{% |
|
287 | 331 | \OldEndAbstract |
288 | 332 | } |
289 | 333 |
|
290 | | -% \mytableofcontents wraps the \tableofcontents macro with all the magic to |
291 | | -% get the spacing right and have the right number of pages if the 'openright' |
| 334 | +% This wraps the \tableofcontents macro with all the magic to get the |
| 335 | +% spacing right and have the right number of pages if the 'openright' |
292 | 336 | % option has been used. This eliminates a fair amount of crud in the |
293 | 337 | % individual document files. |
294 | 338 | % |
|
308 | 352 | \fi% |
309 | 353 | }% |
310 | 354 | \pagebreak% |
| 355 | + \pagenumbering{arabic}% |
311 | 356 | } |
312 | 357 |
|
313 | | -% Allow the release number to be specified independently of the \date{}. This |
314 | | -% allows the date to reflect the document's date and release to specify the |
315 | | -% Python release that is documented. |
| 358 | +% Allow the release number to be specified independently of the |
| 359 | +% \date{}. This allows the date to reflect the document's date and |
| 360 | +% release to specify the Python release that is documented. |
| 361 | +% |
316 | 362 | \newcommand{\@release}{} |
317 | 363 | \newcommand{\version}{} |
318 | 364 | \newcommand{\releasename}{Release} |
319 | 365 | \newcommand{\release}[1]{% |
320 | 366 | \renewcommand{\@release}{\releasename\space\version}% |
321 | | - \renewcommand{\version}{#1}% |
322 | | -} |
| 367 | + \renewcommand{\version}{#1}} |
323 | 368 |
|
324 | | -% Allow specification of the author's address separately from the author's |
325 | | -% name. This can be used to format them differently, which is a good thing. |
| 369 | +% Allow specification of the author's address separately from the |
| 370 | +% author's name. This can be used to format them differently, which |
| 371 | +% is a good thing. |
| 372 | +% |
326 | 373 | \newcommand{\@authoraddress}{} |
327 | 374 | \newcommand{\authoraddress}[1]{\renewcommand{\@authoraddress}{#1}} |
328 | 375 |
|
329 | | -% Change the title page to look a bit better, and fit in with the fncychap |
330 | | -% ``Bjarne'' style a bit better. |
| 376 | +% Change the title page to look a bit better, and fit in with the |
| 377 | +% fncychap ``Bjarne'' style a bit better. |
| 378 | +% |
331 | 379 | \renewcommand{\maketitle}{\begin{titlepage}% |
332 | 380 | \let\footnotesize\small |
333 | 381 | \let\footnoterule\relax |
334 | 382 | \@ifundefined{ChTitleVar}{}{% |
335 | 383 | \mghrulefill{\RW}}% |
336 | 384 | \begin{flushright}% |
337 | | - {\huge \@title \par}% |
338 | | - {\em\LARGE \@release \par} |
| 385 | + {\rm\Huge\HeaderFamily \@title \par}% |
| 386 | + {\em\LARGE\HeaderFamily \@release \par} |
339 | 387 | \vfill |
340 | | - {\LARGE \@author \par} |
| 388 | + {\LARGE\HeaderFamily \@author \par} |
341 | 389 | \vfill\vfill |
342 | 390 | {\large |
343 | 391 | \@date \par |
|
352 | 400 | \gdef\@thanks{}\gdef\@author{}\gdef\@title{} |
353 | 401 | } |
354 | 402 |
|
355 | | -% ``minitoc'' support; works fairly well but not all chapters do well with it. |
356 | | -% Has some weird side effects that I haven't tracked down; don't use it for |
357 | | -% real at this time. |
| 403 | +% ``minitoc'' support; works fairly well but not all chapters do well |
| 404 | +% with it. Has some weird side effects that I haven't tracked down; |
| 405 | +% don't use it for real at this time. |
358 | 406 | % |
359 | | -% To enable, uncomment the following line only: |
| 407 | +% To enable, uncomment the following line only (don't do it!): |
360 | 408 | %\RequirePackage{minitoc} |
| 409 | +% |
| 410 | +% Maybe this should all be removed. But I think something like this |
| 411 | +% would be really nice if it can be integrated with the ``list of |
| 412 | +% modules'' at the top of module-documentation chapters. But it might |
| 413 | +% require a completely new environment, perhaps based on {list}. |
361 | 414 |
|
362 | 415 | % Leave the rest as-is: |
363 | 416 | \newif\if@minitocprinted |
|
401 | 454 | \typeout{Including mini Tables of Contents in each chapter.} |
402 | 455 | } |
403 | 456 |
|
404 | | -% This sets up the fancy chapter headings that make the documents look at |
405 | | -% least a little better than the usual LaTeX output. |
| 457 | +% This sets up the fancy chapter headings that make the documents look |
| 458 | +% at least a little better than the usual LaTeX output. |
406 | 459 | % |
407 | 460 | \RequirePackage[Bjarne]{fncychap} |
408 | 461 | \@ifundefined{ChTitleVar}{}{ |
409 | | - \ChTitleVar{\raggedleft \rm\Huge} |
| 462 | + \ChNameVar{\raggedleft\normalsize\HeaderFamily} |
| 463 | + \ChNumVar{\raggedleft \bfseries\Large\HeaderFamily} |
| 464 | + \ChTitleVar{\raggedleft \rm\Huge\HeaderFamily} |
410 | 465 | % This creates chapter heads without the leading \vspace*{}: |
411 | 466 | \def\@makechapterhead#1{% |
412 | 467 | {\parindent \z@ \raggedright \normalfont |
|
0 commit comments