blob: 41db7efd4335e9159075f905f7459f896ff11dae [file] [log] [blame]
Fred Drake6659c301998-03-03 22:02:19 +00001%
Fred Drake6663b221998-03-06 22:33:06 +00002% python.sty for the Python docummentation [works only with with Latex2e]
Fred Drake6659c301998-03-03 22:02:19 +00003%
4
5\NeedsTeXFormat{LaTeX2e}[1995/12/01]
6\ProvidesPackage{python}
Fred Drakec0b2e451998-03-25 14:53:43 +00007 [1998/01/11 LaTeX package (Python markup)]
Fred Drake6659c301998-03-03 22:02:19 +00008
Fred Drake454a4fb1998-04-01 22:20:14 +00009% These packages can be used to add marginal annotations which indicate
10% index entries and labels; useful for reviewing this messy documentation!
11%
12%\RequirePackage{showkeys}
13%\RequirePackage{showidx}
14
Fred Drakec0b2e451998-03-25 14:53:43 +000015% for PDF output, use maximal compression & a lot of other stuff
16% (test for PDF recommended by Tanmoy Bhattacharya <tanmoy@qcd.lanl.gov>)
17%
Fred Drake24340ea1998-04-28 18:30:34 +000018\newif\ifpy@doing@page@targets
19\py@doing@page@targetsfalse
Fred Drake6cb71491998-03-27 05:22:53 +000020
Fred Drakec0b2e451998-03-25 14:53:43 +000021\ifx\pdfoutput\undefined\else\ifcase\pdfoutput
Fred Drakec0b2e451998-03-25 14:53:43 +000022\else
Fred Drake6659c301998-03-03 22:02:19 +000023 \input{pdfcolor}
Fred Drake24340ea1998-04-28 18:30:34 +000024 \let\py@LinkColor=\NavyBlue
25 \let\py@NormalColor=\Black
Fred Drake6659c301998-03-03 22:02:19 +000026 \pdfcompresslevel=9
Fred Drakeba1700c1998-05-11 20:42:54 +000027 \pdfpagewidth=\paperwidth % page width of PDF output
28 \pdfpageheight=\paperheight % page height of PDF output
Fred Drakeebcb6581998-03-06 21:25:17 +000029 %
Fred Drakea2c2a831998-04-15 17:50:01 +000030 % Pad the number with '0' to 3 digits wide so no page name is a prefix
31 % of any other.
32 %
Fred Drakea488f301998-07-23 17:50:45 +000033 \newcommand{\py@targetno}[1]{\ifnum#1<100 0\fi\ifnum#1<10 0\fi#1}
34 \newcommand{\py@pageno}{\py@targetno\thepage}
Fred Drakea2c2a831998-04-15 17:50:01 +000035 %
Fred Drakeebcb6581998-03-06 21:25:17 +000036 % This definition allows the entries in the page-view of the ToC to be
37 % active links. Some work, some don't.
38 %
Fred Drake24340ea1998-04-28 18:30:34 +000039 \let\py@OldContentsline=\contentsline
Fred Drakea2c2a831998-04-15 17:50:01 +000040 % Compute the padded page number separately since we end up with a pair of
41 % \relax tokens; this gets the right string computed and works.
Fred Drake6659c301998-03-03 22:02:19 +000042 \renewcommand{\contentsline}[3]{%
Fred Drakea2c2a831998-04-15 17:50:01 +000043 \def\my@pageno{\py@targetno{#3}}%
Fred Drake24340ea1998-04-28 18:30:34 +000044 \py@OldContentsline{#1}{%
Fred Drakea2c2a831998-04-15 17:50:01 +000045 \pdfannotlink attr{/Border [0 0 0]} goto name{page\my@pageno}%
Fred Drake24340ea1998-04-28 18:30:34 +000046 \py@LinkColor#2\py@NormalColor%
Fred Drake6659c301998-03-03 22:02:19 +000047 \pdfendlink%
48 }{#3}%
49 }
Fred Drakeebcb6581998-03-06 21:25:17 +000050 \AtEndDocument{
Fred Drakec0b2e451998-03-25 14:53:43 +000051 \InputIfFileExists{\jobname.bkm}{\pdfcatalog{/PageMode /UseOutlines}}{}
Fred Drakeebcb6581998-03-06 21:25:17 +000052 }
Fred Drakea2c2a831998-04-15 17:50:01 +000053 \newcommand{\py@target}[1]{%
Fred Drake24340ea1998-04-28 18:30:34 +000054 \ifpy@doing@page@targets%
Fred Drakea2c2a831998-04-15 17:50:01 +000055 {\pdfdest name{#1} fit}%
56 \fi%
57 }
Fred Drake24340ea1998-04-28 18:30:34 +000058 \let\py@OldLabel=\label
Fred Drake6659c301998-03-03 22:02:19 +000059 \renewcommand{\label}[1]{%
Fred Drake24340ea1998-04-28 18:30:34 +000060 \py@OldLabel{#1}%
Fred Drakea2c2a831998-04-15 17:50:01 +000061 \py@target{label-#1}%
Fred Drake6659c301998-03-03 22:02:19 +000062 }
Fred Drakeba1700c1998-05-11 20:42:54 +000063 % This stuff adds a page# destination to every PDF page, where # is three
64 % digits wide, padded with leading zeros. This doesn't really help with
65 % the frontmatter, but does fine with the body.
Fred Drake6659c301998-03-03 22:02:19 +000066 %
67 % This is *heavily* based on the hyperref package.
68 %
Fred Drake1c8d0e01998-03-07 05:29:15 +000069 \def\@begindvi{%
70 \unvbox \@begindvibox
71 \@hyperfixhead
Fred Drake6659c301998-03-03 22:02:19 +000072 }
Fred Drake1c8d0e01998-03-07 05:29:15 +000073 \def\@hyperfixhead{%
74 \let\H@old@thehead\@thehead
Fred Drakea2c2a831998-04-15 17:50:01 +000075 \global\def\@foo{\py@target{page\py@pageno}}%
Fred Drake1c8d0e01998-03-07 05:29:15 +000076 \expandafter\ifx\expandafter\@empty\H@old@thehead
77 \def\H@old@thehead{\hfil}\fi
78 \def\@thehead{\@foo\relax\H@old@thehead}%
Fred Drake6659c301998-03-03 22:02:19 +000079 }
Fred Drakec0b2e451998-03-25 14:53:43 +000080\fi\fi
Fred Drake6659c301998-03-03 22:02:19 +000081
82% Increase printable page size (copied from fullpage.sty)
83\topmargin 0pt
84\advance \topmargin by -\headheight
85\advance \topmargin by -\headsep
86
87% attempt to work a little better for A4 users
Fred Drake1c8d0e01998-03-07 05:29:15 +000088\@ifundefined{paperheight}{
Fred Drake6659c301998-03-03 22:02:19 +000089 \textheight 9in
90}{
91 \textheight \paperheight
92 \advance\textheight by -2in
93}
94
95\oddsidemargin 0pt
96\evensidemargin \oddsidemargin
97\marginparwidth 0.5in
98
Fred Drake1c8d0e01998-03-07 05:29:15 +000099\@ifundefined{paperwidth}{
Fred Drake6659c301998-03-03 22:02:19 +0000100 \textwidth 6.5in
101}{
102 \textwidth \paperwidth
103 \advance\textwidth by -2in
104}
105
106
107% Style parameters and macros used by most documents here
108\raggedbottom
109\sloppy
110\parindent = 0mm
Fred Drake24340ea1998-04-28 18:30:34 +0000111\parskip = 2mm
Fred Drake6659c301998-03-03 22:02:19 +0000112\hbadness = 5000 % don't print trivial gripes
113
114\pagestyle{empty} % start this way; change for
115\pagenumbering{roman} % ToC & chapters
116\setcounter{secnumdepth}{1}
117
118% Use this to set the font family for headers and other decor:
Fred Drake24340ea1998-04-28 18:30:34 +0000119\newcommand{\py@HeaderFamily}{\sffamily}
Fred Drake6659c301998-03-03 22:02:19 +0000120
121% Redefine the 'normal' header/footer style when using "fancyhdr" package:
Fred Drake1c8d0e01998-03-07 05:29:15 +0000122\@ifundefined{fancyhf}{}{
Fred Drake6659c301998-03-03 22:02:19 +0000123 % Use \pagestyle{normal} as the primary pagestyle for text.
124 \fancypagestyle{normal}{
125 \fancyhf{}
Fred Drake24340ea1998-04-28 18:30:34 +0000126 \fancyfoot[LE,RO]{{\py@HeaderFamily\thepage}}
127 \fancyfoot[LO]{{\py@HeaderFamily\nouppercase{\rightmark}}}
128 \fancyfoot[RE]{{\py@HeaderFamily\nouppercase{\leftmark}}}
Fred Drake6659c301998-03-03 22:02:19 +0000129 \renewcommand{\headrulewidth}{0pt}
130 \renewcommand{\footrulewidth}{0.4pt}
131 }
132 % Update the plain style so we get the page number & footer line,
133 % but not a chapter or section title. This is to keep the first
134 % page of a chapter and the blank page between chapters `clean.'
135 \fancypagestyle{plain}{
136 \fancyhf{}
Fred Drake24340ea1998-04-28 18:30:34 +0000137 \fancyfoot[LE,RO]{{\py@HeaderFamily\thepage}}
Fred Drake6659c301998-03-03 22:02:19 +0000138 \renewcommand{\headrulewidth}{0pt}
139 \renewcommand{\footrulewidth}{0.4pt}
140 }
141 % Redefine \cleardoublepage so that the blank page between chapters
142 % gets the plain style and not the fancy style. This is described
143 % in the documentation for the fancyhdr package by Piet von Oostrum.
Fred Drake1c8d0e01998-03-07 05:29:15 +0000144 \@ifundefined{chapter}{}{
Fred Drake28f13911998-03-04 21:47:59 +0000145 \renewcommand{\cleardoublepage}{
Fred Drake1c8d0e01998-03-07 05:29:15 +0000146 \clearpage\if@openright \ifodd\c@page\else
Fred Drake28f13911998-03-04 21:47:59 +0000147 \hbox{}
148 \thispagestyle{plain}
149 \newpage
Fred Drake1c8d0e01998-03-07 05:29:15 +0000150 \if@twocolumn\hbox{}\newpage\fi\fi\fi
Fred Drake28f13911998-03-04 21:47:59 +0000151 }
152 }
Fred Drake6659c301998-03-03 22:02:19 +0000153}
154
Fred Drake6659c301998-03-03 22:02:19 +0000155% This sets up the {verbatim} environment to be indented and a minipage,
156% and to have all the other mostly nice properties that we want for
157% code samples.
158
159% Variable used by begin code command
Fred Drake24340ea1998-04-28 18:30:34 +0000160\newlength{\py@codewidth}
Fred Drake6659c301998-03-03 22:02:19 +0000161
Fred Drake24340ea1998-04-28 18:30:34 +0000162\newcommand{\py@examplevspace}{2mm}
163\newcommand{\py@exampleindent}{1cm}
Fred Drake6659c301998-03-03 22:02:19 +0000164
Fred Drake24340ea1998-04-28 18:30:34 +0000165\let\py@OldVerbatim=\verbatim
166\let\py@OldEndVerbatim=\endverbatim
Fred Drake6659c301998-03-03 22:02:19 +0000167\renewcommand{\verbatim}{%
168 \begingroup%
Fred Drake24340ea1998-04-28 18:30:34 +0000169 \setlength{\parindent}\py@exampleindent%
Fred Drake6659c301998-03-03 22:02:19 +0000170 % Calculate the text width for the minipage:
Fred Drake24340ea1998-04-28 18:30:34 +0000171 \setlength{\py@codewidth}{\linewidth}%
172 \addtolength{\py@codewidth}{-\parindent}%
Fred Drake6659c301998-03-03 22:02:19 +0000173 %
174 \par%
Fred Drake24340ea1998-04-28 18:30:34 +0000175 \vspace\py@examplevspace%
Fred Drake6659c301998-03-03 22:02:19 +0000176 \indent%
Fred Drake24340ea1998-04-28 18:30:34 +0000177 \begin{minipage}[t]{\py@codewidth}%
Fred Drake6659c301998-03-03 22:02:19 +0000178 \small%
Fred Drake24340ea1998-04-28 18:30:34 +0000179 \py@OldVerbatim%
Fred Drake6659c301998-03-03 22:02:19 +0000180}
181\renewcommand{\endverbatim}{%
Fred Drake24340ea1998-04-28 18:30:34 +0000182 \py@OldEndVerbatim%
Fred Drake6659c301998-03-03 22:02:19 +0000183 \end{minipage}%
184 \endgroup%
185}
186
Fred Drake6cb71491998-03-27 05:22:53 +0000187
Fred Drakea488f301998-07-23 17:50:45 +0000188\newcommand{\py@modulebadkey}{{--just-some-junk--}}
Fred Drake6659c301998-03-03 22:02:19 +0000189
Fred Drake6659c301998-03-03 22:02:19 +0000190
191%% Lots of index-entry generation support.
192
193% Command to wrap around stuff that refers to function / module /
194% attribute names in the index. Default behavior: like \code{}. To
195% just keep the index entries in the roman font, uncomment the second
Fred Drakea488f301998-07-23 17:50:45 +0000196% definition; it matches O'Reilly style more.
Fred Drake6659c301998-03-03 22:02:19 +0000197%
Fred Drake24340ea1998-04-28 18:30:34 +0000198\newcommand{\py@idxcode}[1]{\texttt{#1}}
199%\renewcommand{\py@idxcode}[1]{#1}
Fred Drake6659c301998-03-03 22:02:19 +0000200
201% Command to generate two index entries (using subentries)
202\newcommand{\indexii}[2]{\index{#1!#2}\index{#2!#1}}
203
204% And three entries (using only one level of subentries)
205\newcommand{\indexiii}[3]{\index{#1!#2 #3}\index{#2!#3, #1}\index{#3!#1 #2}}
206
207% And four (again, using only one level of subentries)
208\newcommand{\indexiv}[4]{
209\index{#1!#2 #3 #4}
210\index{#2!#3 #4, #1}
211\index{#3!#4, #1 #2}
212\index{#4!#1 #2 #3}
213}
214
215% Command to generate a reference to a function, statement, keyword,
216% operator.
Fred Drake0cabff91998-05-06 19:36:01 +0000217\newcommand{\kwindex}[1]{\indexii{keyword}{#1@{\py@idxcode{#1}}}}
Fred Drake24340ea1998-04-28 18:30:34 +0000218\newcommand{\stindex}[1]{\indexii{statement}{#1@{\py@idxcode{#1}}}}
219\newcommand{\opindex}[1]{\indexii{operator}{#1@{\py@idxcode{#1}}}}
220\newcommand{\exindex}[1]{\indexii{exception}{#1@{\py@idxcode{#1}}}}
Fred Drake6659c301998-03-03 22:02:19 +0000221\newcommand{\obindex}[1]{\indexii{object}{#1}}
Fred Drake2351c801998-04-02 18:48:32 +0000222\newcommand{\bifuncindex}[1]{\withsubitem{(built-in function)}{\ttindex{#1()}}}
Fred Drake6659c301998-03-03 22:02:19 +0000223
224% Add an index entry for a module
Fred Drake24340ea1998-04-28 18:30:34 +0000225\newcommand{\py@refmodule}[2]{\index{#1@{\py@idxcode{#1}} (#2module)}}
226\newcommand{\refmodindex}[1]{\py@refmodule{#1}{}}
227\newcommand{\refbimodindex}[1]{\py@refmodule{#1}{built-in }}
228\newcommand{\refexmodindex}[1]{\py@refmodule{#1}{extension }}
229\newcommand{\refstmodindex}[1]{\py@refmodule{#1}{standard }}
Fred Drake6659c301998-03-03 22:02:19 +0000230
231% support for the module index
Fred Drake24340ea1998-04-28 18:30:34 +0000232\newif\ifpy@UseModuleIndex
233\py@UseModuleIndexfalse
Fred Drakeb390daf1998-03-09 16:35:36 +0000234
Fred Drakeb390daf1998-03-09 16:35:36 +0000235\newcommand{\makemodindex}{
236 \newwrite\modindexfile
237 \openout\modindexfile=mod\jobname.idx
Fred Drake24340ea1998-04-28 18:30:34 +0000238 \py@UseModuleIndextrue
Fred Drakeb390daf1998-03-09 16:35:36 +0000239}
240
Fred Drake0ee9f721998-03-12 06:41:40 +0000241% Add the defining entry for a module
Fred Drake24340ea1998-04-28 18:30:34 +0000242\newcommand{\py@modindex}[2]{%
Fred Drakea488f301998-07-23 17:50:45 +0000243 \renewcommand{\py@thismodule}{#1}
Fred Drake6cb71491998-03-27 05:22:53 +0000244 \setindexsubitem{(in module #1)}%
Fred Drake24340ea1998-04-28 18:30:34 +0000245 \index{#1@{\py@idxcode{#1}} (#2module)|textbf}%
246 \ifpy@UseModuleIndex%
Fred Drake0ee9f721998-03-12 06:41:40 +0000247 \write\modindexfile{\protect\indexentry{#1@{\tt #1}}{\thepage}}%
248 \fi%
249}
250
Fred Drake6659c301998-03-03 22:02:19 +0000251% built-in & Python modules in the main distribution
Fred Drake24340ea1998-04-28 18:30:34 +0000252\newcommand{\bimodindex}[1]{\py@modindex{#1}{built-in }}
253\newcommand{\stmodindex}[1]{\py@modindex{#1}{standard }}
Fred Drake6659c301998-03-03 22:02:19 +0000254
255% Python & extension modules outside the main distribution
Fred Drake24340ea1998-04-28 18:30:34 +0000256\newcommand{\modindex}[1]{\py@modindex{#1}{}}
257\newcommand{\exmodindex}[1]{\py@modindex{#1}{extension }}
Fred Drake6659c301998-03-03 22:02:19 +0000258
259% Additional string for an index entry
Fred Drake1c8d0e01998-03-07 05:29:15 +0000260\newcommand{\index@subitem}{}
261\newcommand{\setindexsubitem}[1]{\renewcommand{\index@subitem}{#1}}
Fred Drake24340ea1998-04-28 18:30:34 +0000262\newcommand{\ttindex}[1]{\index{#1@{\py@idxcode{#1}} \index@subitem}}
Fred Drake6659c301998-03-03 22:02:19 +0000263
Fred Drake0ee9f721998-03-12 06:41:40 +0000264\newcommand{\withsubitem}[2]{%
265 \begingroup%
266 \def\index@subitem{#1}#2%
267 \endgroup%
268}
Fred Drake6659c301998-03-03 22:02:19 +0000269
Fred Drake53714971998-04-02 22:33:16 +0000270
Fred Drakea488f301998-07-23 17:50:45 +0000271% Module synopsis processing -----------------------------------------------
272%
273\newcommand{\py@standardIndexModule}[1]{\stmodindex{#1}}
274\newcommand{\py@builtinIndexModule}[1]{\bimodindex{#1}}
275\newcommand{\py@extensionIndexModule}[1]{\exmodindex{#1}}
276\newcommand{\py@IndexModule}[1]{\modindex{#1}}
277
278\newif\ifpy@HaveModSynopsis\py@HaveModSynopsisfalse
279\newif\ifpy@ModSynopsisFileIsOpen\py@ModSynopsisFileIsOpenfalse
280
281% \declaremodule[key]{type}{name}
282\newcommand{\declaremodule}[3][\py@modulebadkey]{
283 \py@openModSynopsisFile
284 \renewcommand{\py@thismoduletype}{#2}
285 \csname py@#2IndexModule\endcsname{#3}
286 \ifx\py@modulebadkey#1
287 \renewcommand{\py@thismodulekey}{#3}
288 \else
289 \renewcommand{\py@thismodulekey}{#1}
290 \fi
291 \label{module-\py@thismodulekey}
292 \py@HaveModSynopsistrue
293}
294
295
296\newcommand{\py@defsynopsis}{Module has no synopsis.}
297\newcommand{\py@modulesynopsis}{\py@defsynopsis}
298\newcommand{\modulesynopsis}[1]{
299 \renewcommand{\py@modulesynopsis}{#1}
300}
301
302% define the file
303\newwrite\py@ModSynopsisFile
304
305% hacked from \addtocontents from latex.ltx:
306\long\def\py@writeModSynopsisFile#1{%
307 \protected@write\py@ModSynopsisFile%
308 {\let\label\@gobble \let\index\@gobble \let\glossary\@gobble}%
309 {\string#1}%
310}
311\newcommand{\py@closeModSynopsisFile}{
312 \ifpy@ModSynopsisFileIsOpen
313 \closeout\py@ModSynopsisFile
314 \py@ModSynopsisFileIsOpenfalse
315 \fi
316}
317\newcommand{\py@openModSynopsisFile}{
318 \ifpy@ModSynopsisFileIsOpen\else
319 \openout\py@ModSynopsisFile=\py@ModSynopsisFilename
320 \py@ModSynopsisFileIsOpentrue
321 \fi
322}
323
324\newcommand{\py@ProcessModSynopsis}{
325 \ifpy@HaveModSynopsis
326 \py@writeModSynopsisFile{\modulesynopsis%
327 {\py@thismodulekey}{\py@thismodule}%
328 {\py@thismoduletype}{\py@modulesynopsis}}%
329 \py@HaveModSynopsisfalse
330 \fi
331 \renewcommand{\py@modulesynopsis}{\py@defsynopsis}
332}
333\AtEndDocument{\py@ProcessModSynopsis\py@closeModSynopsisFile}
334
335\newcommand{\localmoduletable}{
336 \IfFileExists{\py@ModSynopsisFilename}{
337 \begin{synopsistable}
338 \input{\py@ModSynopsisFilename}
339 \end{synopsistable}
340 }{}
341}
342
343\@ifundefined{pdfoutput}{
344 \newcommand{\py@ModSynopsisSummary}[4]{\bfcode{#2} & #4\\}
345}{
346 \newcommand{\py@ModSynopsisSummary}[4]{
347 {\pdfannotlink attr{/Border [0 0 0]} goto name{label-module-#1}
348 \py@LinkColor \bfcode{#2} \py@NormalColor
349 \pdfendlink}& #4\\}
350}
351\newenvironment{synopsistable}{
352 % key, name, type, synopsis
353 \let\modulesynopsis=\py@ModSynopsisSummary
354 \begin{tabular}{ll}
355}{
356 \end{tabular}
357}
358%
359% --------------------------------------------------------------------------
360
361
362\newcommand{\py@thisclass}{}
363\newcommand{\py@thismodule}{}
364\newcommand{\py@thismodulekey}{}
365\newcommand{\py@thismoduletype}{}
366
367\newcommand{\py@reset}{
368 \py@ProcessModSynopsis
369 \renewcommand{\py@thisclass}{}
370 \renewcommand{\py@thismodule}{}
371 \renewcommand{\py@thismodulekey}{}
372 \renewcommand{\py@thismoduletype}{}
373}
374
375% Augment the sectioning commands used to get our own font family in place,
376% and reset some internal data items:
377\renewcommand{\section}{\py@reset%
378 \@startsection{section}{1}{\z@}%
379 {-3.5ex \@plus -1ex \@minus -.2ex}%
380 {2.3ex \@plus.2ex}%
381 {\reset@font\Large\py@HeaderFamily}}
382\renewcommand{\subsection}{\@startsection{subsection}{2}{\z@}%
383 {-3.25ex\@plus -1ex \@minus -.2ex}%
384 {1.5ex \@plus .2ex}%
385 {\reset@font\large\py@HeaderFamily}}
386\renewcommand{\subsubsection}{\@startsection{subsubsection}{3}{\z@}%
387 {-3.25ex\@plus -1ex \@minus -.2ex}%
388 {1.5ex \@plus .2ex}%
389 {\reset@font\normalsize\py@HeaderFamily}}
390\renewcommand{\paragraph}{\@startsection{paragraph}{4}{\z@}%
391 {3.25ex \@plus1ex \@minus.2ex}%
392 {-1em}%
393 {\reset@font\normalsize\py@HeaderFamily}}
394\renewcommand{\subparagraph}{\@startsection{subparagraph}{5}{\parindent}%
395 {3.25ex \@plus1ex \@minus .2ex}%
396 {-1em}%
397 {\reset@font\normalsize\py@HeaderFamily}}
398
399
400% Underscore hack (only act like subscript operator if in math mode)
401%
402% The following is due to Mark Wooding (the old version didn't work with
403% Latex 2e.
404
405\DeclareRobustCommand\hackscore{%
406 \ifmmode_\else\textunderscore\fi%
407}
408\begingroup
409\catcode`\_\active
410\def\next{%
411 \AtBeginDocument{\catcode`\_\active\def_{\hackscore{}}}%
412}
413\expandafter\endgroup\next
414
415
Fred Drake53714971998-04-02 22:33:16 +0000416% Now for a lot of semantically-loaded environments that do a ton of magical
417% things to get the right formatting and index entries for the stuff in
418% Python modules and C API.
419
420
Fred Drake6659c301998-03-03 22:02:19 +0000421% {fulllineitems} is used in one place in libregex.tex, but is really for
422% internal use in this file.
423%
424\newenvironment{fulllineitems}{
425 \begin{list}{}{\labelwidth \leftmargin \labelsep 0pt
426 \rightmargin 0pt \topsep -\parskip \partopsep \parskip
427 \itemsep -\parsep
428 \let\makelabel=\itemnewline}
429}{\end{list}}
430
Fred Drake6cb71491998-03-27 05:22:53 +0000431% \optional is mostly for use in the arguments parameters to the various
432% {*desc} environments defined below, but may be used elsewhere. Known to
433% be used in the debugger chapter.
Fred Drake24340ea1998-04-28 18:30:34 +0000434%
435% Typical usage:
436%
437% \begin{funcdesc}{myfunc}{reqparm\optional{, optparm}}
438% ^^^ ^^^
439% No space here No space here
440%
441% When a function has multiple optional parameters, \optional should be
442% nested, not chained. This is right:
443%
444% \begin{funcdesc}{myfunc}{\optional{parm1\optional{, parm2}}}
445%
Fred Drake6659c301998-03-03 22:02:19 +0000446\newcommand{\optional}[1]{%
447 {\textnormal{\Large[}}{#1}\hspace{0.5mm}{\textnormal{\Large]}}}
448
Fred Drake6cb71491998-03-27 05:22:53 +0000449% C functions ------------------------------------------------------------
450% \begin{cfuncdesc}{type}{name}{arglist}
451\newenvironment{cfuncdesc}[3]{
452 \begin{fulllineitems}
Fred Drake24340ea1998-04-28 18:30:34 +0000453 \item[\code{#1 \bfcode{#2}(\py@varvars{#3})}\index{#2@{\py@idxcode{#2()}}}]
Fred Drake6cb71491998-03-27 05:22:53 +0000454}{\end{fulllineitems}}
455
456% C variables ------------------------------------------------------------
457% \begin{cvardesc}{type}{name}
458\newenvironment{cvardesc}[2]{
459 \begin{fulllineitems}
Fred Drake24340ea1998-04-28 18:30:34 +0000460 \item[\code{#1 \bfcode{#2}}\index{#2@{\py@idxcode{#2}}}]
Fred Drake6cb71491998-03-27 05:22:53 +0000461}{\end{fulllineitems}}
462
463% C data types -----------------------------------------------------------
464% \begin{ctypedesc}{typedef name}
465\newenvironment{ctypedesc}[1]{
466 \begin{fulllineitems}
467 \item[\bfcode{#1}\ttindex{#1}]
468}{\end{fulllineitems}}
469
470% simple functions (not methods) -----------------------------------------
471% \begin{funcdesc}{name}{args}
472\newcommand{\funcline}[2]{\funclineni{#1}{#2}\ttindex{#1()}}
473\newenvironment{funcdesc}[2]{
474 \begin{fulllineitems}
475 \funcline{#1}{#2}
476}{\end{fulllineitems}}
477
Fred Drake6659c301998-03-03 22:02:19 +0000478% similar to {funcdesc}, but doesn't add to the index
Fred Drake300775d1998-04-17 02:17:00 +0000479\newcommand{\funclineni}[2]{\item[\code{\bfcode{#1}(\py@varvars{#2})}]}
Fred Drake6cb71491998-03-27 05:22:53 +0000480\newenvironment{funcdescni}[2]{
481 \begin{fulllineitems}
482 \funclineni{#1}{#2}
Fred Drake6659c301998-03-03 22:02:19 +0000483}{\end{fulllineitems}}
484
Fred Drake6cb71491998-03-27 05:22:53 +0000485% classes ----------------------------------------------------------------
486% \begin{classdesc}{name}{constructor args}
487\newenvironment{classdesc}[2]{
Fred Drakea488f301998-07-23 17:50:45 +0000488 \renewcommand{\py@thisclass}{#1}
Fred Drake6cb71491998-03-27 05:22:53 +0000489 \begin{fulllineitems}
Fred Drake300775d1998-04-17 02:17:00 +0000490 \item[\code{\bfcode{#1}(\py@varvars{#2})}%
Fred Drake24340ea1998-04-28 18:30:34 +0000491 \withsubitem{(class in \py@thismodule)}{\ttindex{#1}}]
Fred Drake6659c301998-03-03 22:02:19 +0000492}{\end{fulllineitems}}
493
Fred Drake6cb71491998-03-27 05:22:53 +0000494
Fred Drake24340ea1998-04-28 18:30:34 +0000495\let\py@classbadkey=\@undefined
Fred Drake6cb71491998-03-27 05:22:53 +0000496
497% object method ----------------------------------------------------------
498% \begin{methoddesc}[classname]{methodname}{args}
Fred Drake24340ea1998-04-28 18:30:34 +0000499\newcommand{\methodline}[3][\py@classbadkey]{
Fred Drake6cb71491998-03-27 05:22:53 +0000500 \methodlineni{#2}{#3}
501 \ifx#1\@undefined
Fred Drake24340ea1998-04-28 18:30:34 +0000502 \withsubitem{(\py@thisclass\ method)}{\ttindex{#2()}}
Fred Drake6cb71491998-03-27 05:22:53 +0000503 \else
504 \withsubitem{(#1 method)}{\ttindex{#2()}}
505 \fi
506}
Fred Drake24340ea1998-04-28 18:30:34 +0000507\newenvironment{methoddesc}[3][\py@classbadkey]{
Fred Drake6cb71491998-03-27 05:22:53 +0000508 \begin{fulllineitems}
509 \ifx#1\@undefined
510 \methodline{#2}{#3}
511 \else
Fred Drake24340ea1998-04-28 18:30:34 +0000512 \def\py@thisclass{#1}
Fred Drake6cb71491998-03-27 05:22:53 +0000513 \methodline[#1]{#2}{#3}
514 \fi
Fred Drake6659c301998-03-03 22:02:19 +0000515}{\end{fulllineitems}}
516
Fred Drake6cb71491998-03-27 05:22:53 +0000517% similar to {methoddesc}, but doesn't add to the index
518% (never actually uses the optional argument)
Fred Drake24340ea1998-04-28 18:30:34 +0000519\newcommand{\methodlineni}[3][\py@classbadkey]{%
Fred Drake300775d1998-04-17 02:17:00 +0000520 \item[\code{\bfcode{#2}(\py@varvars{#3})}]}
Fred Drake24340ea1998-04-28 18:30:34 +0000521\newenvironment{methoddescni}[3][\py@classbadkey]{
Fred Drake6cb71491998-03-27 05:22:53 +0000522 \begin{fulllineitems}
523 \methodlineni{#2}{#3}
524}{\end{fulllineitems}}
525
526% object data attribute --------------------------------------------------
527% \begin{memberdesc}[classname]{membername}
Fred Drake24340ea1998-04-28 18:30:34 +0000528\newcommand{\memberline}[2][\py@classbadkey]{%
Fred Drake6cb71491998-03-27 05:22:53 +0000529 \ifx#1\@undefined
530 \memberlineni{#2}
Fred Drake24340ea1998-04-28 18:30:34 +0000531 \withsubitem{(\py@thisclass\ attribute)}{\ttindex{#2}}
Fred Drake6cb71491998-03-27 05:22:53 +0000532 \else
533 \memberlineni{#2}
Fred Drake41565f61998-04-07 19:32:40 +0000534 \withsubitem{(#1 attribute)}{\ttindex{#2}}
Fred Drake6cb71491998-03-27 05:22:53 +0000535 \fi
536}
Fred Drake24340ea1998-04-28 18:30:34 +0000537\newenvironment{memberdesc}[2][\py@classbadkey]{
Fred Drake6cb71491998-03-27 05:22:53 +0000538 \begin{fulllineitems}
539 \ifx#1\@undefined
540 \memberline{#2}
541 \else
Fred Drake24340ea1998-04-28 18:30:34 +0000542 \def\py@thisclass{#1}
Fred Drake6cb71491998-03-27 05:22:53 +0000543 \memberline[#1]{#2}
544 \fi
545}{\end{fulllineitems}}
546
547% similar to {memberdesc}, but doesn't add to the index
548% (never actually uses the optional argument)
Fred Drake24340ea1998-04-28 18:30:34 +0000549\newcommand{\memberlineni}[2][\py@classbadkey]{\item[\bfcode{#2}]}
550\newenvironment{memberdescni}[2][\py@classbadkey]{
Fred Drake6cb71491998-03-27 05:22:53 +0000551 \begin{fulllineitems}
552 \memberlineni{#2}
553}{\end{fulllineitems}}
554
555% For exceptions: --------------------------------------------------------
556% \begin{excdesc}{name}
557% -- need support for constructor; maybe use optional parameter?
558\newenvironment{excdesc}[1]{
559 \begin{fulllineitems}
560 \item[\bfcode{#1}\ttindex{#1}]
561}{\end{fulllineitems}}
562
563% Module data or constants: ----------------------------------------------
564% \begin{datadesc}{name}
Fred Drake6659c301998-03-03 22:02:19 +0000565\newcommand{\dataline}[1]{\datalineni{#1}\ttindex{#1}}
Fred Drake6cb71491998-03-27 05:22:53 +0000566\newenvironment{datadesc}[1]{
567 \begin{fulllineitems}
568 \dataline{#1}
Fred Drake6659c301998-03-03 22:02:19 +0000569}{\end{fulllineitems}}
570
571% similar to {datadesc}, but doesn't add to the index
Fred Drake6cb71491998-03-27 05:22:53 +0000572\newcommand{\datalineni}[1]{\item[\bfcode{#1}]\nopagebreak}
573\newenvironment{datadescni}[1]{
574 \begin{fulllineitems}
575 \datalineni{#1}
Fred Drake6659c301998-03-03 22:02:19 +0000576}{\end{fulllineitems}}
577
Fred Drake6cb71491998-03-27 05:22:53 +0000578% bytecode instruction ---------------------------------------------------
579% \begin{opcodedesc}{name}{var}
580% -- {var} may be {}
581\newenvironment{opcodedesc}[2]{
582 \begin{fulllineitems}
583 \item[\bfcode{#1}\quad\var{#2}]
Fred Drake6659c301998-03-03 22:02:19 +0000584}{\end{fulllineitems}}
585
586
Fred Drake24340ea1998-04-28 18:30:34 +0000587\newcommand{\nodename}[1]{\label{#1}}
Fred Drake55730311998-03-25 15:41:23 +0000588
Fred Drake6659c301998-03-03 22:02:19 +0000589% For these commands, use \command{} to get the typography right, not
590% {\command}. This works better with the texinfo translation.
591\newcommand{\ABC}{{\sc abc}}
592\newcommand{\UNIX}{{\sc Unix}}
593\newcommand{\POSIX}{POSIX}
594\newcommand{\ASCII}{{\sc ascii}}
595\newcommand{\Cpp}{C\protect\raisebox{.18ex}{++}}
596\newcommand{\C}{C}
597\newcommand{\EOF}{{\sc eof}}
Fred Drake24340ea1998-04-28 18:30:34 +0000598\newcommand{\NULL}{\constant{NULL}}
Fred Drake6659c301998-03-03 22:02:19 +0000599
Fred Drake53714971998-04-02 22:33:16 +0000600% Also for consistency: spell Python "Python", not "python"!
601
Fred Drake6659c301998-03-03 22:02:19 +0000602% code is the most difficult one...
Fred Drake1c8d0e01998-03-07 05:29:15 +0000603\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 Drake24340ea1998-04-28 18:30:34 +0000604\texttt{#1}}}
Fred Drake6659c301998-03-03 22:02:19 +0000605
606\newcommand{\bfcode}[1]{\code{\bfseries#1}} % bold-faced code font
Fred Drake8e54abe1998-07-01 14:49:25 +0000607\newcommand{\kbd}[1]{\code{#1}}
Fred Drake24340ea1998-04-28 18:30:34 +0000608\newcommand{\samp}[1]{`\code{#1}'}
Fred Drake6659c301998-03-03 22:02:19 +0000609% This weird definition of \var{} allows it to always appear in roman
610% italics, and won't get funky in code fragments when we play around
611% with fonts.
Fred Drake24340ea1998-04-28 18:30:34 +0000612\newcommand{\var}[1]{\normalsize\textrm{\textit{#1\/}}}
613\renewcommand{\emph}[1]{{\em #1}}
Fred Drake6659c301998-03-03 22:02:19 +0000614\newcommand{\dfn}[1]{\emph{#1}}
615\newcommand{\strong}[1]{{\bf #1}}
616% let's experiment with a new font:
Fred Drake0ee9f721998-03-12 06:41:40 +0000617\newcommand{\file}[1]{`{\small\textsf{#1}}'}
Fred Drake6659c301998-03-03 22:02:19 +0000618
619% Use this def/redef approach for \url{} since hyperref defined this already,
620% but only if we actually used hyperref:
Fred Drake6cb71491998-03-27 05:22:53 +0000621\@ifundefined{pdfannotlink}{
Fred Drakea2c2a831998-04-15 17:50:01 +0000622 \newcommand{\py@url}[1]{\mbox{\small\textsf{#1}}}
Fred Drake6659c301998-03-03 22:02:19 +0000623}{
Fred Drakea2c2a831998-04-15 17:50:01 +0000624 \newcommand{\py@url}[1]{{%
Fred Drake6659c301998-03-03 22:02:19 +0000625 \pdfannotlink attr{/Border [0 0 0]} user{/S /URI /URI (#1)}%
Fred Drake24340ea1998-04-28 18:30:34 +0000626 \py@LinkColor% color of the link text
627 \mbox{\small\textsf{#1}}%
628 \py@NormalColor% Turn it back off; these are declarative
Fred Drake6659c301998-03-03 22:02:19 +0000629 \pdfendlink}% and don't appear bound to the current
630 }% formatting "box".
631}
Fred Drakea2c2a831998-04-15 17:50:01 +0000632\let\url=\py@url
Fred Drake0ee9f721998-03-12 06:41:40 +0000633\newcommand{\email}[1]{{\small\textsf{#1}}}
Fred Drake454a4fb1998-04-01 22:20:14 +0000634\newcommand{\newsgroup}[1]{{\small\textsf{#1}}}
Fred Drake6659c301998-03-03 22:02:19 +0000635
Fred Drake300775d1998-04-17 02:17:00 +0000636\newcommand{\py@varvars}[1]{{\def\,{\/{\char`\,}}\var{#1}}}
Fred Drake24340ea1998-04-28 18:30:34 +0000637% let's see if this breaks anything now; we may be able to simplify...
638\renewcommand{\py@varvars}[1]{\var{#1}}
Fred Drake6659c301998-03-03 22:02:19 +0000639
Fred Drake24340ea1998-04-28 18:30:34 +0000640% I'd really like to get rid of this!
Fred Drake6659c301998-03-03 22:02:19 +0000641\newif\iftexi\texifalse
Fred Drake6659c301998-03-03 22:02:19 +0000642
643% These should be used for all references to identifiers which are
644% used to refer to instances of specific language constructs. See the
645% names for specific semantic assignments.
646%
647% For now, don't do anything really fancy with them; just use them as
648% logical markup. This might change in the future.
649%
Fred Drake24340ea1998-04-28 18:30:34 +0000650\newcommand{\module}[1]{\texttt{#1}}
651\newcommand{\keyword}[1]{\texttt{#1}}
652\newcommand{\exception}[1]{\texttt{#1}}
653\newcommand{\class}[1]{\texttt{#1}}
654\newcommand{\function}[1]{\texttt{#1}}
655\newcommand{\member}[1]{\texttt{#1}}
656\newcommand{\method}[1]{\texttt{#1}}
Fred Drake6659c301998-03-03 22:02:19 +0000657
Fred Drake53714971998-04-02 22:33:16 +0000658\newcommand{\pytype}[1]{#1} % built-in Python type
659
Fred Drake24340ea1998-04-28 18:30:34 +0000660\newcommand{\cfunction}[1]{\texttt{#1}}
661\newcommand{\ctype}[1]{\texttt{#1}} % C struct or typedef name
662\newcommand{\cdata}[1]{\texttt{#1}} % C variable, typically global
Fred Drake6659c301998-03-03 22:02:19 +0000663
Fred Drake0ee9f721998-03-12 06:41:40 +0000664\newcommand{\mimetype}[1]{{\small\textsf{#1}}}
Fred Drake94fac131998-03-12 19:37:03 +0000665% The \! is a "negative thin space" in math mode.
666\newcommand{\regexp}[1]{%
667 {\tiny$^{^\lceil}\!\!$%
668 {\normalsize\code{#1}}%
Fred Drake47cfd031998-04-03 21:22:31 +0000669 $\!\rfloor\!$%
Fred Drake94fac131998-03-12 19:37:03 +0000670 }}
Fred Drake0ee9f721998-03-12 06:41:40 +0000671\newcommand{\envvar}[1]{%
Fred Drake94fac131998-03-12 19:37:03 +0000672 \$#1% $ <-- bow to font-lock 3 times!
673 \index{#1@{\$#1}}% $
674 \index{environment variables!{\$#1}}% $
Fred Drake0ee9f721998-03-12 06:41:40 +0000675}
Fred Drake24340ea1998-04-28 18:30:34 +0000676\newcommand{\makevar}[1]{#1} % variable in a Makefile
677\newcommand{\character}[1]{\samp{#1}}
Fred Drake0ee9f721998-03-12 06:41:40 +0000678
Fred Drake6659c301998-03-03 22:02:19 +0000679% constants defined in Python modules or C headers, not language constants:
Fred Drake24340ea1998-04-28 18:30:34 +0000680\newcommand{\constant}[1]{\code{#1}} % manifest constant, not syntactic
Fred Drake6659c301998-03-03 22:02:19 +0000681
682\newcommand{\manpage}[2]{{\emph{#1}(#2)}}
683\newcommand{\rfc}[1]{RFC #1\index{RFC!RFC #1}}
684\newcommand{\program}[1]{\strong{#1}}
685
686
687% Deprecation stuff.
688% Should be extended to allow an index / list of deprecated stuff. But
689% there's a lot of stuff that needs to be done to make that automatable.
690%
691% First parameter is the release number that deprecates the feature, the
692% second is the action the should be taken by users of the feature.
693%
694% Example:
695%
Fred Drake24340ea1998-04-28 18:30:34 +0000696% \deprecated{1.5.1}{Use \method{frobnicate()} instead.}
Fred Drake6659c301998-03-03 22:02:19 +0000697%
698\newcommand{\deprecated}[2]{%
699 \strong{Deprecated since release #1.} #2\par}
700
701
702\newenvironment{tableii}[4]{%
703 \begin{center}%
704 \def\lineii##1##2{\csname#2\endcsname{##1}&##2\\}%
Fred Drakeee601911998-04-11 20:53:03 +0000705 \begin{tabular}{#1}\strong{#3}&\strong{#4} \\ \hline%
Fred Drake6659c301998-03-03 22:02:19 +0000706}{%
Fred Drake6659c301998-03-03 22:02:19 +0000707 \end{tabular}%
708 \end{center}%
709}
710
711\newenvironment{tableiii}[5]{%
712 \begin{center}%
713 \def\lineiii##1##2##3{\csname#2\endcsname{##1}&##2&##3\\}%
Fred Drakeee601911998-04-11 20:53:03 +0000714 \begin{tabular}{#1}\strong{#3}&\strong{#4}&\strong{#5} \\ \hline%
Fred Drake6659c301998-03-03 22:02:19 +0000715}{%
Fred Drake6659c301998-03-03 22:02:19 +0000716 \end{tabular}%
717 \end{center}%
718}
719
720\newcommand{\itemnewline}[1]{%
Fred Drake1c8d0e01998-03-07 05:29:15 +0000721 \@tempdima\linewidth%
722 \advance\@tempdima \leftmargin\makebox[\@tempdima][l]{#1}%
Fred Drake6659c301998-03-03 22:02:19 +0000723}
724
Fred Drake0cabff91998-05-06 19:36:01 +0000725% Define \itembreak: force the text after an item to start on a new line
726\newcommand{\itembreak}{%
727 \mbox{}%
728 \\*[0mm]%
729}
730
731% Define \itemjoin: some negative vspace to join two items together
732\newcommand{\itemjoin}{%
733 \mbox{}%
734 \vspace{-\itemsep}%
735 \vspace{-\parsep}%
736}
737
Fred Drake24340ea1998-04-28 18:30:34 +0000738% Cross-referencing (AMK, new impl. FLD)
Fred Drake6659c301998-03-03 22:02:19 +0000739% Sample usage:
740% \begin{seealso}
741% \seemodule{rand}{Uniform random number generator}; % Module xref
742% \seetext{\emph{Encyclopedia Britannica}}. % Ref to a book
Fred Drakeebcb6581998-03-06 21:25:17 +0000743%
744% % A funky case: module name contains '_'; have to supply an optional key
745% \seemodule[copyreg]{copy_reg}{pickle interface constructor registration}
746%
Fred Drake6659c301998-03-03 22:02:19 +0000747% \end{seealso}
748
Fred Drake1c8d0e01998-03-07 05:29:15 +0000749\@ifundefined{pdfannotlink}{%
Fred Drake24340ea1998-04-28 18:30:34 +0000750 \newcommand{\py@seemodule}[3][\py@modulebadkey]{%
751 \ifx\py@modulebadkey#1\def\py@modulekey{#2}\else\def\py@modulekey{#1}\fi%
752 \ref{module-\py@modulekey}:\quad %
Fred Drakeebcb6581998-03-06 21:25:17 +0000753 Module \module{#2}%
754 \quad (#3)%
755 }
Fred Drake24340ea1998-04-28 18:30:34 +0000756}{\newcommand{\py@seemodule}[3][\py@modulebadkey]{%
757 \ifx\py@modulebadkey#1\def\py@modulekey{#2}\else\def\py@modulekey{#1}\fi%
758 \ref{module-\py@modulekey}:\quad %
759 {\pdfannotlink attr{/Border [0 0 0]} goto name{label-module-\py@modulekey}%
760 \py@LinkColor Module \module{#2} \py@NormalColor%
Fred Drakeebcb6581998-03-06 21:25:17 +0000761 \pdfendlink%
762 }%
763 \quad (#3)%
764 }
765}
Fred Drake6659c301998-03-03 22:02:19 +0000766\newenvironment{seealso}[0]{
767 \strong{See Also:}\par
Fred Drake6659c301998-03-03 22:02:19 +0000768 \def\seetext##1{\par{##1}}
Fred Drake24340ea1998-04-28 18:30:34 +0000769 \let\seemodule=\py@seemodule
Fred Drake6659c301998-03-03 22:02:19 +0000770}{\par}
771
772
Fred Drake6659c301998-03-03 22:02:19 +0000773% Allow the release number to be specified independently of the
774% \date{}. This allows the date to reflect the document's date and
775% release to specify the Python release that is documented.
776%
Fred Drake24340ea1998-04-28 18:30:34 +0000777\newcommand{\py@release}{}
Fred Drake6659c301998-03-03 22:02:19 +0000778\newcommand{\version}{}
779\newcommand{\releasename}{Release}
780\newcommand{\release}[1]{%
Fred Drake24340ea1998-04-28 18:30:34 +0000781 \renewcommand{\py@release}{\releasename\space\version}%
Fred Drake6659c301998-03-03 22:02:19 +0000782 \renewcommand{\version}{#1}}
783
784% Allow specification of the author's address separately from the
785% author's name. This can be used to format them differently, which
786% is a good thing.
787%
Fred Drake24340ea1998-04-28 18:30:34 +0000788\newcommand{\py@authoraddress}{}
789\newcommand{\authoraddress}[1]{\renewcommand{\py@authoraddress}{#1}}
Fred Drake6df93ef1998-05-14 20:56:31 +0000790\let\developersaddress=\authoraddress
791\let\developer=\author
792\let\developers=\author
Fred Drake6659c301998-03-03 22:02:19 +0000793
Fred Drake6659c301998-03-03 22:02:19 +0000794% This sets up the fancy chapter headings that make the documents look
795% at least a little better than the usual LaTeX output.
796%
Fred Drake1c8d0e01998-03-07 05:29:15 +0000797\@ifundefined{ChTitleVar}{}{
Fred Drake24340ea1998-04-28 18:30:34 +0000798 \ChNameVar{\raggedleft\normalsize\py@HeaderFamily}
799 \ChNumVar{\raggedleft \bfseries\Large\py@HeaderFamily}
800 \ChTitleVar{\raggedleft \rm\Huge\py@HeaderFamily}
Fred Drake6659c301998-03-03 22:02:19 +0000801 % This creates chapter heads without the leading \vspace*{}:
Fred Drake1c8d0e01998-03-07 05:29:15 +0000802 \def\@makechapterhead#1{%
803 {\parindent \z@ \raggedright \normalfont
804 \ifnum \c@secnumdepth >\m@ne
Fred Drake6659c301998-03-03 22:02:19 +0000805 \DOCH
806 \fi
Fred Drake1c8d0e01998-03-07 05:29:15 +0000807 \interlinepenalty\@M
Fred Drake6659c301998-03-03 22:02:19 +0000808 \DOTI{#1}
809 }
810 }
Fred Drake6659c301998-03-03 22:02:19 +0000811}
812
Fred Drake3bf78651998-05-20 17:42:17 +0000813
814% Definition lists; requested by AMK for HOWTO documents. Probably useful
815% elsewhere as well, so keep in in the general style support.
816%
817\newenvironment{definitions}{%
818 \begin{description}%
819 \def\term##1{\item[##1]\itembreak}
820}{%
821 \end{description}%
822}
823
Fred Drake6659c301998-03-03 22:02:19 +0000824% Tell TeX about pathological hyphenation cases:
825\hyphenation{Base-HTTP-Re-quest-Hand-ler}