| Guido van Rossum | ecae0b7 | 1996-06-26 19:03:20 +0000 | [diff] [blame] | 1 | % |
| Fred Drake | fb5e54d | 1998-02-19 06:23:06 +0000 | [diff] [blame] | 2 | % myformat.sty for the Python doc [works only with with Latex2e] |
| Guido van Rossum | ecae0b7 | 1996-06-26 19:03:20 +0000 | [diff] [blame] | 3 | % |
| 4 | |
| Fred Drake | 06f169b | 1998-02-11 23:08:20 +0000 | [diff] [blame] | 5 | \NeedsTeXFormat{LaTeX2e}[1995/12/01] |
| 6 | \ProvidesPackage{myformat} |
| Fred Drake | 76183c0 | 1998-02-16 22:30:10 +0000 | [diff] [blame] | 7 | [1998/01/11 |
| Fred Drake | 06f169b | 1998-02-11 23:08:20 +0000 | [diff] [blame] | 8 | LaTeX package (Python manual markup)] |
| 9 | |
| Fred Drake | 76183c0 | 1998-02-16 22:30:10 +0000 | [diff] [blame] | 10 | % Optional packages: |
| 11 | % |
| 12 | % If processing of these documents fails at your TeX installation, |
| 13 | % these may be commented out (independently) to make things work. |
| 14 | % These are both supplied with the current version of the teTeX |
| 15 | % distribution. |
| 16 | % |
| 17 | % The "fancyhdr" package makes nicer page footers reasonable to |
| 18 | % implement, and is used to put the chapter and section information in |
| 19 | % the footers. |
| 20 | % |
| 21 | % The "times" package makes the default font the PostScript Times |
| 22 | % font, which makes for smaller PostScript and a font that more people |
| 23 | % like. |
| 24 | % |
| Fred Drake | fb5e54d | 1998-02-19 06:23:06 +0000 | [diff] [blame] | 25 | % The "fncychap" package is used to get the nice chapter headers. The |
| 26 | % .sty file is distributed with Python, so you should not need to disable |
| Fred Drake | eb9b831 | 1998-02-23 21:37:27 +0000 | [diff] [blame] | 27 | % it. You'd also end up with a mixed page style; uglier than stock LaTeX! |
| Fred Drake | fb5e54d | 1998-02-19 06:23:06 +0000 | [diff] [blame] | 28 | % |
| 29 | \RequirePackage{fancyhdr}\typeout{Using fancier footers than usual.} |
| Fred Drake | 76183c0 | 1998-02-16 22:30:10 +0000 | [diff] [blame] | 30 | \RequirePackage{times}\typeout{Using times fonts instead of Computer Modern.} |
| Fred Drake | fb5e54d | 1998-02-19 06:23:06 +0000 | [diff] [blame] | 31 | \RequirePackage[Bjarne]{fncychap}\typeout{Using nice chapter headings.} |
| Fred Drake | 76183c0 | 1998-02-16 22:30:10 +0000 | [diff] [blame] | 32 | |
| 33 | |
| Fred Drake | 9cf4bbd | 1998-02-25 15:29:43 +0000 | [diff] [blame] | 34 | % for PDF output, use maximal compression |
| Fred Drake | eb9b831 | 1998-02-23 21:37:27 +0000 | [diff] [blame] | 35 | \@ifundefined{pdfannotlink}{ |
| Fred Drake | 9cf4bbd | 1998-02-25 15:29:43 +0000 | [diff] [blame] | 36 | \let\LinkColor=\relax |
| 37 | \let\NormalColor=\relax |
| Fred Drake | eb9b831 | 1998-02-23 21:37:27 +0000 | [diff] [blame] | 38 | }{% |
| Fred Drake | 9cf4bbd | 1998-02-25 15:29:43 +0000 | [diff] [blame] | 39 | \input{pdfcolor} |
| 40 | \let\LinkColor=\NavyBlue |
| 41 | \let\NormalColor=\Black |
| Fred Drake | 4186cd3 | 1998-02-18 17:21:09 +0000 | [diff] [blame] | 42 | \pdfcompresslevel=9 |
| Fred Drake | 9cf4bbd | 1998-02-25 15:29:43 +0000 | [diff] [blame] | 43 | \let\OldContentsline=\contentsline |
| 44 | \renewcommand{\contentsline}[3]{% |
| 45 | \OldContentsline{#1}{% |
| 46 | \pdfannotlink attr{/Border [0 0 0]} goto name{page.#3}% |
| 47 | \LinkColor#2\NormalColor% |
| 48 | \pdfendlink% |
| 49 | }{#3}% |
| 50 | } |
| Fred Drake | 4186cd3 | 1998-02-18 17:21:09 +0000 | [diff] [blame] | 51 | \let\OldLabel=\label |
| 52 | \renewcommand{\label}[1]{% |
| 53 | \OldLabel{#1}% |
| Fred Drake | 9cf4bbd | 1998-02-25 15:29:43 +0000 | [diff] [blame] | 54 | {\pdfdest name{label.#1} fit}% |
| Fred Drake | 4186cd3 | 1998-02-18 17:21:09 +0000 | [diff] [blame] | 55 | } |
| Fred Drake | 9cf4bbd | 1998-02-25 15:29:43 +0000 | [diff] [blame] | 56 | % This stuff adds a page.# destination to every PDF page, where # has |
| 57 | % the same formatting as the displayed page number. This doesn't really |
| 58 | % help with the frontmatter, but does fine with the body. |
| 59 | % |
| 60 | % This is *heavily* based on the hyperref package. |
| 61 | % |
| 62 | \def\@begindvi{% |
| 63 | \unvbox \@begindvibox |
| 64 | \@hyperfixhead |
| 65 | \global\let \@begindvi \@hyperfixhead |
| 66 | } |
| 67 | \def\hyperpageanchor{% |
| 68 | \hyper@anchorstart{page.\thepage}\hyper@anchorend |
| 69 | } |
| 70 | \let\HYPERPAGEANCHOR\hyperpageanchor |
| 71 | \def\@hyperfixhead{% |
| 72 | \let\H@old@thehead\@thehead |
| 73 | \gdef\@foo{\pdfdest name{page.\thepage} fit}% |
| 74 | \expandafter\ifx\expandafter\@empty\H@old@thehead |
| 75 | \def\H@old@thehead{\hfil}\fi |
| 76 | \def\@thehead{\@foo\relax\H@old@thehead}% |
| 77 | } |
| Fred Drake | 4186cd3 | 1998-02-18 17:21:09 +0000 | [diff] [blame] | 78 | } |
| Fred Drake | 30d1782 | 1998-02-17 15:56:55 +0000 | [diff] [blame] | 79 | |
| Guido van Rossum | daff175 | 1997-06-02 17:35:01 +0000 | [diff] [blame] | 80 | % Increase printable page size (copied from fullpage.sty) |
| 81 | \topmargin 0pt |
| 82 | \advance \topmargin by -\headheight |
| 83 | \advance \topmargin by -\headsep |
| Fred Drake | 9e24309 | 1998-01-18 05:09:54 +0000 | [diff] [blame] | 84 | |
| Fred Drake | 9cf4bbd | 1998-02-25 15:29:43 +0000 | [diff] [blame] | 85 | % attempt to work a little better for A4 users |
| 86 | \@ifundefined{paperheight}{ |
| 87 | \textheight 9in |
| 88 | }{ |
| 89 | \textheight \paperheight |
| 90 | \advance\textheight by -2in |
| 91 | } |
| Fred Drake | 9e24309 | 1998-01-18 05:09:54 +0000 | [diff] [blame] | 92 | |
| Guido van Rossum | daff175 | 1997-06-02 17:35:01 +0000 | [diff] [blame] | 93 | \oddsidemargin 0pt |
| 94 | \evensidemargin \oddsidemargin |
| 95 | \marginparwidth 0.5in |
| Fred Drake | 9e24309 | 1998-01-18 05:09:54 +0000 | [diff] [blame] | 96 | |
| Guido van Rossum | daff175 | 1997-06-02 17:35:01 +0000 | [diff] [blame] | 97 | \textwidth 6.5in |
| 98 | |
| Guido van Rossum | 643d932 | 1992-03-31 18:53:47 +0000 | [diff] [blame] | 99 | % Style parameters and macros used by most documents here |
| Guido van Rossum | 5badc75 | 1992-03-06 10:55:46 +0000 | [diff] [blame] | 100 | \raggedbottom |
| 101 | \sloppy |
| Fred Drake | fb5e54d | 1998-02-19 06:23:06 +0000 | [diff] [blame] | 102 | \parindent = 0mm |
| 103 | \parskip = 2mm |
| 104 | \hbadness = 5000 % don't print trivial gripes |
| Guido van Rossum | 5badc75 | 1992-03-06 10:55:46 +0000 | [diff] [blame] | 105 | |
| Fred Drake | fb5e54d | 1998-02-19 06:23:06 +0000 | [diff] [blame] | 106 | \pagestyle{empty} % start this way; change for |
| 107 | \pagenumbering{roman} % ToC & chapters |
| Fred Drake | dc8af0a | 1998-02-13 06:48:05 +0000 | [diff] [blame] | 108 | \setcounter{secnumdepth}{1} |
| 109 | |
| Fred Drake | fb5e54d | 1998-02-19 06:23:06 +0000 | [diff] [blame] | 110 | % Use this to set the font family for headers and other decor: |
| 111 | \newcommand{\HeaderFamily}{\sffamily} |
| 112 | |
| Fred Drake | 76183c0 | 1998-02-16 22:30:10 +0000 | [diff] [blame] | 113 | % Redefine the 'normal' header/footer style when using "fancyhdr" package: |
| 114 | \@ifundefined{fancyhf}{}{ |
| Fred Drake | fb5e54d | 1998-02-19 06:23:06 +0000 | [diff] [blame] | 115 | % Use \pagestyle{normal} as the primary pagestyle for text. |
| 116 | \fancypagestyle{normal}{ |
| 117 | \fancyhf{} |
| 118 | \fancyfoot[LE,RO]{{\HeaderFamily\thepage}} |
| 119 | \fancyfoot[LO]{{\HeaderFamily\nouppercase{\rightmark}}} |
| 120 | \fancyfoot[RE]{{\HeaderFamily\nouppercase{\leftmark}}} |
| 121 | \renewcommand{\headrulewidth}{0pt} |
| 122 | \renewcommand{\footrulewidth}{0.4pt} |
| Fred Drake | 76183c0 | 1998-02-16 22:30:10 +0000 | [diff] [blame] | 123 | } |
| 124 | % Update the plain style so we get the page number & footer line, |
| 125 | % but not a chapter or section title. This is to keep the first |
| 126 | % page of a chapter and the blank page between chapters `clean.' |
| Fred Drake | fb5e54d | 1998-02-19 06:23:06 +0000 | [diff] [blame] | 127 | \fancypagestyle{plain}{ |
| 128 | \fancyhf{} |
| 129 | \fancyfoot[LE,RO]{{\HeaderFamily\thepage}} |
| 130 | \renewcommand{\headrulewidth}{0pt} |
| 131 | \renewcommand{\footrulewidth}{0.4pt} |
| Fred Drake | 76183c0 | 1998-02-16 22:30:10 +0000 | [diff] [blame] | 132 | } |
| 133 | % Redefine \cleardoublepage so that the blank page between chapters |
| Fred Drake | fb5e54d | 1998-02-19 06:23:06 +0000 | [diff] [blame] | 134 | % gets the plain style and not the fancy style. This is described |
| 135 | % in the documentation for the fancyhdr package by Piet von Oostrum. |
| 136 | \renewcommand{\cleardoublepage}{ |
| Fred Drake | 9cf4bbd | 1998-02-25 15:29:43 +0000 | [diff] [blame] | 137 | \clearpage\if@openright \ifodd\c@page\else |
| Fred Drake | 76183c0 | 1998-02-16 22:30:10 +0000 | [diff] [blame] | 138 | \hbox{} |
| 139 | \thispagestyle{plain} |
| 140 | \newpage |
| 141 | \if@twocolumn\hbox{}\newpage\fi\fi\fi} |
| 142 | } |
| 143 | |
| Fred Drake | 9e24309 | 1998-01-18 05:09:54 +0000 | [diff] [blame] | 144 | % old code font selections: |
| 145 | \let\codefont=\tt |
| 146 | \let\sectcodefont=\tt |
| 147 | |
| 148 | % (Haven't found a new one that gets <, >, and _ right without being |
| 149 | % monospaced.) |
| 150 | |
| Fred Drake | 9cf4bbd | 1998-02-25 15:29:43 +0000 | [diff] [blame] | 151 | |
| 152 | % This sets up the {verbatim} environment to be indented and a minipage, |
| 153 | % and to have all the other mostly nice properties that we want for |
| 154 | % code samples. |
| 155 | |
| Guido van Rossum | 4c22cb2 | 1991-01-25 13:28:15 +0000 | [diff] [blame] | 156 | % Variable used by begin code command |
| Guido van Rossum | 44000ed | 1991-01-24 16:54:29 +0000 | [diff] [blame] | 157 | \newlength{\codewidth} |
| Guido van Rossum | 44000ed | 1991-01-24 16:54:29 +0000 | [diff] [blame] | 158 | |
| Fred Drake | dc8af0a | 1998-02-13 06:48:05 +0000 | [diff] [blame] | 159 | \newcommand{\examplevspace}{2mm} |
| 160 | \newcommand{\exampleindent}{1cm} |
| Fred Drake | 9cf4bbd | 1998-02-25 15:29:43 +0000 | [diff] [blame] | 161 | |
| 162 | \let\OldVerbatim=\verbatim |
| 163 | \let\OldEndVerbatim=\endverbatim |
| 164 | \renewcommand{\verbatim}{% |
| Fred Drake | dc8af0a | 1998-02-13 06:48:05 +0000 | [diff] [blame] | 165 | \begingroup% |
| 166 | \setlength{\parindent}\exampleindent% |
| 167 | % Calculate the text width for the minipage: |
| 168 | \setlength{\codewidth}{\linewidth}% |
| 169 | \addtolength{\codewidth}{-\parindent}% |
| 170 | % |
| 171 | \par% |
| 172 | \vspace\examplevspace% |
| 173 | \indent% |
| 174 | \begin{minipage}[t]{\codewidth}% |
| Fred Drake | 9cf4bbd | 1998-02-25 15:29:43 +0000 | [diff] [blame] | 175 | \small% |
| 176 | \OldVerbatim% |
| Guido van Rossum | 4c22cb2 | 1991-01-25 13:28:15 +0000 | [diff] [blame] | 177 | } |
| Fred Drake | 9cf4bbd | 1998-02-25 15:29:43 +0000 | [diff] [blame] | 178 | \renewcommand{\endverbatim}{% |
| 179 | \OldEndVerbatim% |
| Fred Drake | dc8af0a | 1998-02-13 06:48:05 +0000 | [diff] [blame] | 180 | \end{minipage}% |
| 181 | \endgroup% |
| Guido van Rossum | 4c22cb2 | 1991-01-25 13:28:15 +0000 | [diff] [blame] | 182 | } |
| Guido van Rossum | 5badc75 | 1992-03-06 10:55:46 +0000 | [diff] [blame] | 183 | |
| Fred Drake | fb5e54d | 1998-02-19 06:23:06 +0000 | [diff] [blame] | 184 | % Augment the sectioning commands used to get our own font family in place: |
| Fred Drake | dc8af0a | 1998-02-13 06:48:05 +0000 | [diff] [blame] | 185 | \renewcommand{\section}{\@startsection {section}{1}{\z@}% |
| 186 | {-3.5ex \@plus -1ex \@minus -.2ex}% |
| 187 | {2.3ex \@plus.2ex}% |
| 188 | {\reset@font\Large\HeaderFamily}} |
| 189 | \renewcommand{\subsection}{\@startsection{subsection}{2}{\z@}% |
| 190 | {-3.25ex\@plus -1ex \@minus -.2ex}% |
| 191 | {1.5ex \@plus .2ex}% |
| 192 | {\reset@font\large\HeaderFamily}} |
| 193 | \renewcommand{\subsubsection}{\@startsection{subsubsection}{3}{\z@}% |
| 194 | {-3.25ex\@plus -1ex \@minus -.2ex}% |
| 195 | {1.5ex \@plus .2ex}% |
| 196 | {\reset@font\normalsize\HeaderFamily}} |
| 197 | \renewcommand{\paragraph}{\@startsection{paragraph}{4}{\z@}% |
| 198 | {3.25ex \@plus1ex \@minus.2ex}% |
| 199 | {-1em}% |
| 200 | {\reset@font\normalsize\HeaderFamily}} |
| 201 | \renewcommand{\subparagraph}{\@startsection{subparagraph}{5}{\parindent}% |
| 202 | {3.25ex \@plus1ex \@minus .2ex}% |
| 203 | {-1em}% |
| 204 | {\reset@font\normalsize\HeaderFamily}} |
| 205 | |
| 206 | |
| Guido van Rossum | ecae0b7 | 1996-06-26 19:03:20 +0000 | [diff] [blame] | 207 | % Underscore hack (only act like subscript operator if in math mode) |
| 208 | % |
| 209 | % The following is due to Mark Wooding (the old version didn't work with |
| 210 | % Latex 2e. |
| 211 | |
| 212 | \DeclareRobustCommand\hackscore{% |
| 213 | \ifmmode_\else\textunderscore\fi% |
| 214 | } |
| 215 | \begingroup |
| 216 | \catcode`\_\active |
| 217 | \def\next{% |
| 218 | \AtBeginDocument{\catcode`\_\active\def_{\hackscore{}}}% |
| 219 | } |
| 220 | \expandafter\endgroup\next |
| 221 | |
| 222 | % |
| Fred Drake | dc8af0a | 1998-02-13 06:48:05 +0000 | [diff] [blame] | 223 | % This is the old hack, which didn't work with 2e. |
| 224 | % You should not need this since the rest of the documentation is now |
| 225 | % LaTeX2e-only. |
| Guido van Rossum | ecae0b7 | 1996-06-26 19:03:20 +0000 | [diff] [blame] | 226 | % |
| 227 | %\def\_{\ifnum\fam=\ttfamily \char'137\else{\tt\char'137}\fi} |
| 228 | %\catcode`\_=12 |
| 229 | %\catcode`\_=\active\def_{\ifnum\fam=\ttfamily \char'137 \else{\tt\char'137}\fi} |
| Guido van Rossum | 5badc75 | 1992-03-06 10:55:46 +0000 | [diff] [blame] | 230 | |
| Fred Drake | b37a395 | 1998-02-06 22:52:52 +0000 | [diff] [blame] | 231 | |
| Fred Drake | dc8af0a | 1998-02-13 06:48:05 +0000 | [diff] [blame] | 232 | |
| Fred Drake | b37a395 | 1998-02-06 22:52:52 +0000 | [diff] [blame] | 233 | %% Lots of index-entry generation support. |
| 234 | |
| Fred Drake | dc8af0a | 1998-02-13 06:48:05 +0000 | [diff] [blame] | 235 | % Command to wrap around stuff that refers to function / module / |
| 236 | % attribute names in the index. Default behavior: like \code{}. To |
| 237 | % just keep the index entries in the roman font, uncomment the second |
| 238 | % definition to use instead; it matches O'Reilly style more. |
| 239 | % |
| Fred Drake | b37a395 | 1998-02-06 22:52:52 +0000 | [diff] [blame] | 240 | \newcommand{\idxcode}[1]{\codefont{#1}} |
| 241 | %\renewcommand{\idxcode}[1]{#1} |
| Guido van Rossum | 5badc75 | 1992-03-06 10:55:46 +0000 | [diff] [blame] | 242 | |
| 243 | % Command to generate two index entries (using subentries) |
| Guido van Rossum | 16d6e71 | 1994-08-08 12:30:22 +0000 | [diff] [blame] | 244 | \newcommand{\indexii}[2]{\index{#1!#2}\index{#2!#1}} |
| Guido van Rossum | 5badc75 | 1992-03-06 10:55:46 +0000 | [diff] [blame] | 245 | |
| 246 | % And three entries (using only one level of subentries) |
| Guido van Rossum | 16d6e71 | 1994-08-08 12:30:22 +0000 | [diff] [blame] | 247 | \newcommand{\indexiii}[3]{\index{#1!#2 #3}\index{#2!#3, #1}\index{#3!#1 #2}} |
| Guido van Rossum | 5badc75 | 1992-03-06 10:55:46 +0000 | [diff] [blame] | 248 | |
| 249 | % And four (again, using only one level of subentries) |
| 250 | \newcommand{\indexiv}[4]{ |
| 251 | \index{#1!#2 #3 #4} |
| 252 | \index{#2!#3 #4, #1} |
| 253 | \index{#3!#4, #1 #2} |
| 254 | \index{#4!#1 #2 #3} |
| 255 | } |
| 256 | |
| Fred Drake | dc8af0a | 1998-02-13 06:48:05 +0000 | [diff] [blame] | 257 | % Command to generate a reference to a function, statement, keyword, |
| 258 | % operator. |
| Fred Drake | b37a395 | 1998-02-06 22:52:52 +0000 | [diff] [blame] | 259 | \newcommand{\stindex}[1]{\indexii{statement}{#1@{\idxcode{#1}}}} |
| 260 | \newcommand{\opindex}[1]{\indexii{operator}{#1@{\idxcode{#1}}}} |
| 261 | \newcommand{\exindex}[1]{\indexii{exception}{#1@{\idxcode{#1}}}} |
| Guido van Rossum | 6886c83 | 1992-04-03 14:44:27 +0000 | [diff] [blame] | 262 | \newcommand{\obindex}[1]{\indexii{object}{#1}} |
| Fred Drake | fb5e54d | 1998-02-19 06:23:06 +0000 | [diff] [blame] | 263 | \newcommand{\bifuncindex}[1]{\index{#1@{\idxcode{#1()}} (built-in function)}} |
| Guido van Rossum | 5badc75 | 1992-03-06 10:55:46 +0000 | [diff] [blame] | 264 | |
| 265 | % Add an index entry for a module |
| Fred Drake | b37a395 | 1998-02-06 22:52:52 +0000 | [diff] [blame] | 266 | \newcommand{\refmodule}[2]{\index{#1@{\idxcode{#1}} (#2module)}} |
| Fred Drake | 4af1814 | 1997-12-15 22:08:14 +0000 | [diff] [blame] | 267 | \newcommand{\refmodindex}[1]{\refmodule{#1}{}} |
| Fred Drake | 207e57b | 1997-12-15 21:37:45 +0000 | [diff] [blame] | 268 | \newcommand{\refbimodindex}[1]{\refmodule{#1}{built-in }} |
| 269 | \newcommand{\refstmodindex}[1]{\refmodule{#1}{standard }} |
| 270 | |
| Fred Drake | da941ef | 1998-01-02 02:57:41 +0000 | [diff] [blame] | 271 | % support for the module index |
| 272 | \newwrite\modindexfile |
| Fred Drake | 9cf4bbd | 1998-02-25 15:29:43 +0000 | [diff] [blame] | 273 | \openout\modindexfile=mod\jobname.idx |
| Fred Drake | da941ef | 1998-01-02 02:57:41 +0000 | [diff] [blame] | 274 | |
| Fred Drake | 207e57b | 1997-12-15 21:37:45 +0000 | [diff] [blame] | 275 | % Add the defining entry for a module |
| Fred Drake | b37a395 | 1998-02-06 22:52:52 +0000 | [diff] [blame] | 276 | \newcommand{\defmodindex}[2]{% |
| 277 | \index{#1@{\idxcode{#1}} (#2module)|textbf}% |
| Fred Drake | da941ef | 1998-01-02 02:57:41 +0000 | [diff] [blame] | 278 | \write\modindexfile{#1 \thepage}} |
| Fred Drake | 9cf4bbd | 1998-02-25 15:29:43 +0000 | [diff] [blame] | 279 | |
| 280 | % built-in & Python modules in the main distribution |
| Fred Drake | 207e57b | 1997-12-15 21:37:45 +0000 | [diff] [blame] | 281 | \newcommand{\bimodindex}[1]{\defmodindex{#1}{built-in }} |
| 282 | \newcommand{\stmodindex}[1]{\defmodindex{#1}{standard }} |
| Guido van Rossum | 5badc75 | 1992-03-06 10:55:46 +0000 | [diff] [blame] | 283 | |
| Fred Drake | 9cf4bbd | 1998-02-25 15:29:43 +0000 | [diff] [blame] | 284 | % Python & extension modules outside the main distribution |
| 285 | \newcommand{\modindex}[1]{\defmodindex{#1}{}} |
| 286 | \newcommand{\exmodindex}[1]{\defmodindex{#1}{}} |
| 287 | |
| Guido van Rossum | 5badc75 | 1992-03-06 10:55:46 +0000 | [diff] [blame] | 288 | % Additional string for an index entry |
| Fred Drake | dc8af0a | 1998-02-13 06:48:05 +0000 | [diff] [blame] | 289 | \newcommand{\index@subitem}{} |
| 290 | \newcommand{\setindexsubitem}[1]{\renewcommand{\index@subitem}{#1}} |
| 291 | \newcommand{\ttindex}[1]{\index{#1@{\idxcode{#1}} \index@subitem}} |
| Guido van Rossum | 5badc75 | 1992-03-06 10:55:46 +0000 | [diff] [blame] | 292 | |
| Guido van Rossum | 5badc75 | 1992-03-06 10:55:46 +0000 | [diff] [blame] | 293 | |
| Fred Drake | ef14622 | 1998-02-19 21:02:26 +0000 | [diff] [blame] | 294 | % {fulllineitems} is used in one place in libregex.tex, but is really for |
| 295 | % internal use in this file. |
| 296 | % |
| Fred Drake | fb5e54d | 1998-02-19 06:23:06 +0000 | [diff] [blame] | 297 | \newenvironment{fulllineitems}{ |
| 298 | \begin{list}{}{\labelwidth \leftmargin \labelsep 0pt |
| 299 | \rightmargin 0pt \topsep -\parskip \partopsep \parskip |
| 300 | \itemsep -\parsep |
| 301 | \let\makelabel=\itemnewline} |
| 302 | }{\end{list}} |
| Guido van Rossum | 95cd2ef | 1992-12-08 14:37:55 +0000 | [diff] [blame] | 303 | |
| 304 | |
| Guido van Rossum | 36f3502 | 1997-05-22 20:43:24 +0000 | [diff] [blame] | 305 | % cfuncdesc should be called as |
| 306 | % \begin{cfuncdesc}{type}{name}{arglist} |
| 307 | % ... description ... |
| 308 | % \end{cfuncdesc} |
| Fred Drake | fb5e54d | 1998-02-19 06:23:06 +0000 | [diff] [blame] | 309 | \newenvironment{cfuncdesc}[3]{% |
| 310 | \begin{fulllineitems}% |
| 311 | \item[\code{#1 \bfcode{#2}(\varvars{#3})}]% |
| 312 | \index{#2@{\idxcode{#2()}}}% |
| 313 | }{\end{fulllineitems}} |
| Fred Drake | eb33c78 | 1996-10-29 15:55:08 +0000 | [diff] [blame] | 314 | |
| Fred Drake | fb5e54d | 1998-02-19 06:23:06 +0000 | [diff] [blame] | 315 | \newenvironment{cvardesc}[2]{% |
| 316 | \begin{fulllineitems}% |
| 317 | \item[\code{#1 \bfcode{#2}}]% |
| 318 | \index{#2@{\idxcode{#2}}}% |
| 319 | }{\end{fulllineitems}} |
| Guido van Rossum | 36f3502 | 1997-05-22 20:43:24 +0000 | [diff] [blame] | 320 | |
| Fred Drake | fb5e54d | 1998-02-19 06:23:06 +0000 | [diff] [blame] | 321 | \newenvironment{ctypedesc}[1]{% |
| 322 | \begin{fulllineitems}% |
| 323 | \item[\bfcode{#1}]\ttindex{#1} |
| 324 | }{\end{fulllineitems}} |
| Guido van Rossum | 36f3502 | 1997-05-22 20:43:24 +0000 | [diff] [blame] | 325 | |
| Fred Drake | fb5e54d | 1998-02-19 06:23:06 +0000 | [diff] [blame] | 326 | \newcommand{\funcline}[2]{\funclineni{#1}{#2}\ttindex{#1()}} |
| 327 | \newenvironment{funcdesc}[2]{% |
| 328 | \begin{fulllineitems}% |
| 329 | \funcline{#1}{#2}% |
| 330 | }{\end{fulllineitems}} |
| 331 | |
| 332 | \newcommand{\optional}[1]{% |
| 333 | {\textnormal{\Large[}}{#1}\hspace{0.5mm}{\textnormal{\Large]}}} |
| Guido van Rossum | 16d6e71 | 1994-08-08 12:30:22 +0000 | [diff] [blame] | 334 | |
| Fred Drake | aebc6f3 | 1998-02-13 14:34:04 +0000 | [diff] [blame] | 335 | % similar to {funcdesc}, but doesn't add to the index |
| 336 | \newcommand{\funclineni}[2]{\item[\code{\bfcode{#1}(\varvars{#2})}]} |
| Fred Drake | fb5e54d | 1998-02-19 06:23:06 +0000 | [diff] [blame] | 337 | \newenvironment{funcdescni}[2]{% |
| 338 | \begin{fulllineitems}% |
| 339 | \funclineni{#1}{#2}% |
| 340 | }{\end{fulllineitems}} |
| Guido van Rossum | 95cd2ef | 1992-12-08 14:37:55 +0000 | [diff] [blame] | 341 | |
| Fred Drake | fb5e54d | 1998-02-19 06:23:06 +0000 | [diff] [blame] | 342 | \newenvironment{classdesc}[2]{% |
| 343 | \begin{fulllineitems}% |
| 344 | \item[\code{\bfcode{#1}(\varvars{#2})}]% |
| 345 | \ttindex{#1}% |
| 346 | \def\baseclasses##1{}% |
| 347 | }{\end{fulllineitems}} |
| Guido van Rossum | 95cd2ef | 1992-12-08 14:37:55 +0000 | [diff] [blame] | 348 | |
| Fred Drake | fb5e54d | 1998-02-19 06:23:06 +0000 | [diff] [blame] | 349 | \newenvironment{excdesc}[1]{% |
| 350 | \begin{fulllineitems}% |
| 351 | \item[\bfcode{#1}]\ttindex{#1}% |
| 352 | }{\end{fulllineitems}} |
| 353 | |
| Fred Drake | aebc6f3 | 1998-02-13 14:34:04 +0000 | [diff] [blame] | 354 | \newcommand{\dataline}[1]{\datalineni{#1}\ttindex{#1}} |
| Fred Drake | fb5e54d | 1998-02-19 06:23:06 +0000 | [diff] [blame] | 355 | \newenvironment{datadesc}[1]{% |
| 356 | \begin{fulllineitems}% |
| 357 | \dataline{#1}% |
| 358 | }{\end{fulllineitems}} |
| Guido van Rossum | 95cd2ef | 1992-12-08 14:37:55 +0000 | [diff] [blame] | 359 | |
| Fred Drake | aebc6f3 | 1998-02-13 14:34:04 +0000 | [diff] [blame] | 360 | % similar to {datadesc}, but doesn't add to the index |
| 361 | \newcommand{\datalineni}[1]{\item[\bfcode{#1}]} |
| Fred Drake | fb5e54d | 1998-02-19 06:23:06 +0000 | [diff] [blame] | 362 | \newenvironment{datadescni}[1]{% |
| 363 | \begin{fulllineitems}% |
| 364 | \datalineni{#1}% |
| 365 | }{\end{fulllineitems}} |
| Fred Drake | aebc6f3 | 1998-02-13 14:34:04 +0000 | [diff] [blame] | 366 | |
| Fred Drake | fb5e54d | 1998-02-19 06:23:06 +0000 | [diff] [blame] | 367 | \newenvironment{opcodedesc}[2]{% |
| 368 | \begin{fulllineitems}% |
| 369 | \item[\bfcode{#1}\quad\var{#2}]% |
| 370 | }{\end{fulllineitems}} |
| Fred Drake | a610f9f | 1997-12-03 03:42:39 +0000 | [diff] [blame] | 371 | |
| 372 | |
| Guido van Rossum | 95cd2ef | 1992-12-08 14:37:55 +0000 | [diff] [blame] | 373 | \let\nodename=\label |
| 374 | |
| Fred Drake | dc8af0a | 1998-02-13 06:48:05 +0000 | [diff] [blame] | 375 | % For these commands, use \command{} to get the typography right, not |
| 376 | % {\command}. This works better with the texinfo translation. |
| Guido van Rossum | 95cd2ef | 1992-12-08 14:37:55 +0000 | [diff] [blame] | 377 | \newcommand{\ABC}{{\sc abc}} |
| 378 | \newcommand{\UNIX}{{\sc Unix}} |
| Fred Drake | 311c196 | 1998-01-20 05:07:19 +0000 | [diff] [blame] | 379 | \newcommand{\POSIX}{POSIX} |
| Guido van Rossum | 95cd2ef | 1992-12-08 14:37:55 +0000 | [diff] [blame] | 380 | \newcommand{\ASCII}{{\sc ascii}} |
| Guido van Rossum | 16d6e71 | 1994-08-08 12:30:22 +0000 | [diff] [blame] | 381 | \newcommand{\Cpp}{C\protect\raisebox{.18ex}{++}} |
| Guido van Rossum | 95cd2ef | 1992-12-08 14:37:55 +0000 | [diff] [blame] | 382 | \newcommand{\C}{C} |
| 383 | \newcommand{\EOF}{{\sc eof}} |
| Guido van Rossum | 9231c8f | 1997-05-15 21:43:21 +0000 | [diff] [blame] | 384 | \newcommand{\NULL}{\code{NULL}} |
| Guido van Rossum | 95cd2ef | 1992-12-08 14:37:55 +0000 | [diff] [blame] | 385 | |
| 386 | % code is the most difficult one... |
| Guido van Rossum | 95cd2ef | 1992-12-08 14:37:55 +0000 | [diff] [blame] | 387 | \newcommand{\code}[1]{{\@vobeyspaces\@noligs\def\{{\char`\{}\def\}{\char`\}}\def\~{\char`\~}\def\^{\char`\^}\def\e{\char`\\}\def\${\char`\$}\def\#{\char`\#}\def\&{\char`\&}\def\%{\char`\%}% |
| Fred Drake | 9e24309 | 1998-01-18 05:09:54 +0000 | [diff] [blame] | 388 | \mbox{\codefont{#1}}}} |
| Guido van Rossum | ecae0b7 | 1996-06-26 19:03:20 +0000 | [diff] [blame] | 389 | |
| Fred Drake | fb5e54d | 1998-02-19 06:23:06 +0000 | [diff] [blame] | 390 | \newcommand{\bfcode}[1]{\code{\bfseries#1}} % bold-faced code font |
| Guido van Rossum | 95cd2ef | 1992-12-08 14:37:55 +0000 | [diff] [blame] | 391 | \newcommand{\kbd}[1]{\mbox{\tt #1}} |
| 392 | \newcommand{\key}[1]{\mbox{\tt #1}} |
| 393 | \newcommand{\samp}[1]{\mbox{`\code{#1}'}} |
| Fred Drake | dc8af0a | 1998-02-13 06:48:05 +0000 | [diff] [blame] | 394 | % This weird definition of \var{} allows it to always appear in roman |
| 395 | % italics, and won't get funky in code fragments when we play around |
| 396 | % with fonts. |
| 397 | \newcommand{\var}[1]{\mbox{\normalsize\textrm{\textit{#1\/}}}} |
| Guido van Rossum | ecae0b7 | 1996-06-26 19:03:20 +0000 | [diff] [blame] | 398 | \renewcommand{\emph}[1]{{\em #1\/}} |
| Fred Drake | fb5e54d | 1998-02-19 06:23:06 +0000 | [diff] [blame] | 399 | \newcommand{\dfn}[1]{\emph{#1}} |
| Guido van Rossum | 95cd2ef | 1992-12-08 14:37:55 +0000 | [diff] [blame] | 400 | \newcommand{\strong}[1]{{\bf #1}} |
| Fred Drake | 06f169b | 1998-02-11 23:08:20 +0000 | [diff] [blame] | 401 | % let's experiment with a new font: |
| Fred Drake | dc8af0a | 1998-02-13 06:48:05 +0000 | [diff] [blame] | 402 | \newcommand{\file}[1]{\mbox{`\small\textsf{#1}'}} |
| Fred Drake | 9cf4bbd | 1998-02-25 15:29:43 +0000 | [diff] [blame] | 403 | |
| 404 | % Use this def/redef approach for \url{} since hyperref defined this already, |
| 405 | % but only if we actually used hyperref: |
| Fred Drake | 0c17d66 | 1998-02-18 14:24:19 +0000 | [diff] [blame] | 406 | \@ifundefined{pdfannotlink}{% |
| Fred Drake | 9cf4bbd | 1998-02-25 15:29:43 +0000 | [diff] [blame] | 407 | \newcommand{\pythonurl}[1]{\mbox{\small\textsf{#1}}}% |
| Fred Drake | 0c17d66 | 1998-02-18 14:24:19 +0000 | [diff] [blame] | 408 | }{ |
| Fred Drake | 9cf4bbd | 1998-02-25 15:29:43 +0000 | [diff] [blame] | 409 | \newcommand{\pythonurl}[1]{{% |
| 410 | \pdfannotlink attr{/Border [0 0 0]} user{/S /URI /URI (#1)}% |
| 411 | \LinkColor% color of the link text |
| Fred Drake | 0c17d66 | 1998-02-18 14:24:19 +0000 | [diff] [blame] | 412 | \mbox{\small\textsf{#1}}% |
| Fred Drake | 9cf4bbd | 1998-02-25 15:29:43 +0000 | [diff] [blame] | 413 | \NormalColor% Turn it back off; these are declarative |
| 414 | \pdfendlink}% and don't appear bound to the current |
| 415 | }% formatting "box". |
| 416 | } |
| 417 | \let\url=\pythonurl |
| Fred Drake | 4186cd3 | 1998-02-18 17:21:09 +0000 | [diff] [blame] | 418 | \newcommand{\email}[1]{\mbox{\small\textsf{#1}}} |
| Guido van Rossum | 95cd2ef | 1992-12-08 14:37:55 +0000 | [diff] [blame] | 419 | |
| Fred Drake | 9b550d9 | 1996-11-11 20:43:46 +0000 | [diff] [blame] | 420 | \newcommand{\varvars}[1]{{\def\,{\/{\char`\,}}\var{#1}}} |
| Guido van Rossum | 95cd2ef | 1992-12-08 14:37:55 +0000 | [diff] [blame] | 421 | |
| 422 | \newif\iftexi\texifalse |
| Guido van Rossum | ecae0b7 | 1996-06-26 19:03:20 +0000 | [diff] [blame] | 423 | \newif\iflatex\latextrue |
| Guido van Rossum | 95cd2ef | 1992-12-08 14:37:55 +0000 | [diff] [blame] | 424 | |
| Fred Drake | dc8af0a | 1998-02-13 06:48:05 +0000 | [diff] [blame] | 425 | % These should be used for all references to identifiers which are |
| 426 | % used to refer to instances of specific language constructs. See the |
| 427 | % names for specific semantic assignments. |
| Fred Drake | 311c196 | 1998-01-20 05:07:19 +0000 | [diff] [blame] | 428 | % |
| Fred Drake | dc8af0a | 1998-02-13 06:48:05 +0000 | [diff] [blame] | 429 | % For now, don't do anything really fancy with them; just use them as |
| 430 | % logical markup. This might change in the future. |
| Fred Drake | 311c196 | 1998-01-20 05:07:19 +0000 | [diff] [blame] | 431 | % |
| 432 | \let\module=\code |
| Fred Drake | dd28d57 | 1998-01-22 15:55:21 +0000 | [diff] [blame] | 433 | \let\keyword=\code |
| 434 | \let\exception=\code |
| Fred Drake | 311c196 | 1998-01-20 05:07:19 +0000 | [diff] [blame] | 435 | \let\class=\code |
| Fred Drake | dd28d57 | 1998-01-22 15:55:21 +0000 | [diff] [blame] | 436 | \let\function=\code |
| Fred Drake | fb5e54d | 1998-02-19 06:23:06 +0000 | [diff] [blame] | 437 | \let\member=\code |
| Fred Drake | dd28d57 | 1998-01-22 15:55:21 +0000 | [diff] [blame] | 438 | \let\method=\code |
| 439 | |
| Fred Drake | fb5e54d | 1998-02-19 06:23:06 +0000 | [diff] [blame] | 440 | \let\cfunction=\code |
| 441 | \let\ctype=\code |
| 442 | \let\cdata=\code |
| 443 | |
| 444 | % constants defined in Python modules or C headers, not language constants: |
| Fred Drake | dd28d57 | 1998-01-22 15:55:21 +0000 | [diff] [blame] | 445 | \let\constant=\code |
| Fred Drake | 311c196 | 1998-01-20 05:07:19 +0000 | [diff] [blame] | 446 | |
| 447 | \newcommand{\manpage}[2]{{\emph{#1}(#2)}} |
| Fred Drake | 06f169b | 1998-02-11 23:08:20 +0000 | [diff] [blame] | 448 | \newcommand{\rfc}[1]{RFC #1\index{RFC!RFC #1}} |
| Fred Drake | dc8af0a | 1998-02-13 06:48:05 +0000 | [diff] [blame] | 449 | \newcommand{\program}[1]{\strong{#1}} |
| Fred Drake | 311c196 | 1998-01-20 05:07:19 +0000 | [diff] [blame] | 450 | |
| 451 | |
| Fred Drake | fb5e54d | 1998-02-19 06:23:06 +0000 | [diff] [blame] | 452 | \newenvironment{tableii}[4]{% |
| 453 | \begin{center}% |
| 454 | \def\lineii##1##2{\csname#2\endcsname{##1}&##2\\}% |
| 455 | \begin{tabular}{#1}\hline#3\\ \hline% |
| 456 | }{% |
| 457 | \hline% |
| 458 | \end{tabular}% |
| 459 | \end{center}% |
| 460 | } |
| Guido van Rossum | e7af5a0 | 1994-08-01 12:39:35 +0000 | [diff] [blame] | 461 | |
| Fred Drake | fb5e54d | 1998-02-19 06:23:06 +0000 | [diff] [blame] | 462 | \newenvironment{tableiii}[5]{% |
| 463 | \begin{center}% |
| 464 | \def\lineiii##1##2##3{\csname#2\endcsname{##1}&##2&##3\\}% |
| 465 | \begin{tabular}{#1}\hline#3\\% |
| 466 | \hline% |
| 467 | }{% |
| 468 | \hline% |
| 469 | \end{tabular}% |
| 470 | \end{center}% |
| 471 | } |
| Guido van Rossum | 95cd2ef | 1992-12-08 14:37:55 +0000 | [diff] [blame] | 472 | |
| Fred Drake | fb5e54d | 1998-02-19 06:23:06 +0000 | [diff] [blame] | 473 | \newcommand{\itemnewline}[1]{% |
| 474 | \@tempdima\linewidth% |
| 475 | \advance\@tempdima \leftmargin\makebox[\@tempdima][l]{#1}% |
| 476 | } |
| Guido van Rossum | 95cd2ef | 1992-12-08 14:37:55 +0000 | [diff] [blame] | 477 | |
| Fred Drake | 9e24309 | 1998-01-18 05:09:54 +0000 | [diff] [blame] | 478 | \newcommand{\sectcode}[1]{{\sectcodefont{#1}}} |
| Guido van Rossum | e3d5fc5 | 1997-07-17 18:27:53 +0000 | [diff] [blame] | 479 | |
| 480 | % Cross-referencing (AMK) |
| 481 | % Sample usage: |
| 482 | % \begin{seealso} |
| 483 | % \seemodule{rand}{Uniform random number generator}; % Module xref |
| Fred Drake | dc8af0a | 1998-02-13 06:48:05 +0000 | [diff] [blame] | 484 | % \seetext{\emph{Encyclopedia Britannica}}. % Ref to a book |
| Guido van Rossum | e3d5fc5 | 1997-07-17 18:27:53 +0000 | [diff] [blame] | 485 | % \end{seealso} |
| 486 | |
| Fred Drake | fb5e54d | 1998-02-19 06:23:06 +0000 | [diff] [blame] | 487 | \newenvironment{seealso}[0]{ |
| 488 | \strong{See Also:}\par |
| 489 | % These should only be defined within the {seealso} environment: |
| 490 | \def\seemodule##1##2{\ref{module-##1}:\quad Module \module{##1}\quad (##2)} |
| 491 | \def\seetext##1{\par{##1}} |
| 492 | }{\par} |
| 493 | |
| Fred Drake | da941ef | 1998-01-02 02:57:41 +0000 | [diff] [blame] | 494 | |
| Fred Drake | dc8af0a | 1998-02-13 06:48:05 +0000 | [diff] [blame] | 495 | % Fix the theindex environment to add an entry to the Table of |
| 496 | % Contents; this is much nicer than just having to jump to the end of |
| 497 | % the book and flip around, especially with multiple indexes. |
| Fred Drake | da941ef | 1998-01-02 02:57:41 +0000 | [diff] [blame] | 498 | % |
| 499 | \let\OldTheindex=\theindex |
| Fred Drake | fb5e54d | 1998-02-19 06:23:06 +0000 | [diff] [blame] | 500 | \renewcommand{\theindex}{ |
| 501 | \cleardoublepage |
| 502 | \OldTheindex |
| 503 | \addcontentsline{toc}{chapter}{\indexname} |
| Fred Drake | da941ef | 1998-01-02 02:57:41 +0000 | [diff] [blame] | 504 | } |
| Fred Drake | 031ad4b | 1998-01-09 05:34:23 +0000 | [diff] [blame] | 505 | |
| 506 | % Use a similar trick to catch the end of the {abstract} environment, |
| 507 | % but here make sure the abstract is followed by a blank page if the |
| 508 | % 'openright' option is used. |
| 509 | % |
| 510 | \let\OldEndAbstract=\endabstract |
| Fred Drake | 06f169b | 1998-02-11 23:08:20 +0000 | [diff] [blame] | 511 | \renewcommand{\endabstract}{ |
| Fred Drake | 737e73e | 1998-01-13 22:40:08 +0000 | [diff] [blame] | 512 | \if@openright |
| 513 | \ifodd\value{page} |
| 514 | \typeout{Adding blank page after the abstract.} |
| 515 | \vfil\pagebreak |
| Fred Drake | 031ad4b | 1998-01-09 05:34:23 +0000 | [diff] [blame] | 516 | \fi |
| Fred Drake | 737e73e | 1998-01-13 22:40:08 +0000 | [diff] [blame] | 517 | \fi |
| 518 | \OldEndAbstract |
| Fred Drake | 031ad4b | 1998-01-09 05:34:23 +0000 | [diff] [blame] | 519 | } |
| 520 | |
| Fred Drake | dc8af0a | 1998-02-13 06:48:05 +0000 | [diff] [blame] | 521 | % This wraps the \tableofcontents macro with all the magic to get the |
| 522 | % spacing right and have the right number of pages if the 'openright' |
| Fred Drake | 031ad4b | 1998-01-09 05:34:23 +0000 | [diff] [blame] | 523 | % option has been used. This eliminates a fair amount of crud in the |
| 524 | % individual document files. |
| 525 | % |
| Fred Drake | 737e73e | 1998-01-13 22:40:08 +0000 | [diff] [blame] | 526 | \let\OldTableofcontents=\tableofcontents |
| Fred Drake | 06f169b | 1998-02-11 23:08:20 +0000 | [diff] [blame] | 527 | \renewcommand{\tableofcontents}[0]{% |
| 528 | \setcounter{page}{1}% |
| 529 | \pagebreak% |
| 530 | \pagestyle{plain}% |
| 531 | {% |
| 532 | \parskip = 0mm% |
| 533 | \OldTableofcontents% |
| 534 | \if@openright% |
| 535 | \ifodd\value{page}% |
| 536 | \typeout{Adding blank page after the table of contents.}% |
| 537 | \pagebreak\hspace{0pt}% |
| 538 | \fi% |
| 539 | \fi% |
| 540 | }% |
| Fred Drake | 4c68963 | 1998-02-13 16:58:49 +0000 | [diff] [blame] | 541 | \cleardoublepage% |
| Fred Drake | dc8af0a | 1998-02-13 06:48:05 +0000 | [diff] [blame] | 542 | \pagenumbering{arabic}% |
| Fred Drake | 76183c0 | 1998-02-16 22:30:10 +0000 | [diff] [blame] | 543 | \@ifundefined{fancyhf}{}{\pagestyle{normal}}% |
| Fred Drake | 06f169b | 1998-02-11 23:08:20 +0000 | [diff] [blame] | 544 | } |
| 545 | |
| Fred Drake | dc8af0a | 1998-02-13 06:48:05 +0000 | [diff] [blame] | 546 | % Allow the release number to be specified independently of the |
| 547 | % \date{}. This allows the date to reflect the document's date and |
| 548 | % release to specify the Python release that is documented. |
| 549 | % |
| Fred Drake | 06f169b | 1998-02-11 23:08:20 +0000 | [diff] [blame] | 550 | \newcommand{\@release}{} |
| 551 | \newcommand{\version}{} |
| 552 | \newcommand{\releasename}{Release} |
| 553 | \newcommand{\release}[1]{% |
| 554 | \renewcommand{\@release}{\releasename\space\version}% |
| Fred Drake | dc8af0a | 1998-02-13 06:48:05 +0000 | [diff] [blame] | 555 | \renewcommand{\version}{#1}} |
| Fred Drake | 06f169b | 1998-02-11 23:08:20 +0000 | [diff] [blame] | 556 | |
| Fred Drake | dc8af0a | 1998-02-13 06:48:05 +0000 | [diff] [blame] | 557 | % Allow specification of the author's address separately from the |
| 558 | % author's name. This can be used to format them differently, which |
| 559 | % is a good thing. |
| 560 | % |
| Fred Drake | 06f169b | 1998-02-11 23:08:20 +0000 | [diff] [blame] | 561 | \newcommand{\@authoraddress}{} |
| 562 | \newcommand{\authoraddress}[1]{\renewcommand{\@authoraddress}{#1}} |
| 563 | |
| Fred Drake | dc8af0a | 1998-02-13 06:48:05 +0000 | [diff] [blame] | 564 | % Change the title page to look a bit better, and fit in with the |
| 565 | % fncychap ``Bjarne'' style a bit better. |
| 566 | % |
| Fred Drake | fb5e54d | 1998-02-19 06:23:06 +0000 | [diff] [blame] | 567 | \renewcommand{\maketitle}{% |
| 568 | \begin{titlepage}% |
| 569 | \let\footnotesize\small |
| 570 | \let\footnoterule\relax |
| 571 | \@ifundefined{ChTitleVar}{}{% |
| 572 | \mghrulefill{\RW}}% |
| 573 | \@ifundefined{pdfinfo}{}{ |
| 574 | \pdfinfo |
| 575 | author {\@author} |
| 576 | title {\@title} |
| 577 | } |
| 578 | \begin{flushright}% |
| 579 | {\rm\Huge\HeaderFamily \@title \par}% |
| 580 | {\em\LARGE\HeaderFamily \@release \par} |
| 581 | \vfill |
| 582 | {\LARGE\HeaderFamily \@author \par} |
| 583 | \vfill\vfill |
| 584 | {\large |
| 585 | \@date \par |
| 586 | \vskip 3em |
| 587 | \@authoraddress \par |
| 588 | }% |
| 589 | \end{flushright}%\par |
| 590 | \@thanks |
| Fred Drake | 06f169b | 1998-02-11 23:08:20 +0000 | [diff] [blame] | 591 | \end{titlepage}% |
| 592 | \setcounter{footnote}{0}% |
| 593 | \let\thanks\relax\let\maketitle\relax |
| 594 | \gdef\@thanks{}\gdef\@author{}\gdef\@title{} |
| 595 | } |
| 596 | |
| Fred Drake | dc8af0a | 1998-02-13 06:48:05 +0000 | [diff] [blame] | 597 | % This sets up the fancy chapter headings that make the documents look |
| 598 | % at least a little better than the usual LaTeX output. |
| Fred Drake | 06f169b | 1998-02-11 23:08:20 +0000 | [diff] [blame] | 599 | % |
| Fred Drake | 06f169b | 1998-02-11 23:08:20 +0000 | [diff] [blame] | 600 | \@ifundefined{ChTitleVar}{}{ |
| Fred Drake | dc8af0a | 1998-02-13 06:48:05 +0000 | [diff] [blame] | 601 | \ChNameVar{\raggedleft\normalsize\HeaderFamily} |
| 602 | \ChNumVar{\raggedleft \bfseries\Large\HeaderFamily} |
| 603 | \ChTitleVar{\raggedleft \rm\Huge\HeaderFamily} |
| Fred Drake | 06f169b | 1998-02-11 23:08:20 +0000 | [diff] [blame] | 604 | % This creates chapter heads without the leading \vspace*{}: |
| 605 | \def\@makechapterhead#1{% |
| 606 | {\parindent \z@ \raggedright \normalfont |
| 607 | \ifnum \c@secnumdepth >\m@ne |
| 608 | \DOCH |
| 609 | \fi |
| 610 | \interlinepenalty\@M |
| 611 | \DOTI{#1} |
| 612 | } |
| 613 | } |
| 614 | \typeout{Using fancy chapter headings.} |
| Fred Drake | 031ad4b | 1998-01-09 05:34:23 +0000 | [diff] [blame] | 615 | } |
| Fred Drake | 5c19c7b | 1998-02-20 06:08:07 +0000 | [diff] [blame] | 616 | |
| 617 | % Tell TeX about pathological hyphenation cases: |
| 618 | \hyphenation{Base-HTTP-Re-quest-Hand-ler} |