blob: c271e354222d9384599a5d857ed368804ed5b177 [file] [log] [blame]
Fred Drakeacffaee1999-03-16 16:09:13 +00001\documentclass{howto}
2\usepackage{ltxmarkup}
3
4\title{Documenting Python}
5
6\input{boilerplate}
7
Fred Drakec7c9a641999-04-28 18:24:02 +00008% Now override the stuff that includes author information;
9% Guido did *not* write this one!
Fred Drakeacffaee1999-03-16 16:09:13 +000010
11\author{Fred L. Drake, Jr.}
12\authoraddress{
Fred Drake8fdb6382000-10-28 04:08:38 +000013 PythonLabs \\
14 E-mail: \email{fdrake@acm.org}
Fred Drakeacffaee1999-03-16 16:09:13 +000015}
Fred Drakeacffaee1999-03-16 16:09:13 +000016
17
18\begin{document}
19
20\maketitle
21
22\begin{abstract}
23\noindent
Fred Drake02997492000-09-21 05:26:43 +000024The Python language has a substantial body of
Fred Drakeacffaee1999-03-16 16:09:13 +000025documentation, much of it contributed by various authors. The markup
26used for the Python documentation is based on \LaTeX{} and requires a
27significant set of macros written specifically for documenting Python.
Fred Drake5eb992b1999-06-11 14:25:45 +000028This document describes the macros introduced to support Python
29documentation and how they should be used to support a wide range of
30output formats.
Fred Drakeacffaee1999-03-16 16:09:13 +000031
32This document describes the document classes and special markup used
33in the Python documentation. Authors may use this guide, in
34conjunction with the template files provided with the
35distribution, to create or maintain whole documents or sections.
36\end{abstract}
37
38\tableofcontents
39
40
41\section{Introduction}
42
43 Python's documentation has long been considered to be good for a
44 free programming language. There are a number of reasons for this,
45 the most important being the early commitment of Python's creator,
46 Guido van Rossum, to providing documentation on the language and its
47 libraries, and the continuing involvement of the user community in
48 providing assistance for creating and maintaining documentation.
49
50 The involvement of the community takes many forms, from authoring to
Fred Drake7a737df1999-04-23 14:41:44 +000051 bug reports to just plain complaining when the documentation could
52 be more complete or easier to use. All of these forms of input from
53 the community have proved useful during the time I've been involved
54 in maintaining the documentation.
Fred Drakeacffaee1999-03-16 16:09:13 +000055
Fred Drake2c4e0091999-03-29 14:55:55 +000056 This document is aimed at authors and potential authors of
Fred Drake7a737df1999-04-23 14:41:44 +000057 documentation for Python. More specifically, it is for people
58 contributing to the standard documentation and developing additional
59 documents using the same tools as the standard documents. This
60 guide will be less useful for authors using the Python documentation
61 tools for topics other than Python, and less useful still for
62 authors not using the tools at all.
Fred Drakeacffaee1999-03-16 16:09:13 +000063
Fred Drake2c4e0091999-03-29 14:55:55 +000064 The material in this guide is intended to assist authors using the
65 Python documentation tools. It includes information on the source
66 distribution of the standard documentation, a discussion of the
Fred Drake7a737df1999-04-23 14:41:44 +000067 document types, reference material on the markup defined in the
68 document classes, a list of the external tools needed for processing
Fred Drake2c4e0091999-03-29 14:55:55 +000069 documents, and reference material on the tools provided with the
70 documentation resources. At the end, there is also a section
Fred Drake7a737df1999-04-23 14:41:44 +000071 discussing future directions for the Python documentation and where
72 to turn for more information.
Fred Drakeacffaee1999-03-16 16:09:13 +000073
74\section{Directory Structure}
75
76 The source distribution for the standard Python documentation
77 contains a large number of directories. While third-party documents
78 do not need to be placed into this structure or need to be placed
79 within a similar structure, it can be helpful to know where to look
80 for examples and tools when developing new documents using the
81 Python documentation tools. This section describes this directory
82 structure.
83
84 The documentation sources are usually placed within the Python
Fred Drake7a737df1999-04-23 14:41:44 +000085 source distribution as the top-level directory \file{Doc/}, but
86 are not dependent on the Python source distribution in any way.
Fred Drakeacffaee1999-03-16 16:09:13 +000087
88 The \file{Doc/} directory contains a few files and several
89 subdirectories. The files are mostly self-explanatory, including a
90 \file{README} and a \file{Makefile}. The directories fall into
91 three categories:
92
93 \begin{definitions}
94 \term{Document Sources}
95 The \LaTeX{} sources for each document are placed in a
Fred Drake02997492000-09-21 05:26:43 +000096 separate directory. These directories are given short
97 names which vaguely indicate the document in each:
Fred Drake2f4bebd1999-04-28 16:43:11 +000098
99 \begin{tableii}{p{.75in}|p{3in}}{filenq}{Directory}{Document Title}
Fred Drake31edf4d2000-09-07 20:06:07 +0000100 \lineii{api/}
101 {\citetitle[../api/api.html]{The Python/C API}}
102 \lineii{dist/}
103 {\citetitle[../dist/dist.html]{Distributing Python Modules}}
104 \lineii{doc/}
105 {\citetitle[../doc/doc.html]{Documenting Python}}
106 \lineii{ext/}
107 {\citetitle[../ext/ext.html]{Extending and Embedding the Python Interpreter}}
108 \lineii{inst/}
109 {\citetitle[../inst/inst.html]{Installing Python Modules}}
110 \lineii{lib/}
111 {\citetitle[../lib/lib.html]{Python Library Reference}}
112 \lineii{mac/}
113 {\citetitle[../mac/mac.html]{Macintosh Module Reference}}
114 \lineii{ref/}
115 {\citetitle[../ref/ref.html]{Python Reference Manual}}
116 \lineii{tut/}
117 {\citetitle[../tut/tut.html]{Python Tutorial}}
Fred Drake2f4bebd1999-04-28 16:43:11 +0000118 \end{tableii}
Fred Drakeacffaee1999-03-16 16:09:13 +0000119
120 \term{Format-Specific Output}
Fred Drake2c4e0091999-03-29 14:55:55 +0000121 Most output formats have a directory which contains a
Fred Drakeacffaee1999-03-16 16:09:13 +0000122 \file{Makefile} which controls the generation of that format
123 and provides storage for the formatted documents. The only
Fred Drake2c4e0091999-03-29 14:55:55 +0000124 variations within this category are the Portable Document
125 Format (PDF) and PostScript versions are placed in the
Fred Drake7a737df1999-04-23 14:41:44 +0000126 directories \file{paper-a4/} and \file{paper-letter/} (this
127 causes all the temporary files created by \LaTeX{} to be kept
128 in the same place for each paper size, where they can be more
129 easily ignored).
Fred Drakeacffaee1999-03-16 16:09:13 +0000130
Fred Drake2f4bebd1999-04-28 16:43:11 +0000131 \begin{tableii}{p{.75in}|p{3in}}{filenq}{Directory}{Output Formats}
132 \lineii{html/}{HTML output}
133 \lineii{info/}{GNU info output}
134 \lineii{paper-a4/}{PDF and PostScript, A4 paper}
135 \lineii{paper-letter/}{PDF and PostScript, US-Letter paper}
136 \end{tableii}
137
Fred Drakeacffaee1999-03-16 16:09:13 +0000138 \term{Supplemental Files}
139 Some additional directories are used to store supplemental
140 files used for the various processes. Directories are
141 included for the shared \LaTeX{} document classes, the
142 \LaTeX2HTML support, template files for various document
143 components, and the scripts used to perform various steps in
144 the formatting processes.
Fred Drake2f4bebd1999-04-28 16:43:11 +0000145
146 \begin{tableii}{p{.75in}|p{3in}}{filenq}{Directory}{Contents}
147 \lineii{perl/}{Support for \LaTeX2HTML processing}
148 \lineii{templates/}{Example files for source documents}
149 \lineii{texinputs/}{Style implementation for \LaTeX}
150 \lineii{tools/}{Custom processing scripts}
151 \end{tableii}
152
Fred Drakeacffaee1999-03-16 16:09:13 +0000153 \end{definitions}
154
Fred Drake2c4e0091999-03-29 14:55:55 +0000155
Fred Drakeadade921999-04-22 13:05:27 +0000156\section{\LaTeX{} Primer \label{latex-primer}}
Fred Drake2c4e0091999-03-29 14:55:55 +0000157
Fred Drakeadade921999-04-22 13:05:27 +0000158 This section is a brief introduction to \LaTeX{} concepts and
159 syntax, to provide authors enough information to author documents
160 productively without having to become ``\TeX{}nicians.''
161
Fred Drake5eb992b1999-06-11 14:25:45 +0000162 Perhaps the most important concept to keep in mind while marking up
Fred Drake02997492000-09-21 05:26:43 +0000163 Python documentation is that while \TeX{} is unstructured, \LaTeX{} was
Fred Drake5eb992b1999-06-11 14:25:45 +0000164 designed as a layer on top of \TeX{} which specifically supports
165 structured markup. The Python-specific markup is intended to extend
166 the structure provided by standard \LaTeX{} document classes to
167 support additional information specific to Python.
168
Fred Drakeadade921999-04-22 13:05:27 +0000169 \LaTeX{} documents contain two parts: the preamble and the body.
170 The preamble is used to specify certain metadata about the document
171 itself, such as the title, the list of authors, the date, and the
172 \emph{class} the document belongs to. Additional information used
173 to control index generation and the use of bibliographic databases
Fred Drake7a737df1999-04-23 14:41:44 +0000174 can also be placed in the preamble. For most authors, the preamble
Fred Drakeadade921999-04-22 13:05:27 +0000175 can be most easily created by copying it from an existing document
176 and modifying a few key pieces of information.
177
178 The \dfn{class} of a document is used to place a document within a
179 broad category of documents and set some fundamental formatting
180 properties. For Python documentation, two classes are used: the
181 \code{manual} class and the \code{howto} class. These classes also
182 define the additional markup used to document Python concepts and
183 structures. Specific information about these classes is provided in
Fred Drake7a737df1999-04-23 14:41:44 +0000184 section \ref{classes}, ``Document Classes,'' below. The first thing
Fred Drakeadade921999-04-22 13:05:27 +0000185 in the preamble is the declaration of the document's class.
186
187 After the class declaration, a number of \emph{macros} are used to
188 provide further information about the document and setup any
Fred Drake7a737df1999-04-23 14:41:44 +0000189 additional markup that is needed. No output is generated from the
190 preamble; it is an error to include free text in the preamble
191 because it would cause output.
Fred Drakeadade921999-04-22 13:05:27 +0000192
193 The document body follows the preamble. This contains all the
Fred Drake63568aa2000-10-19 05:36:10 +0000194 printed components of the document marked up structurally. Generic
Fred Drake4c6f17a2001-04-18 05:12:47 +0000195 \LaTeX{} structures include hierarchical sections, numbered and
196 bulleted lists, and special structures for the document abstract and
197 indexes.
Fred Drakeadade921999-04-22 13:05:27 +0000198
Fred Drake63568aa2000-10-19 05:36:10 +0000199 \subsection{Syntax}
200
Fred Drake4c6f17a2001-04-18 05:12:47 +0000201 There are some things that an author of Python documentation needs
202 to know about \LaTeX{} syntax.
Fred Drake63568aa2000-10-19 05:36:10 +0000203
204 A \dfn{comment} is started by the ``percent'' character
205 (\character{\%}) and continues through the end of the line and all
206 leading whitespace on the following line. This is a little
207 different from any programming language I know of, so an example
208 is in order:
209
210\begin{verbatim}
211This is text.% comment
212 This is more text. % another comment
213Still more text.
214\end{verbatim}
215
216 The first non-comment character following the first comment is the
217 letter \character{T} on the second line; the leading whitespace on
218 that line is consumed as part of the first comment. This means
219 that there is no space between the first and second sentences, so
220 the period and letter \character{T} will be directly adjacent in
221 the typeset document.
222
223 Note also that though the first non-comment character after the
224 second comment is the letter \character{S}, there is whitespace
225 preceding the comment, so the two sentences are separated as
226 expected.
227
228 A \dfn{group} is an enclosure for a collection of text and
229 commands which encloses the formatting context and constrains the
230 scope of any changes to that context made by commands within the
231 group. Groups can be nested hierarchically. The formatting
232 context includes the font and the definition of additional macros
233 (or overrides of macros defined in outer groups). Syntactically,
234 groups are enclosed in braces:
235
236\begin{verbatim}
237{text in a group}
238\end{verbatim}
239
Fred Drake4c6f17a2001-04-18 05:12:47 +0000240 An alternate syntax for a group using brackets, \code{[...]}, is
Fred Drake63568aa2000-10-19 05:36:10 +0000241 used by macros and environment constructors which take optional
242 parameters; brackets do not normally hold syntactic significance.
243 A degenerate group, containing only one atomic bit of content,
244 does not need to have an explicit group, unless it is required to
245 avoid ambiguity. Since Python tends toward the explicit, groups
246 are also made explicit in the documentation markup.
247
248 Groups are used only sparingly in the Python documentation, except
249 for their use in marking parameters to macros and environments.
250
Fred Drake4c6f17a2001-04-18 05:12:47 +0000251 A \dfn{macro} is usually a simple construct which is identified by
Fred Drake63568aa2000-10-19 05:36:10 +0000252 name and can take some number of parameters. In normal \LaTeX{}
253 usage, one of these can be optional. The markup is introduced
254 using the backslash character (\character{\e}), and the name is
255 given by alphabetic characters (no digits, hyphens, or
256 underscores). Required parameters should be marked as a group,
257 and optional parameters should be marked using the alternate
258 syntax for a group.
259
260 For example, a macro named ``foo'' which takes a single parameter
261 would appear like this:
262
263\begin{verbatim}
264\name{parameter}
265\end{verbatim}
266
267 A macro which takes an optional parameter would be typed like this
268 when the optional paramter is given:
269
270\begin{verbatim}
271\name[optional]
272\end{verbatim}
273
274 If both optional and required parameters are to be required, it
275 looks like this:
276
277\begin{verbatim}
278\name[optional]{required}
279\end{verbatim}
280
281 A macro name may be followed by a space or newline; a space
282 between the macro name and any parameters will be consumed, but
283 this usage is not practiced in the Python documentation. Such a
Fred Drake4c6f17a2001-04-18 05:12:47 +0000284 space is still consumed if there are no parameters to the macro,
Fred Drake63568aa2000-10-19 05:36:10 +0000285 in which case inserting an empty group (\code{\{\}}) or explicit
286 word space (\samp{\e\ }) immediately after the macro name helps to
287 avoid running the expansion of the macro into the following text.
288 Macros which take no parameters but which should not be followed
289 by a word space do not need special treatment if the following
290 character in the document source if not a name character (such as
Fred Drake4c6f17a2001-04-18 05:12:47 +0000291 punctuation).
Fred Drake63568aa2000-10-19 05:36:10 +0000292
293 Each line of this example shows an appropriate way to write text
294 which includes a macro which takes no parameters:
295
296\begin{verbatim}
297This \UNIX{} is followed by a space.
298This \UNIX\ is also followed by a space.
299\UNIX, followed by a comma, needs no additional markup.
300\end{verbatim}
301
Fred Draked097d482000-10-20 20:51:31 +0000302 An \dfn{environment} is a larger construct than a macro, and can
Fred Drake4c6f17a2001-04-18 05:12:47 +0000303 be used for things with more content than would conveniently fit
Fred Draked097d482000-10-20 20:51:31 +0000304 in a macro parameter. They are primarily used when formatting
305 parameters need to be changed before and after a large chunk of
306 content, but the content itself needs to be highly flexible. Code
307 samples are presented using an environment, and descriptions of
Fred Drake4c6f17a2001-04-18 05:12:47 +0000308 functions, methods, and classes are also marked using environments.
Fred Draked097d482000-10-20 20:51:31 +0000309
310 Since the content of an environment is free-form and can consist
311 of several paragraphs, they are actually marked using a pair of
312 macros: \macro{begin} and \macro{end}. These macros both take the
313 name of the environment as a parameter. An example is the
314 environment used to mark the abstract of a document:
315
316\begin{verbatim}
317\begin{abstract}
318 This is the text of the abstract. It concisely explains what
319 information is found in the document.
320
321 It can consist of multiple paragraphs.
322\end{abstract}
323\end{verbatim}
324
325 An environment can also have required and optional parameters of
326 its own. These follow the parameter of the \macro{begin} macro.
327 This example shows an environment which takes a single required
328 parameter:
329
330\begin{verbatim}
Fred Drake2bbc6972001-03-28 16:51:20 +0000331\begin{datadesc}{controlnames}
Fred Draked097d482000-10-20 20:51:31 +0000332 A 33-element string array that contains the \ASCII{} mnemonics for
333 the thirty-two \ASCII{} control characters from 0 (NUL) to 0x1f
334 (US), in order, plus the mnemonic \samp{SP} for the space character.
335\end{datadesc}
336\end{verbatim}
Fred Drake63568aa2000-10-19 05:36:10 +0000337
Fred Drake4c6f17a2001-04-18 05:12:47 +0000338 There are a number of less-used marks in \LaTeX{} which are used
339 to enter non-\ASCII{} characters, especially those used in
340 European names. Given that these are often used adjacent to other
Fred Draked097d482000-10-20 20:51:31 +0000341 characters, the markup required to produce the proper character
Fred Drake4c6f17a2001-04-18 05:12:47 +0000342 may need to be followed by a space or an empty group, or the
Fred Draked097d482000-10-20 20:51:31 +0000343 markup can be enclosed in a group. Some which are found in Python
344 documentation are:
Fred Drake63568aa2000-10-19 05:36:10 +0000345
Fred Draked097d482000-10-20 20:51:31 +0000346\begin{tableii}{c|l}{textrm}{Character}{Markup}
347 \lineii{\c c}{\code{\e c c}}
348 \lineii{\"o}{\code{\e"o}}
349 \lineii{\o}{\code{\e o}}
350\end{tableii}
Fred Drake63568aa2000-10-19 05:36:10 +0000351
352
353 \subsection{Hierarchical Structure}
354
Fred Draked097d482000-10-20 20:51:31 +0000355 \LaTeX{} expects documents to be arranged in a conventional,
356 hierarchical way, with chapters, sections, sub-sections,
357 appendixes, and the like. These are marked using macros rather
358 than environments, probably because the end of a section can be
359 safely inferred when a section of equal or higher level starts.
360
361 There are six ``levels'' of sectioning in the document classes
Fred Drake4c6f17a2001-04-18 05:12:47 +0000362 used for Python documentation, and the deepest two
363 levels\footnote{The deepest levels have the highest numbers in the
364 table.} are not used. The levels are:
Fred Draked097d482000-10-20 20:51:31 +0000365
366 \begin{tableiii}{c|l|c}{textrm}{Level}{Macro Name}{Notes}
367 \lineiii{1}{\macro{chapter}}{(1)}
368 \lineiii{2}{\macro{section}}{}
369 \lineiii{3}{\macro{subsection}}{}
Fred Drakeb7a52c92000-11-27 20:10:18 +0000370 \lineiii{4}{\macro{subsubsection}}{}
Fred Draked097d482000-10-20 20:51:31 +0000371 \lineiii{5}{\macro{paragraph}}{(2)}
372 \lineiii{6}{\macro{subparagraph}}{}
373 \end{tableiii}
374
375 \noindent
376 Notes:
377
378 \begin{description}
379 \item[(1)]
380 Only used for the \code{manual} documents, as described in
381 section \ref{classes}, ``Document Classes.''
382 \item[(2)]
383 Not the same as a paragraph of text; nobody seems to use this.
384 \end{description}
Fred Drake2c4e0091999-03-29 14:55:55 +0000385
386
Fred Drakeadade921999-04-22 13:05:27 +0000387\section{Document Classes \label{classes}}
Fred Drakeacffaee1999-03-16 16:09:13 +0000388
389 Two \LaTeX{} document classes are defined specifically for use with
390 the Python documentation. The \code{manual} class is for large
391 documents which are sectioned into chapters, and the \code{howto}
392 class is for smaller documents.
393
394 The \code{manual} documents are larger and are used for most of the
395 standard documents. This document class is based on the standard
396 \LaTeX{} \code{report} class and is formatted very much like a long
Fred Drake698d5201999-11-10 15:54:57 +0000397 technical report. The \citetitle[../ref/ref.html]{Python Reference
398 Manual} is a good example of a \code{manual} document, and the
399 \citetitle[../lib/lib.html]{Python Library Reference} is a large
400 example.
Fred Drakeacffaee1999-03-16 16:09:13 +0000401
402 The \code{howto} documents are shorter, and don't have the large
403 structure of the \code{manual} documents. This class is based on
404 the standard \LaTeX{} \code{article} class and is formatted somewhat
405 like the Linux Documentation Project's ``HOWTO'' series as done
406 originally using the LinuxDoc software. The original intent for the
407 document class was that it serve a similar role as the LDP's HOWTO
408 series, but the applicability of the class turns out to be somewhat
Fred Drake02997492000-09-21 05:26:43 +0000409 broader. This class is used for ``how-to'' documents (this
Fred Drakeacffaee1999-03-16 16:09:13 +0000410 document is an example) and for shorter reference manuals for small,
411 fairly cohesive module libraries. Examples of the later use include
Fred Drake698d5201999-11-10 15:54:57 +0000412 the standard \citetitle[../mac/mac.html]{Macintosh Library Modules}
413 and
Fred Drake6a547c72000-09-15 22:11:24 +0000414\citetitle[http://starship.python.net/crew/fdrake/manuals/krb5py/krb5py.html]{Using
Fred Drakeacffaee1999-03-16 16:09:13 +0000415 Kerberos from Python}, which contains reference material for an
416 extension package. These documents are roughly equivalent to a
417 single chapter from a larger work.
418
419
Fred Drake7a737df1999-04-23 14:41:44 +0000420\section{Special Markup Constructs}
Fred Drakeacffaee1999-03-16 16:09:13 +0000421
Fred Drake2c4e0091999-03-29 14:55:55 +0000422 The Python document classes define a lot of new environments and
423 macros. This section contains the reference material for these
424 facilities.
425
Fred Drakeaf2b7142000-09-14 20:11:05 +0000426 \subsection{Markup for the Preamble \label{preamble-info}}
427
428 \begin{macrodesc}{release}{\p{ver}}
429 Set the version number for the software described in the
430 document.
431 \end{macrodesc}
432
433 \begin{macrodesc}{setshortversion}{\p{sver}}
434 Specify the ``short'' version number of the documented software
435 to be \var{sver}.
436 \end{macrodesc}
437
Fred Drakee15956b2000-04-03 04:51:13 +0000438 \subsection{Meta-information Markup \label{meta-info}}
439
440 \begin{macrodesc}{sectionauthor}{\p{author}\p{email}}
441 Identifies the author of the current section. \var{author}
442 should be the author's name such that it can be used for
443 presentation (though it isn't), and \var{email} should be the
444 author's email address. The domain name portion of
445 the address should be lower case.
446
447 No presentation is generated from this markup, but it is used to
448 help keep track of contributions.
449 \end{macrodesc}
450
Fred Drakeacffaee1999-03-16 16:09:13 +0000451 \subsection{Information Units \label{info-units}}
452
Fred Drake2f4bebd1999-04-28 16:43:11 +0000453 XXX Explain terminology, or come up with something more ``lay.''
Fred Drakeacffaee1999-03-16 16:09:13 +0000454
Fred Drakeadade921999-04-22 13:05:27 +0000455 There are a number of environments used to describe specific
456 features provided by modules. Each environment requires
457 parameters needed to provide basic information about what is being
458 described, and the environment content should be the description.
459 Most of these environments make entries in the general index (if
460 one is being produced for the document); if no index entry is
461 desired, non-indexing variants are available for many of these
462 environments. The environments have names of the form
463 \code{\var{feature}desc}, and the non-indexing variants are named
464 \code{\var{feature}descni}. The available variants are explicitly
465 included in the list below.
466
467 For each of these environments, the first parameter, \var{name},
468 provides the name by which the feature is accessed.
469
470 Environments which describe features of objects within a module,
471 such as object methods or data attributes, allow an optional
472 \var{type name} parameter. When the feature is an attribute of
473 class instances, \var{type name} only needs to be given if the
474 class was not the most recently described class in the module; the
475 \var{name} value from the most recent \env{classdesc} is implied.
476 For features of built-in or extension types, the \var{type name}
Fred Drake7a737df1999-04-23 14:41:44 +0000477 value should always be provided. Another special case includes
478 methods and members of general ``protocols,'' such as the
479 formatter and writer protocols described for the
480 \module{formatter} module: these may be documented without any
481 specific implementation classes, and will always require the
482 \var{type name} parameter to be provided.
Fred Drakeadade921999-04-22 13:05:27 +0000483
Fred Drake7be440d2000-09-16 21:23:25 +0000484 \begin{envdesc}{cfuncdesc}{\p{type}\p{name}\p{args}}
485 Environment used to described a C function. The \var{type}
486 should be specified as a \keyword{typedef} name, \code{struct
487 \var{tag}}, or the name of a primitive type. If it is a pointer
Fred Drake02997492000-09-21 05:26:43 +0000488 type, the trailing asterisk should not be preceded by a space.
Fred Drake7be440d2000-09-16 21:23:25 +0000489 \var{name} should be the name of the function (or function-like
490 pre-processor macro), and \var{args} should give the types and
491 names of the parameters. The names need to be given so they may
492 be used in the description.
493 \end{envdesc}
494
495 \begin{envdesc}{ctypedesc}{\op{tag}\p{name}}
496 Environment used to described a C type. The \var{name}
497 parameter should be the \keyword{typedef} name. If the type is
498 defined as a \keyword{struct} without a \keyword{typedef},
499 \var{name} should have the form \code{struct \var{tag}}.
500 \var{name} will be added to the index unless \var{tag} is
501 provided, in which case \var{tag} will be used instead.
502 \var{tag} should not be used for a \keyword{typedef} name.
503 \end{envdesc}
504
505 \begin{envdesc}{cvardesc}{\p{type}\p{name}}
506 Description of a global C variable. \var{type} should be the
507 \keyword{typedef} name, \code{struct \var{tag}}, or the name of
508 a primitive type. If variable has a pointer type, the trailing
Fred Drake02997492000-09-21 05:26:43 +0000509 asterisk should \emph{not} be preceded by a space.
Fred Drake7be440d2000-09-16 21:23:25 +0000510 \end{envdesc}
511
Fred Drakeadade921999-04-22 13:05:27 +0000512 \begin{envdesc}{datadesc}{\p{name}}
513 This environment is used to document global data in a module,
514 including both variables and values used as ``defined
515 constants.'' Class and object attributes are not documented
516 using this environment.
Fred Drakeacffaee1999-03-16 16:09:13 +0000517 \end{envdesc}
Fred Drake7a737df1999-04-23 14:41:44 +0000518 \begin{envdesc}{datadescni}{\p{name}}
Fred Drakeacffaee1999-03-16 16:09:13 +0000519 Like \env{datadesc}, but without creating any index entries.
520 \end{envdesc}
521
Fred Drake9f2376d2001-05-11 01:01:12 +0000522 \begin{envdesc}{excclassdesc}{\p{name}\p{constructor parameters}}
523 Descibe an exception defined by a class. \var{constructor
524 parameters} should not include the \var{self} parameter or
525 the parentheses used in the call syntax. To describe an
526 exception class without describing the parameters to its
527 constructor, use the \env{excdesc} environment.
528 \end{envdesc}
529
Fred Drakeadade921999-04-22 13:05:27 +0000530 \begin{envdesc}{excdesc}{\p{name}}
Fred Drakeacffaee1999-03-16 16:09:13 +0000531 Describe an exception. This may be either a string exception or
Fred Drake9f2376d2001-05-11 01:01:12 +0000532 a class exception. In the case of class exceptions, the
533 constructor parameters are not described; use \env{excclassdesc}
534 to describe an exception class and its constructor.
Fred Drakeacffaee1999-03-16 16:09:13 +0000535 \end{envdesc}
536
Fred Drakeadade921999-04-22 13:05:27 +0000537 \begin{envdesc}{funcdesc}{\p{name}\p{parameters}}
538 Describe a module-level function. \var{parameters} should
539 not include the parentheses used in the call syntax. Object
540 methods are not documented using this environment. Bound object
541 methods placed in the module namespace as part of the public
542 interface of the module are documented using this, as they are
543 equivalent to normal functions for most purposes.
544
545 The description should include information about the parameters
546 required and how they are used (especially whether mutable
547 objects passed as parameters are modified), side effects, and
548 possible exceptions. A small example may be provided.
Fred Drakeacffaee1999-03-16 16:09:13 +0000549 \end{envdesc}
Fred Drakeadade921999-04-22 13:05:27 +0000550 \begin{envdesc}{funcdescni}{\p{name}\p{parameters}}
Fred Drakeacffaee1999-03-16 16:09:13 +0000551 Like \env{funcdesc}, but without creating any index entries.
552 \end{envdesc}
553
Fred Drakeadade921999-04-22 13:05:27 +0000554 \begin{envdesc}{classdesc}{\p{name}\p{constructor parameters}}
555 Describe a class and its constructor. \var{constructor
556 parameters} should not include the \var{self} parameter or
557 the parentheses used in the call syntax.
Fred Drakeacffaee1999-03-16 16:09:13 +0000558 \end{envdesc}
559
Fred Drake9f2376d2001-05-11 01:01:12 +0000560 \begin{envdesc}{classdesc*}{\p{name}}
561 Describe a class without describing the constructor. This can
562 be used to describe classes that are merely containers for
563 attributes or which should never be instantiated or subclassed
564 by user code.
565 \end{envdesc}
566
Fred Drakeadade921999-04-22 13:05:27 +0000567 \begin{envdesc}{memberdesc}{\op{type name}\p{name}}
568 Describe an object data attribute. The description should
569 include information about the type of the data to be expected
570 and whether it may be changed directly.
Fred Drakeacffaee1999-03-16 16:09:13 +0000571 \end{envdesc}
Fred Drakeadade921999-04-22 13:05:27 +0000572 \begin{envdesc}{memberdescni}{\op{type name}\p{name}}
Fred Drakeacffaee1999-03-16 16:09:13 +0000573 Like \env{memberdesc}, but without creating any index entries.
574 \end{envdesc}
575
Fred Drakeadade921999-04-22 13:05:27 +0000576 \begin{envdesc}{methoddesc}{\op{type name}\p{name}\p{parameters}}
577 Describe an object method. \var{parameters} should not include
578 the \var{self} parameter or the parentheses used in the call
579 syntax. The description should include similar information to
580 that described for \env{funcdesc}.
Fred Drakeacffaee1999-03-16 16:09:13 +0000581 \end{envdesc}
Fred Drakeadade921999-04-22 13:05:27 +0000582 \begin{envdesc}{methoddescni}{\op{type name}\p{name}\p{parameters}}
Fred Drakeacffaee1999-03-16 16:09:13 +0000583 Like \env{methoddesc}, but without creating any index entries.
584 \end{envdesc}
585
586
Fred Drake5eb992b1999-06-11 14:25:45 +0000587 \subsection{Showing Code Examples}
588
589 Examples of Python source code or interactive sessions are
590 represented as \env{verbatim} environments. This environment
591 is a standard part of \LaTeX{}. It is important to only use
592 spaces for indentation in code examples since \TeX{} drops tabs
593 instead of converting them to spaces.
594
595 Representing an interactive session requires including the prompts
596 and output along with the Python code. No special markup is
Fred Drake63568aa2000-10-19 05:36:10 +0000597 required for interactive sessions. After the last line of input
598 or output presented, there should not be an ``unused'' primary
599 prompt; this is an example of what \emph{not} to do:
600
601\begin{verbatim}
602>>> 1 + 1
6032
604>>>
605\end{verbatim}
Fred Drake5eb992b1999-06-11 14:25:45 +0000606
607 Within the \env{verbatim} environment, characters special to
608 \LaTeX{} do not need to be specially marked in any way. The entire
609 example will be presented in a monospaced font; no attempt at
610 ``pretty-printing'' is made, as the environment must work for
Fred Drake63568aa2000-10-19 05:36:10 +0000611 non-Python code and non-code displays. There should be no blank
612 lines at the top or bottom of any \env{verbatim} display.
Fred Drake5eb992b1999-06-11 14:25:45 +0000613
Fred Drake66eed242001-06-18 14:59:58 +0000614 Longer displays of verbatim text may be included by storing the
615 example text in an external file containing only plain text. The
616 file may be included using the standard \macro{verbatiminput}
617 macro; this macro takes a single argument naming the file
618 containing the text. For example, to include the Python source
619 file \file{example.py}, use:
620
621\begin{verbatim}
622\verbatiminput{example.py}
623\end{verbatim}
624
625 Use of \macro{verbatiminput} allows easier use of special editing
626 modes for the included file. The file should be placed in the
627 same directory as the \LaTeX{} files for the document.
628
Fred Drake5eb992b1999-06-11 14:25:45 +0000629 The Python Documentation Special Interest Group has discussed a
630 number of approaches to creating pretty-printed code displays and
631 interactive sessions; see the Doc-SIG area on the Python Web site
632 for more information on this topic.
633
634
Fred Drakeacffaee1999-03-16 16:09:13 +0000635 \subsection{Inline Markup}
636
Fred Drake87f768e1999-05-17 15:22:45 +0000637 The macros described in this section are used to mark just about
638 anything interesting in the document text. They may be used in
639 headings (though anything involving hyperlinks should be avoided
640 there) as well as in the body text.
Fred Drake2f4bebd1999-04-28 16:43:11 +0000641
642 \begin{macrodesc}{bfcode}{\p{text}}
643 Like \macro{code}, but also makes the font bold-face.
644 \end{macrodesc}
645
646 \begin{macrodesc}{cdata}{\p{name}}
647 The name of a C-language variable.
648 \end{macrodesc}
649
650 \begin{macrodesc}{cfunction}{\p{name}}
651 The name of a C-language function. \var{name} should include the
652 function name and the trailing parentheses.
653 \end{macrodesc}
654
655 \begin{macrodesc}{character}{\p{char}}
656 A character when discussing the character rather than a one-byte
657 string value. The character will be typeset as with \macro{samp}.
658 \end{macrodesc}
659
Fred Drake29a710f1999-11-10 22:51:18 +0000660 \begin{macrodesc}{citetitle}{\op{url}\p{title}}
661 A title for a referenced publication. If \var{url} is specified,
662 the title will be made into a hyperlink when formatted as HTML.
663 \end{macrodesc}
664
Fred Drake2f4bebd1999-04-28 16:43:11 +0000665 \begin{macrodesc}{class}{\p{name}}
666 A class name; a dotted name may be used.
667 \end{macrodesc}
668
669 \begin{macrodesc}{code}{\p{text}}
670 A short code fragment or literal constant value. Typically, it
671 should not include any spaces since no quotation marks are
672 added.
673 \end{macrodesc}
674
675 \begin{macrodesc}{constant}{\p{name}}
676 The name of a ``defined'' constant. This may be a C-language
677 \code{\#define} or a Python variable that is not intended to be
678 changed.
679 \end{macrodesc}
680
681 \begin{macrodesc}{ctype}{\p{name}}
682 The name of a C \keyword{typedef} or structure. For structures
683 defined without a \keyword{typedef}, use \code{\e ctype\{struct
684 struct_tag\}} to make it clear that the \keyword{struct} is
685 required.
686 \end{macrodesc}
687
688 \begin{macrodesc}{deprecated}{\p{version}\p{what to do}}
689 Declare whatever is being described as being deprecated starting
690 with release \var{version}. The text given as \var{what to do}
691 should recommend something to use instead.
692 \end{macrodesc}
693
694 \begin{macrodesc}{dfn}{\p{term}}
695 Mark the defining instance of \var{term} in the text. (No index
696 entries are generated.)
697 \end{macrodesc}
698
Fred Draked1fb7791999-05-17 16:33:54 +0000699 \begin{macrodesc}{e}{}
700 Produces a backslash. This is convenient in \macro{code} and
Fred Drake31edf4d2000-09-07 20:06:07 +0000701 similar macros, and is only defined there. To create a
Fred Drake2b853412000-04-11 19:08:30 +0000702 backslash in ordinary text (such as the contents of the
703 \macro{file} macro), use the standard \macro{textbackslash} macro.
Fred Draked1fb7791999-05-17 16:33:54 +0000704 \end{macrodesc}
705
Fred Drake2f4bebd1999-04-28 16:43:11 +0000706 \begin{macrodesc}{email}{\p{address}}
707 An email address. Note that this is \emph{not} hyperlinked in
Fred Drakee15956b2000-04-03 04:51:13 +0000708 any of the possible output formats. The domain name portion of
709 the address should be lower case.
Fred Drake2f4bebd1999-04-28 16:43:11 +0000710 \end{macrodesc}
711
712 \begin{macrodesc}{emph}{\p{text}}
713 Emphasized text; this will be presented in an italic font.
714 \end{macrodesc}
715
716 \begin{macrodesc}{envvar}{\p{name}}
717 An environment variable. Index entries are generated.
718 \end{macrodesc}
719
720 \begin{macrodesc}{exception}{\p{name}}
721 The name of an exception. A dotted name may be used.
722 \end{macrodesc}
723
724 \begin{macrodesc}{file}{\p{file or dir}}
725 The name of a file or directory. In the PDF and PostScript
726 outputs, single quotes and a font change are used to indicate
727 the file name, but no quotes are used in the HTML output.
Fred Drake31edf4d2000-09-07 20:06:07 +0000728 \strong{Warning:} The \macro{file} macro cannot be used in the
729 content of a section title due to processing limitations.
Fred Drake2f4bebd1999-04-28 16:43:11 +0000730 \end{macrodesc}
731
732 \begin{macrodesc}{filenq}{\p{file or dir}}
733 Like \macro{file}, but single quotes are never used. This can
734 be used in conjunction with tables if a column will only contain
735 file or directory names.
Fred Drake31edf4d2000-09-07 20:06:07 +0000736 \strong{Warning:} The \macro{filenq} macro cannot be used in the
737 content of a section title due to processing limitations.
Fred Drake2f4bebd1999-04-28 16:43:11 +0000738 \end{macrodesc}
739
740 \begin{macrodesc}{function}{\p{name}}
741 The name of a Python function; dotted names may be used.
742 \end{macrodesc}
743
744 \begin{macrodesc}{kbd}{\p{key sequence}}
745 Mark a sequence of keystrokes. What form \var{key sequence}
746 takes may depend on platform- or application-specific
747 conventions. For example, an \program{xemacs} key sequence
748 may be marked like \code{\e kbd\{C-x C-f\}}.
749 \end{macrodesc}
750
751 \begin{macrodesc}{keyword}{\p{name}}
752 The name of a keyword in a programming language.
753 \end{macrodesc}
754
755 \begin{macrodesc}{makevar}{\p{name}}
756 The name of a \program{make} variable.
757 \end{macrodesc}
758
759 \begin{macrodesc}{manpage}{\p{name}\p{section}}
760 A reference to a \UNIX{} manual page.
761 \end{macrodesc}
762
763 \begin{macrodesc}{member}{\p{name}}
764 The name of a data attribute of an object.
765 \end{macrodesc}
766
767 \begin{macrodesc}{method}{\p{name}}
768 The name of a method of an object. \var{name} should include the
769 method name and the trailing parentheses. A dotted name may be
770 used.
771 \end{macrodesc}
772
773 \begin{macrodesc}{mimetype}{\p{name}}
774 The name of a MIME type.
775 \end{macrodesc}
776
777 \begin{macrodesc}{module}{\p{name}}
Fred Drake2b853412000-04-11 19:08:30 +0000778 The name of a module; a dotted name may be used. This should
779 also be used for package names.
Fred Drake2f4bebd1999-04-28 16:43:11 +0000780 \end{macrodesc}
781
782 \begin{macrodesc}{newsgroup}{\p{name}}
783 The name of a USENET newsgroup.
784 \end{macrodesc}
785
Fred Drake2f4bebd1999-04-28 16:43:11 +0000786 \begin{macrodesc}{program}{\p{name}}
787 The name of an executable program. This may differ from the
788 file name for the executable for some platforms. In particular,
789 the \file{.exe} (or other) extension should be omitted for DOS
790 and Windows programs.
791 \end{macrodesc}
792
Fred Drake29a710f1999-11-10 22:51:18 +0000793 \begin{macrodesc}{programopt}{\p{option}}
Fred Drakece444982000-04-11 18:52:52 +0000794 A command-line option to an executable program. Use this only
795 for ``shot'' options, and include the leading hyphen.
796 \end{macrodesc}
797
798 \begin{macrodesc}{longprogramopt}{\p{option}}
799 A long command-line option to an executable program. This
800 should only be used for long option names which will be prefixed
801 by two hyphens; the hyphens should not be provided as part of
802 \var{option}.
Fred Drake29a710f1999-11-10 22:51:18 +0000803 \end{macrodesc}
804
Fred Drake08c5d0c2000-09-11 05:22:30 +0000805 \begin{macrodesc}{pep}{\p{number}}
806 A reference to a Python Enhancement Proposal. This generates
807 appropriate index entries. The text \samp{PEP \var{number}} is
808 generated; in the HTML output, this text is a hyperlink to an
809 online copy of the specified PEP.
810 \end{macrodesc}
811
Fred Drake2f4bebd1999-04-28 16:43:11 +0000812 \begin{macrodesc}{refmodule}{\op{key}\p{name}}
813 Like \macro{module}, but create a hyperlink to the documentation
814 for the named module. Note that the corresponding
815 \macro{declaremodule} must be in the same document. If the
816 \macro{declaremodule} defines a module key different from the
817 module name, it must also be provided as \var{key} to the
818 \macro{refmodule} macro.
819 \end{macrodesc}
820
821 \begin{macrodesc}{regexp}{\p{string}}
822 Mark a regular expression.
823 \end{macrodesc}
824
825 \begin{macrodesc}{rfc}{\p{number}}
826 A reference to an Internet Request for Comments. This generates
827 appropriate index entries. The text \samp{RFC \var{number}} is
828 generated; in the HTML output, this text is a hyperlink to an
829 online copy of the specified RFC.
830 \end{macrodesc}
831
832 \begin{macrodesc}{samp}{\p{text}}
833 A short code sample, but possibly longer than would be given
834 using \macro{code}. Since quotation marks are added, spaces are
835 acceptable.
836 \end{macrodesc}
837
Fred Drakeaf2b7142000-09-14 20:11:05 +0000838 \begin{macrodesc}{shortversion}{}
839 The ``short'' version number of the documented software, as
840 specified using the \macro{setshortversion} macro in the
841 preamble. For Python, the short version number for a release is
842 the first three characters of the \code{sys.version} value. For
843 example, versions 2.0b1 and 2.0.1 both have a short version of
844 2.0. This may not apply for all packages; if
845 \macro{setshortversion} is not used, this produces an empty
846 expansion. See also the \macro{version} macro.
847 \end{macrodesc}
848
Fred Drake2f4bebd1999-04-28 16:43:11 +0000849 \begin{macrodesc}{strong}{\p{text}}
850 Strongly emphasized text; this will be presented using a bold
851 font.
852 \end{macrodesc}
853
Fred Draked1fb7791999-05-17 16:33:54 +0000854 \begin{macrodesc}{url}{\p{url}}
855 A URL (or URN). The URL will be presented as text. In the HTML
856 and PDF formatted versions, the URL will also be a hyperlink.
857 This can be used when referring to external resources. Note
858 that many characters are special to \LaTeX{} and this macro
859 does not always do the right thing. In particular, the tilde
860 character (\character{\~}) is mis-handled; encoding it as a
861 hex-sequence does work, use \samp{\%7e} in place of the tilde
862 character.
863 \end{macrodesc}
864
Fred Drake2f4bebd1999-04-28 16:43:11 +0000865 \begin{macrodesc}{var}{\p{name}}
866 The name of a variable or formal parameter in running text.
867 \end{macrodesc}
868
869 \begin{macrodesc}{version}{}
Fred Drakeaf2b7142000-09-14 20:11:05 +0000870 The version number of the described software, as specified using
871 \macro{release} in the preamble. See also the
872 \macro{shortversion} macro.
Fred Drake2f4bebd1999-04-28 16:43:11 +0000873 \end{macrodesc}
Fred Drakeacffaee1999-03-16 16:09:13 +0000874
Fred Drake3151f442001-04-18 05:19:06 +0000875 \begin{macrodesc}{versionadded}{\op{explanation}\p{version}}
Fred Drakec26cc912000-05-02 17:43:44 +0000876 The version of Python which added the described feature to the
Fred Drake3151f442001-04-18 05:19:06 +0000877 library or C API. \var{explanation} should be a \emph{brief}
878 explanation of the change consisting of a capitalized sentence
879 fragment; a period will be appended by the formatting process.
880 This is typically added to the end of the first paragraph of the
881 description before any availability notes. The location should
882 be selected so the explanation makes sense and may vary as
883 needed.
Fred Drakec26cc912000-05-02 17:43:44 +0000884 \end{macrodesc}
885
886 \begin{macrodesc}{versionchanged}{\op{explanation}\p{version}}
887 The version of Python in which the named feature was changed in
888 some way (new parameters, changed side effects, etc.).
889 \var{explanation} should be a \emph{brief} explanation of the
Fred Drake63568aa2000-10-19 05:36:10 +0000890 change consisting of a capitalized sentence fragment; a
Fred Drakec26cc912000-05-02 17:43:44 +0000891 period will be appended by the formatting process.
892 This is typically added to the end of the first paragraph of the
893 description before any availability notes and after
894 \macro{versionadded}. The location should be selected so the
895 explanation makes sense and may vary as needed.
896 \end{macrodesc}
897
Fred Drakeacffaee1999-03-16 16:09:13 +0000898
899 \subsection{Module-specific Markup}
900
901 The markup described in this section is used to provide information
902 about a module being documented. A typical use of this markup
903 appears at the top of the section used to document a module. A
904 typical example might look like this:
905
906\begin{verbatim}
907\section{\module{spam} ---
908 Access to the SPAM facility}
909
910\declaremodule{extension}{spam}
Fred Drake2c4e0091999-03-29 14:55:55 +0000911 \platform{Unix}
Fred Drakeadade921999-04-22 13:05:27 +0000912\modulesynopsis{Access to the SPAM facility of \UNIX{}.}
Fred Drake2c4e0091999-03-29 14:55:55 +0000913\moduleauthor{Jane Doe}{jane.doe@frobnitz.org}
Fred Drakeacffaee1999-03-16 16:09:13 +0000914\end{verbatim}
915
Fred Drake7932ed02000-08-11 17:37:33 +0000916 Python packages\index{packages} --- collections of modules that can
917 be described as a unit --- are documented using the same markup as
918 modules. The name for a module in a package should be typed in
919 ``fully qualified'' form (i.e., it should include the package name).
920 For example, a module ``foo'' in package ``bar'' should be marked as
921 \samp{\e module\{bar.foo\}}, and the beginning of the reference
922 section would appear as:
923
924\begin{verbatim}
925\section{\module{bar.foo} ---
926 Module from the \module{bar} package}
927
928\declaremodule{extension}{bar.foo}
929\modulesynopsis{Nifty module from the \module{bar} package.}
930\moduleauthor{Jane Doe}{jane.doe@frobnitz.org}
931\end{verbatim}
932
933 Note that the name of a package is also marked using
934 \macro{module}.
935
Fred Drakeadade921999-04-22 13:05:27 +0000936 \begin{macrodesc}{declaremodule}{\op{key}\p{type}\p{name}}
Fred Drake87f768e1999-05-17 15:22:45 +0000937 Requires two parameters: module type (\samp{standard},
938 \samp{builtin}, \samp{extension}, or \samp{}), and the module
939 name. An optional parameter should be given as the basis for the
940 module's ``key'' used for linking to or referencing the section.
941 The ``key'' should only be given if the module's name contains any
942 underscores, and should be the name with the underscores stripped.
943 Note that the \var{type} parameter must be one of the values
944 listed above or an error will be printed. For modules which are
945 contained in packages, the fully-qualified name should be given as
946 \var{name} parameter. This should be the first thing after the
947 \macro{section} used to introduce the module.
Fred Drakeacffaee1999-03-16 16:09:13 +0000948 \end{macrodesc}
949
Fred Drakeadade921999-04-22 13:05:27 +0000950 \begin{macrodesc}{platform}{\p{specifier}}
Fred Drakeacffaee1999-03-16 16:09:13 +0000951 Specifies the portability of the module. \var{specifier} is a
952 comma-separated list of keys that specify what platforms the
953 module is available on. The keys are short identifiers;
954 examples that are in use include \samp{IRIX}, \samp{Mac},
955 \samp{Windows}, and \samp{Unix}. It is important to use a key
Fred Drake7a737df1999-04-23 14:41:44 +0000956 which has already been used when applicable. This is used to
957 provide annotations in the Module Index and the HTML and GNU info
958 output.
Fred Drakeacffaee1999-03-16 16:09:13 +0000959 \end{macrodesc}
960
Fred Drakeadade921999-04-22 13:05:27 +0000961 \begin{macrodesc}{modulesynopsis}{\p{text}}
Fred Drakeacffaee1999-03-16 16:09:13 +0000962 The \var{text} is a short, ``one line'' description of the
963 module that can be used as part of the chapter introduction.
Fred Drakeadade921999-04-22 13:05:27 +0000964 This is must be placed after \macro{declaremodule}.
Fred Drakeacffaee1999-03-16 16:09:13 +0000965 The synopsis is used in building the contents of the table
966 inserted as the \macro{localmoduletable}. No text is
967 produced at the point of the markup.
968 \end{macrodesc}
969
Fred Drakeadade921999-04-22 13:05:27 +0000970 \begin{macrodesc}{moduleauthor}{\p{name}\p{email}}
Fred Drakeacffaee1999-03-16 16:09:13 +0000971 This macro is used to encode information about who authored a
972 module. This is currently not used to generate output, but can be
973 used to help determine the origin of the module.
974 \end{macrodesc}
975
976
977 \subsection{Library-level Markup}
978
979 This markup is used when describing a selection of modules. For
Fred Drake698d5201999-11-10 15:54:57 +0000980 example, the \citetitle[../mac/mac.html]{Macintosh Library
981 Modules} document uses this to help provide an overview of the
982 modules in the collection, and many chapters in the
983 \citetitle[../lib/lib.html]{Python Library Reference} use it for
Fred Drakeacffaee1999-03-16 16:09:13 +0000984 the same purpose.
985
986 \begin{macrodesc}{localmoduletable}{}
Fred Drake2c4e0091999-03-29 14:55:55 +0000987 If a \file{.syn} file exists for the current
Fred Drakeacffaee1999-03-16 16:09:13 +0000988 chapter (or for the entire document in \code{howto} documents), a
989 \env{synopsistable} is created with the contents loaded from the
990 \file{.syn} file.
991 \end{macrodesc}
992
993
994 \subsection{Table Markup}
995
996 There are three general-purpose table environments defined which
997 should be used whenever possible. These environments are defined
998 to provide tables of specific widths and some convenience for
999 formatting. These environments are not meant to be general
1000 replacements for the standard \LaTeX{} table environments, but can
1001 be used for an advantage when the documents are processed using
1002 the tools for Python documentation processing. In particular, the
1003 generated HTML looks good! There is also an advantage for the
Fred Drake7a737df1999-04-23 14:41:44 +00001004 eventual conversion of the documentation to SGML (see section
Fred Drake2c4e0091999-03-29 14:55:55 +00001005 \ref{futures}, ``Future Directions'').
Fred Drakeacffaee1999-03-16 16:09:13 +00001006
1007 Each environment is named \env{table\var{cols}}, where \var{cols}
1008 is the number of columns in the table specified in lower-case
1009 Roman numerals. Within each of these environments, an additional
1010 macro, \macro{line\var{cols}}, is defined, where \var{cols}
1011 matches the \var{cols} value of the corresponding table
Fred Drake2c4e0091999-03-29 14:55:55 +00001012 environment. These are supported for \var{cols} values of
1013 \code{ii}, \code{iii}, and \code{iv}. These environments are all
Fred Drakeda72b932000-09-21 15:58:02 +00001014 built on top of the \env{tabular} environment. Variants based on
1015 the \env{longtable} environment are also provided.
Fred Drakeacffaee1999-03-16 16:09:13 +00001016
Fred Drake2b853412000-04-11 19:08:30 +00001017 Note that all tables in the standard Python documentation use
1018 vertical lines between columns, and this must be specified in the
1019 markup for each table. A general border around the outside of the
1020 table is not used, but would be the responsibility of the
Fred Drakeda72b932000-09-21 15:58:02 +00001021 processor; the document markup should not include an exterior
1022 border.
1023
1024 The \env{longtable}-based variants of the table environments are
1025 formatted with extra space before and after, so should only be
1026 used on tables which are long enough that splitting over multiple
1027 pages is reasonable; tables with fewer than twenty rows should
1028 never by marked using the long flavors of the table environments.
1029 The header row is repeated across the top of each part of the
1030 table.
Fred Drake2b853412000-04-11 19:08:30 +00001031
Fred Drakeadade921999-04-22 13:05:27 +00001032 \begin{envdesc}{tableii}{\p{colspec}\p{col1font}\p{heading1}\p{heading2}}
Fred Drakeacffaee1999-03-16 16:09:13 +00001033 Create a two-column table using the \LaTeX{} column specifier
1034 \var{colspec}. The column specifier should indicate vertical
1035 bars between columns as appropriate for the specific table, but
1036 should not specify vertical bars on the outside of the table
1037 (that is considered a stylesheet issue). The \var{col1font}
1038 parameter is used as a stylistic treatment of the first column
1039 of the table: the first column is presented as
1040 \code{\e\var{col1font}\{column1\}}. To avoid treating the first
Fred Drakeadade921999-04-22 13:05:27 +00001041 column specially, \var{col1font} may be \samp{textrm}. The
Fred Drakeacffaee1999-03-16 16:09:13 +00001042 column headings are taken from the values \var{heading1} and
1043 \var{heading2}.
1044 \end{envdesc}
1045
Fred Drakeda72b932000-09-21 15:58:02 +00001046 \begin{envdesc}{longtableii}{\unspecified}
1047 Like \env{tableii}, but produces a table which may be broken
1048 across page boundaries. The parameters are the same as for
1049 \env{tableii}.
1050 \end{envdesc}
1051
Fred Drakeadade921999-04-22 13:05:27 +00001052 \begin{macrodesc}{lineii}{\p{column1}\p{column2}}
Fred Drakeda72b932000-09-21 15:58:02 +00001053 Create a single table row within a \env{tableii} or
1054 \env{longtableii} environment.
Fred Drakeacffaee1999-03-16 16:09:13 +00001055 The text for the first column will be generated by applying the
1056 macro named by the \var{col1font} value when the \env{tableii}
1057 was opened.
1058 \end{macrodesc}
1059
Fred Drakeadade921999-04-22 13:05:27 +00001060 \begin{envdesc}{tableiii}{\p{colspec}\p{col1font}\p{heading1}\p{heading2}\p{heading3}}
Fred Drakeacffaee1999-03-16 16:09:13 +00001061 Like the \env{tableii} environment, but with a third column.
1062 The heading for the third column is given by \var{heading3}.
1063 \end{envdesc}
1064
Fred Drakeda72b932000-09-21 15:58:02 +00001065 \begin{envdesc}{longtableiii}{\unspecified}
1066 Like \env{tableiii}, but produces a table which may be broken
1067 across page boundaries. The parameters are the same as for
1068 \env{tableiii}.
1069 \end{envdesc}
1070
Fred Drakeadade921999-04-22 13:05:27 +00001071 \begin{macrodesc}{lineiii}{\p{column1}\p{column2}\p{column3}}
Fred Drakeacffaee1999-03-16 16:09:13 +00001072 Like the \macro{lineii} macro, but with a third column. The
1073 text for the third column is given by \var{column3}.
1074 \end{macrodesc}
1075
Fred Drakeadade921999-04-22 13:05:27 +00001076 \begin{envdesc}{tableiv}{\p{colspec}\p{col1font}\p{heading1}\p{heading2}\p{heading3}\p{heading4}}
Fred Drakeacffaee1999-03-16 16:09:13 +00001077 Like the \env{tableiii} environment, but with a fourth column.
1078 The heading for the fourth column is given by \var{heading4}.
1079 \end{envdesc}
1080
Fred Drakeda72b932000-09-21 15:58:02 +00001081 \begin{envdesc}{longtableiv}{\unspecified}
1082 Like \env{tableiv}, but produces a table which may be broken
1083 across page boundaries. The parameters are the same as for
1084 \env{tableiv}.
1085 \end{envdesc}
1086
Fred Drakeadade921999-04-22 13:05:27 +00001087 \begin{macrodesc}{lineiv}{\p{column1}\p{column2}\p{column3}\p{column4}}
Fred Drakeacffaee1999-03-16 16:09:13 +00001088 Like the \macro{lineiii} macro, but with a fourth column. The
1089 text for the fourth column is given by \var{column4}.
1090 \end{macrodesc}
1091
1092
1093 An additional table-like environment is \env{synopsistable}. The
1094 table generated by this environment contains two columns, and each
1095 row is defined by an alternate definition of
Fred Drakee15956b2000-04-03 04:51:13 +00001096 \macro{modulesynopsis}. This environment is not normally used by
1097 authors, but is created by the \macro{localmoduletable} macro.
Fred Drakeacffaee1999-03-16 16:09:13 +00001098
1099
1100 \subsection{Reference List Markup \label{references}}
1101
1102 Many sections include a list of references to module documentation
1103 or external documents. These lists are created using the
1104 \env{seealso} environment. This environment defines some
1105 additional macros to support creating reference entries in a
1106 reasonable manner.
1107
Fred Drake5802e482000-07-06 05:24:41 +00001108 The \env{seealso} environment is typically placed in a section
1109 just before any sub-sections. This is done to ensure that
1110 reference links related to the section are not hidden in a
1111 subsection in the hypertext renditions of the documentation.
1112
Fred Drakeacffaee1999-03-16 16:09:13 +00001113 \begin{envdesc}{seealso}{}
1114 This environment creates a ``See also:'' heading and defines the
1115 markup used to describe individual references.
1116 \end{envdesc}
1117
Fred Drake48449982000-09-12 17:52:33 +00001118 For each of the following macros, \var{why} should be one or more
1119 complete sentences, starting with a capital letter (unless it
1120 starts with an identifier, which should not be modified), and
1121 ending with the apropriate punctuation.
Fred Drake5802e482000-07-06 05:24:41 +00001122
Fred Drakeb7cf3782000-09-12 19:58:10 +00001123 These macros are only defined within the content of the
1124 \env{seealso} environment.
1125
Fred Drakeadade921999-04-22 13:05:27 +00001126 \begin{macrodesc}{seemodule}{\op{key}\p{name}\p{why}}
Fred Drakeacffaee1999-03-16 16:09:13 +00001127 Refer to another module. \var{why} should be a brief
1128 explanation of why the reference may be interesting. The module
1129 name is given in \var{name}, with the link key given in
1130 \var{key} if necessary. In the HTML and PDF conversions, the
1131 module name will be a hyperlink to the referred-to module.
Fred Drakeadade921999-04-22 13:05:27 +00001132 \strong{Note:} The module must be documented in the same
1133 document (the corresponding \macro{declaremodule} is required).
Fred Drakeacffaee1999-03-16 16:09:13 +00001134 \end{macrodesc}
1135
Fred Drake08c5d0c2000-09-11 05:22:30 +00001136 \begin{macrodesc}{seepep}{\p{number}\p{title}\p{why}}
1137 Refer to an Python Enhancement Proposal (PEP). \var{number}
1138 should be the official number assigned by the PEP Editor,
1139 \var{title} should be the human-readable title of the PEP as
Fred Drake5802e482000-07-06 05:24:41 +00001140 found in the official copy of the document, and \var{why} should
Fred Drake08c5d0c2000-09-11 05:22:30 +00001141 explain what's interesting about the PEP. This should be used
1142 to refer the reader to PEPs which specify interfaces or language
1143 features relevant to the material in the annotated section of the
1144 documentation.
1145 \end{macrodesc}
1146
1147 \begin{macrodesc}{seerfc}{\p{number}\p{title}\p{why}}
1148 Refer to an IETF Request for Comments (RFC). Otherwise very
1149 similar to \macro{seepep}. This should be used
1150 to refer the reader to PEPs which specify protocols or data
Fred Drake5802e482000-07-06 05:24:41 +00001151 formats relevant to the material in the annotated section of the
1152 documentation.
1153 \end{macrodesc}
1154
Fred Drakeadade921999-04-22 13:05:27 +00001155 \begin{macrodesc}{seetext}{\p{text}}
Fred Drakeacffaee1999-03-16 16:09:13 +00001156 Add arbitrary text \var{text} to the ``See also:'' list. This
1157 can be used to refer to off-line materials or on-line materials
Fred Drake5802e482000-07-06 05:24:41 +00001158 using the \macro{url} macro. This should consist of one or more
1159 complete sentences.
1160 \end{macrodesc}
1161
Fred Drake48449982000-09-12 17:52:33 +00001162 \begin{macrodesc}{seetitle}{\op{url}\p{title}\p{why}}
1163 Add a reference to an external document named \var{title}. If
1164 \var{url} is given, the title is made a hyperlink in the HTML
1165 version of the documentation, and displayed below the title in
1166 the typeset versions of the documentation.
1167 \end{macrodesc}
1168
Fred Drake5802e482000-07-06 05:24:41 +00001169 \begin{macrodesc}{seeurl}{\p{url}\p{why}}
1170 References to specific on-line resources should be given using
1171 the \macro{seeurl} macro. No title is associated with the
1172 reference, but the \var{why} text may include a title marked
1173 using the \macro{citetitle} macro.
Fred Drakeacffaee1999-03-16 16:09:13 +00001174 \end{macrodesc}
1175
1176
1177 \subsection{Index-generating Markup \label{indexing}}
1178
1179 Effective index generation for technical documents can be very
Fred Drakee15956b2000-04-03 04:51:13 +00001180 difficult, especially for someone familiar with the topic but not
Fred Drakeacffaee1999-03-16 16:09:13 +00001181 the creation of indexes. Much of the difficulty arises in the
1182 area of terminology: including the terms an expert would use for a
1183 concept is not sufficient. Coming up with the terms that a novice
Fred Drake2c4e0091999-03-29 14:55:55 +00001184 would look up is fairly difficult for an author who, typically, is
Fred Drakeacffaee1999-03-16 16:09:13 +00001185 an expert in the area she is writing on.
1186
Fred Drake2c4e0091999-03-29 14:55:55 +00001187 The truly difficult aspects of index generation are not areas with
1188 which the documentation tools can help. However, ease
Fred Drakee15956b2000-04-03 04:51:13 +00001189 of producing the index once content decisions are made is within
Fred Drakeacffaee1999-03-16 16:09:13 +00001190 the scope of the tools. Markup is provided which the processing
1191 software is able to use to generate a variety of kinds of index
1192 entry with minimal effort. Additionally, many of the environments
Fred Drake7a737df1999-04-23 14:41:44 +00001193 described in section \ref{info-units}, ``Information Units,'' will
Fred Drakeacffaee1999-03-16 16:09:13 +00001194 generate appropriate entries into the general and module indexes.
1195
1196 The following macro can be used to control the generation of index
Fred Drakeadade921999-04-22 13:05:27 +00001197 data, and should be used in the document preamble:
Fred Drakeacffaee1999-03-16 16:09:13 +00001198
1199 \begin{macrodesc}{makemodindex}{}
Fred Drakeadade921999-04-22 13:05:27 +00001200 This should be used in the document preamble if a ``Module
Fred Drakeacffaee1999-03-16 16:09:13 +00001201 Index'' is desired for a document containing reference material
1202 on many modules. This causes a data file
Fred Draked1fb7791999-05-17 16:33:54 +00001203 \code{lib\var{jobname}.idx} to be created from the
Fred Drakeacffaee1999-03-16 16:09:13 +00001204 \macro{declaremodule} macros. This file can be processed by the
1205 \program{makeindex} program to generate a file which can be
1206 \macro{input} into the document at the desired location of the
1207 module index.
1208 \end{macrodesc}
1209
1210 There are a number of macros that are useful for adding index
1211 entries for particular concepts, many of which are specific to
1212 programming languages or even Python.
1213
Fred Drakeadade921999-04-22 13:05:27 +00001214 \begin{macrodesc}{bifuncindex}{\p{name}}
Fred Drakeec8b9051999-04-23 20:01:17 +00001215 Add an index entry referring to a built-in function named
1216 \var{name}; parentheses should not be included after
Fred Drake2c4e0091999-03-29 14:55:55 +00001217 \var{name}.
Fred Drakeacffaee1999-03-16 16:09:13 +00001218 \end{macrodesc}
1219
Fred Drakeadade921999-04-22 13:05:27 +00001220 \begin{macrodesc}{exindex}{\p{exception}}
Fred Drake2c4e0091999-03-29 14:55:55 +00001221 Add a reference to an exception named \var{exception}. The
1222 exception may be either string- or class-based.
Fred Drakeacffaee1999-03-16 16:09:13 +00001223 \end{macrodesc}
1224
Fred Drakeadade921999-04-22 13:05:27 +00001225 \begin{macrodesc}{kwindex}{\p{keyword}}
Fred Drake2c4e0091999-03-29 14:55:55 +00001226 Add a reference to a language keyword (not a keyword parameter
1227 in a function or method call).
Fred Drakeacffaee1999-03-16 16:09:13 +00001228 \end{macrodesc}
1229
Fred Drakeadade921999-04-22 13:05:27 +00001230 \begin{macrodesc}{obindex}{\p{object type}}
Fred Drake2c4e0091999-03-29 14:55:55 +00001231 Add an index entry for a built-in object type.
Fred Drakeacffaee1999-03-16 16:09:13 +00001232 \end{macrodesc}
1233
Fred Drakeadade921999-04-22 13:05:27 +00001234 \begin{macrodesc}{opindex}{\p{operator}}
Fred Drake2c4e0091999-03-29 14:55:55 +00001235 Add a reference to an operator, such as \samp{+}.
Fred Drakeacffaee1999-03-16 16:09:13 +00001236 \end{macrodesc}
1237
Fred Drakeadade921999-04-22 13:05:27 +00001238 \begin{macrodesc}{refmodindex}{\op{key}\p{module}}
Fred Drakeacffaee1999-03-16 16:09:13 +00001239 Add an index entry for module \var{module}; if \var{module}
1240 contains an underscore, the optional parameter \var{key} should
1241 be provided as the same string with underscores removed. An
1242 index entry ``\var{module} (module)'' will be generated. This
1243 is intended for use with non-standard modules implemented in
1244 Python.
1245 \end{macrodesc}
1246
Fred Drakeadade921999-04-22 13:05:27 +00001247 \begin{macrodesc}{refexmodindex}{\op{key}\p{module}}
Fred Drakeacffaee1999-03-16 16:09:13 +00001248 As for \macro{refmodindex}, but the index entry will be
1249 ``\var{module} (extension module).'' This is intended for use
1250 with non-standard modules not implemented in Python.
1251 \end{macrodesc}
1252
Fred Drakeadade921999-04-22 13:05:27 +00001253 \begin{macrodesc}{refbimodindex}{\op{key}\p{module}}
Fred Drakeacffaee1999-03-16 16:09:13 +00001254 As for \macro{refmodindex}, but the index entry will be
1255 ``\var{module} (built-in module).'' This is intended for use
1256 with standard modules not implemented in Python.
1257 \end{macrodesc}
1258
Fred Drakeadade921999-04-22 13:05:27 +00001259 \begin{macrodesc}{refstmodindex}{\op{key}\p{module}}
Fred Drakeacffaee1999-03-16 16:09:13 +00001260 As for \macro{refmodindex}, but the index entry will be
1261 ``\var{module} (standard module).'' This is intended for use
1262 with standard modules implemented in Python.
1263 \end{macrodesc}
1264
Fred Drakeadade921999-04-22 13:05:27 +00001265 \begin{macrodesc}{stindex}{\p{statement}}
Fred Drake2c4e0091999-03-29 14:55:55 +00001266 Add an index entry for a statement type, such as \keyword{print}
Fred Drakeadade921999-04-22 13:05:27 +00001267 or \keyword{try}/\keyword{finally}.
1268
1269 XXX Need better examples of difference from \macro{kwindex}.
Fred Drakeacffaee1999-03-16 16:09:13 +00001270 \end{macrodesc}
1271
1272
1273 Additional macros are provided which are useful for conveniently
1274 creating general index entries which should appear at many places
1275 in the index by rotating a list of words. These are simple macros
1276 that simply use \macro{index} to build some number of index
1277 entries. Index entries build using these macros contain both
1278 primary and secondary text.
1279
Fred Drakeadade921999-04-22 13:05:27 +00001280 \begin{macrodesc}{indexii}{\p{word1}\p{word2}}
Fred Drakeacffaee1999-03-16 16:09:13 +00001281 Build two index entries. This is exactly equivalent to using
1282 \code{\e index\{\var{word1}!\var{word2}\}} and
1283 \code{\e index\{\var{word2}!\var{word1}\}}.
1284 \end{macrodesc}
1285
Fred Drakeadade921999-04-22 13:05:27 +00001286 \begin{macrodesc}{indexiii}{\p{word1}\p{word2}\p{word3}}
Fred Drakeacffaee1999-03-16 16:09:13 +00001287 Build three index entries. This is exactly equivalent to using
1288 \code{\e index\{\var{word1}!\var{word2} \var{word3}\}},
1289 \code{\e index\{\var{word2}!\var{word3}, \var{word1}\}}, and
1290 \code{\e index\{\var{word3}!\var{word1} \var{word2}\}}.
1291 \end{macrodesc}
1292
Fred Drakeadade921999-04-22 13:05:27 +00001293 \begin{macrodesc}{indexiv}{\p{word1}\p{word2}\p{word3}\p{word4}}
Fred Drakeacffaee1999-03-16 16:09:13 +00001294 Build four index entries. This is exactly equivalent to using
1295 \code{\e index\{\var{word1}!\var{word2} \var{word3} \var{word4}\}},
1296 \code{\e index\{\var{word2}!\var{word3} \var{word4}, \var{word1}\}},
1297 \code{\e index\{\var{word3}!\var{word4}, \var{word1} \var{word2}\}},
1298 and
1299 \code{\e index\{\var{word4}!\var{word1} \var{word2} \var{word3}\}}.
1300 \end{macrodesc}
1301
1302
1303\section{Special Names}
1304
1305 Many special names are used in the Python documentation, including
1306 the names of operating systems, programming languages, standards
1307 bodies, and the like. Many of these were assigned \LaTeX{} macros
1308 at some point in the distant past, and these macros lived on long
1309 past their usefulness. In the current markup, these entities are
1310 not assigned any special markup, but the preferred spellings are
1311 given here to aid authors in maintaining the consistency of
1312 presentation in the Python documentation.
1313
1314 \begin{description}
1315 \item[POSIX]
1316 The name assigned to a particular group of standards. This is
1317 always uppercase.
1318
1319 \item[Python]
1320 The name of our favorite programming language is always
1321 capitalized.
Fred Drake42934682000-04-03 15:00:28 +00001322
1323 \item[Unicode]
1324 The name of a character set and matching encoding. This is
1325 always written capitalized.
Fred Drakeacffaee1999-03-16 16:09:13 +00001326 \end{description}
1327
1328
1329\section{Processing Tools}
1330
1331 \subsection{External Tools}
1332
1333 Many tools are needed to be able to process the Python
1334 documentation if all supported formats are required. This
Fred Drakeadade921999-04-22 13:05:27 +00001335 section lists the tools used and when each is required. Consult
1336 the \file{Doc/README} file to see if there are specific version
1337 requirements for any of these.
Fred Drakeacffaee1999-03-16 16:09:13 +00001338
1339 \begin{description}
1340 \item[\program{dvips}]
1341 This program is a typical part of \TeX{} installations. It is
1342 used to generate PostScript from the ``device independent''
Fred Drake2c4e0091999-03-29 14:55:55 +00001343 \file{.dvi} files. It is needed for the conversion to
Fred Drakeacffaee1999-03-16 16:09:13 +00001344 PostScript.
1345
1346 \item[\program{emacs}]
1347 Emacs is the kitchen sink of programmers' editors, and a damn
1348 fine kitchen sink it is. It also comes with some of the
1349 processing needed to support the proper menu structures for
1350 Texinfo documents when an info conversion is desired. This is
Fred Drake2c4e0091999-03-29 14:55:55 +00001351 needed for the info conversion. Using \program{xemacs}
Fred Drakeacffaee1999-03-16 16:09:13 +00001352 instead of FSF \program{emacs} may lead to instability in the
1353 conversion, but that's because nobody seems to maintain the
1354 Emacs Texinfo code in a portable manner.
1355
1356 \item[\program{latex}]
1357 This is a world-class typesetter by Donald Knuth. It is used
1358 for the conversion to PostScript, and is needed for the HTML
1359 conversion as well (\LaTeX2HTML requires one of the
1360 intermediate files it creates).
1361
1362 \item[\program{latex2html}]
1363 Probably the longest Perl script anyone ever attempted to
1364 maintain. This converts \LaTeX{} documents to HTML documents,
1365 and does a pretty reasonable job. It is required for the
1366 conversions to HTML and GNU info.
1367
1368 \item[\program{lynx}]
1369 This is a text-mode Web browser which includes an
1370 HTML-to-plain text conversion. This is used to convert
1371 \code{howto} documents to text.
1372
1373 \item[\program{make}]
1374 Just about any version should work for the standard documents,
1375 but GNU \program{make} is required for the experimental
1376 processes in \file{Doc/tools/sgmlconv/}, at least while
1377 they're experimental.
1378
1379 \item[\program{makeindex}]
1380 This is a standard program for converting \LaTeX{} index data
1381 to a formatted index; it should be included with all \LaTeX{}
1382 installations. It is needed for the PDF and PostScript
1383 conversions.
1384
1385 \item[\program{makeinfo}]
1386 GNU \program{makeinfo} is used to convert Texinfo documents to
1387 GNU info files. Since Texinfo is used as an intermediate
1388 format in the info conversion, this program is needed in that
1389 conversion.
1390
1391 \item[\program{pdflatex}]
1392 pdf\TeX{} is a relatively new variant of \TeX, and is used to
1393 generate the PDF version of the manuals. It is typically
1394 installed as part of most of the large \TeX{} distributions.
Fred Drake7a737df1999-04-23 14:41:44 +00001395 \program{pdflatex} is pdf\TeX{} using the \LaTeX{} format.
Fred Drakeacffaee1999-03-16 16:09:13 +00001396
1397 \item[\program{perl}]
1398 Perl is required for \LaTeX2HTML{} and one of the scripts used
1399 to post-process \LaTeX2HTML output, as well as the
Fred Drake2c4e0091999-03-29 14:55:55 +00001400 HTML-to-Texinfo conversion. This is required for
Fred Drakeacffaee1999-03-16 16:09:13 +00001401 the HTML and GNU info conversions.
1402
1403 \item[\program{python}]
1404 Python is used for many of the scripts in the
1405 \file{Doc/tools/} directory; it is required for all
1406 conversions. This shouldn't be a problem if you're interested
1407 in writing documentation for Python!
1408 \end{description}
1409
1410
1411 \subsection{Internal Tools}
1412
1413 This section describes the various scripts that are used to
1414 implement various stages of document processing or to orchestrate
Fred Drake2c4e0091999-03-29 14:55:55 +00001415 entire build sequences. Most of these tools are only useful
Fred Drakeacffaee1999-03-16 16:09:13 +00001416 in the context of building the standard documentation, but some
1417 are more general.
1418
1419 \begin{description}
1420 \item[\program{mkhowto}]
Fred Drake87f768e1999-05-17 15:22:45 +00001421 This is the primary script used to format third-party
1422 documents. It contains all the logic needed to ``get it
1423 right.'' The proper way to use this script is to make a
1424 symbolic link to it or run it in place; the actual script file
1425 must be stored as part of the documentation source tree,
1426 though it may be used to format documents outside the
Fred Drakece444982000-04-11 18:52:52 +00001427 tree. Use \program{mkhowto} \longprogramopt{help}
Fred Draked290c101999-11-09 18:03:00 +00001428 for a list of
Fred Draked2a727f1999-05-27 21:45:54 +00001429 command line options.
Fred Drake87f768e1999-05-17 15:22:45 +00001430
Fred Draked1fb7791999-05-17 16:33:54 +00001431 \program{mkhowto} can be used for both \code{howto} and
1432 \code{manual} class documents. (For the later, be sure to get
1433 the latest version from the Python CVS repository rather than
1434 the version distributed in the \file{latex-1.5.2.tgz} source
1435 archive.)
1436
Fred Drake87f768e1999-05-17 15:22:45 +00001437 XXX Need more here.
Fred Drakeacffaee1999-03-16 16:09:13 +00001438 \end{description}
1439
1440
1441\section{Future Directions \label{futures}}
1442
1443 The history of the Python documentation is full of changes, most of
1444 which have been fairly small and evolutionary. There has been a
1445 great deal of discussion about making large changes in the markup
1446 languages and tools used to process the documentation. This section
1447 deals with the nature of the changes and what appears to be the most
1448 likely path of future development.
1449
1450 \subsection{Structured Documentation \label{structured}}
1451
1452 Most of the small changes to the \LaTeX{} markup have been made
1453 with an eye to divorcing the markup from the presentation, making
1454 both a bit more maintainable. Over the course of 1998, a large
1455 number of changes were made with exactly this in mind; previously,
1456 changes had been made but in a less systematic manner and with
1457 more concern for not needing to update the existing content. The
1458 result has been a highly structured and semantically loaded markup
1459 language implemented in \LaTeX. With almost no basic \TeX{} or
1460 \LaTeX{} markup in use, however, the markup syntax is about the
1461 only evidence of \LaTeX{} in the actual document sources.
1462
1463 One side effect of this is that while we've been able to use
1464 standard ``engines'' for manipulating the documents, such as
1465 \LaTeX{} and \LaTeX2HTML, most of the actual transformations have
Fred Drake7a737df1999-04-23 14:41:44 +00001466 been created specifically for Python. The \LaTeX{} document
1467 classes and \LaTeX2HTML support are both complete implementations
1468 of the specific markup designed for these documents.
Fred Drakeacffaee1999-03-16 16:09:13 +00001469
1470 Combining highly customized markup with the somewhat esoteric
1471 systems used to process the documents leads us to ask some
1472 questions: Can we do this more easily? and, Can we do this
1473 better? After a great deal of discussion with the community, we
1474 have determined that actively pursuing modern structured
Fred Drake2c4e0091999-03-29 14:55:55 +00001475 documentation systems is worth some investment of time.
Fred Drakeacffaee1999-03-16 16:09:13 +00001476
1477 There appear to be two real contenders in this arena: the Standard
1478 General Markup Language (SGML), and the Extensible Markup Language
1479 (XML). Both of these standards have advantages and disadvantages,
1480 and many advantages are shared.
1481
1482 SGML offers advantages which may appeal most to authors,
1483 especially those using ordinary text editors. There are also
1484 additional abilities to define content models. A number of
1485 high-quality tools with demonstrated maturity is available, but
1486 most are not free; for those which are, portability issues remain
1487 a problem.
1488
1489 The advantages of XML include the availability of a large number
1490 of evolving tools. Unfortunately, many of the associated
1491 standards are still evolving, and the tools will have to follow
1492 along. This means that developing a robust tool set that uses
1493 more than the basic XML 1.0 recommendation is not possible in the
1494 short term. The promised availability of a wide variety of
1495 high-quality tools which support some of the most important
1496 related standards is not immediate. Many tools are likely to be
1497 free.
1498
Fred Drakeadade921999-04-22 13:05:27 +00001499 XXX Eventual migration to SGML/XML.
Fred Drakeacffaee1999-03-16 16:09:13 +00001500
1501 \subsection{Discussion Forums \label{discussion}}
1502
1503 Discussion of the future of the Python documentation and related
Fred Drake7a737df1999-04-23 14:41:44 +00001504 topics takes place in the Documentation Special Interest Group, or
1505 ``Doc-SIG.'' Information on the group, including mailing list
1506 archives and subscription information, is available at
Fred Drakeacffaee1999-03-16 16:09:13 +00001507 \url{http://www.python.org/sigs/doc-sig/}. The SIG is open to all
1508 interested parties.
1509
1510 Comments and bug reports on the standard documents should be sent
1511 to \email{python-docs@python.org}. This may include comments
Fred Drakeadade921999-04-22 13:05:27 +00001512 about formatting, content, grammatical and spelling errors, or
Fred Draked1fb7791999-05-17 16:33:54 +00001513 this document. You can also send comments on this document
1514 directly to the author at \email{fdrake@acm.org}.
Fred Drakeacffaee1999-03-16 16:09:13 +00001515
1516\end{document}