Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 1 | \documentclass{howto} |
| 2 | \usepackage{ltxmarkup} |
| 3 | |
| 4 | \title{Documenting Python} |
| 5 | |
Skip Montanaro | 176bda4cd | 2002-04-19 04:50:44 +0000 | [diff] [blame] | 6 | \makeindex |
| 7 | |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 8 | \input{boilerplate} |
| 9 | |
Fred Drake | c7c9a64 | 1999-04-28 18:24:02 +0000 | [diff] [blame] | 10 | % Now override the stuff that includes author information; |
| 11 | % Guido did *not* write this one! |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 12 | |
| 13 | \author{Fred L. Drake, Jr.} |
| 14 | \authoraddress{ |
Fred Drake | e7f343d | 2003-07-11 03:36:15 +0000 | [diff] [blame] | 15 | PythonLabs \\ |
| 16 | Email: \email{fdrake@acm.org} |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 17 | } |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 18 | |
| 19 | |
| 20 | \begin{document} |
| 21 | |
| 22 | \maketitle |
| 23 | |
| 24 | \begin{abstract} |
| 25 | \noindent |
Fred Drake | 0299749 | 2000-09-21 05:26:43 +0000 | [diff] [blame] | 26 | The Python language has a substantial body of |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 27 | documentation, much of it contributed by various authors. The markup |
| 28 | used for the Python documentation is based on \LaTeX{} and requires a |
| 29 | significant set of macros written specifically for documenting Python. |
Fred Drake | 5eb992b | 1999-06-11 14:25:45 +0000 | [diff] [blame] | 30 | This document describes the macros introduced to support Python |
| 31 | documentation and how they should be used to support a wide range of |
| 32 | output formats. |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 33 | |
| 34 | This document describes the document classes and special markup used |
| 35 | in the Python documentation. Authors may use this guide, in |
| 36 | conjunction with the template files provided with the |
| 37 | distribution, to create or maintain whole documents or sections. |
| 38 | \end{abstract} |
| 39 | |
| 40 | \tableofcontents |
| 41 | |
| 42 | |
Fred Drake | f1b3de8 | 2001-07-24 14:38:34 +0000 | [diff] [blame] | 43 | \section{Introduction \label{intro}} |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 44 | |
| 45 | Python's documentation has long been considered to be good for a |
| 46 | free programming language. There are a number of reasons for this, |
| 47 | the most important being the early commitment of Python's creator, |
| 48 | Guido van Rossum, to providing documentation on the language and its |
| 49 | libraries, and the continuing involvement of the user community in |
| 50 | providing assistance for creating and maintaining documentation. |
| 51 | |
| 52 | The involvement of the community takes many forms, from authoring to |
Fred Drake | 7a737df | 1999-04-23 14:41:44 +0000 | [diff] [blame] | 53 | bug reports to just plain complaining when the documentation could |
| 54 | be more complete or easier to use. All of these forms of input from |
| 55 | the community have proved useful during the time I've been involved |
| 56 | in maintaining the documentation. |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 57 | |
Fred Drake | 2c4e009 | 1999-03-29 14:55:55 +0000 | [diff] [blame] | 58 | This document is aimed at authors and potential authors of |
Fred Drake | 7a737df | 1999-04-23 14:41:44 +0000 | [diff] [blame] | 59 | documentation for Python. More specifically, it is for people |
| 60 | contributing to the standard documentation and developing additional |
| 61 | documents using the same tools as the standard documents. This |
| 62 | guide will be less useful for authors using the Python documentation |
| 63 | tools for topics other than Python, and less useful still for |
| 64 | authors not using the tools at all. |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 65 | |
Fred Drake | 2c4e009 | 1999-03-29 14:55:55 +0000 | [diff] [blame] | 66 | The material in this guide is intended to assist authors using the |
| 67 | Python documentation tools. It includes information on the source |
| 68 | distribution of the standard documentation, a discussion of the |
Fred Drake | 7a737df | 1999-04-23 14:41:44 +0000 | [diff] [blame] | 69 | document types, reference material on the markup defined in the |
| 70 | document classes, a list of the external tools needed for processing |
Fred Drake | 2c4e009 | 1999-03-29 14:55:55 +0000 | [diff] [blame] | 71 | documents, and reference material on the tools provided with the |
| 72 | documentation resources. At the end, there is also a section |
Fred Drake | 7a737df | 1999-04-23 14:41:44 +0000 | [diff] [blame] | 73 | discussing future directions for the Python documentation and where |
| 74 | to turn for more information. |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 75 | |
Fred Drake | f1b3de8 | 2001-07-24 14:38:34 +0000 | [diff] [blame] | 76 | \section{Directory Structure \label{directories}} |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 77 | |
| 78 | The source distribution for the standard Python documentation |
| 79 | contains a large number of directories. While third-party documents |
| 80 | do not need to be placed into this structure or need to be placed |
| 81 | within a similar structure, it can be helpful to know where to look |
| 82 | for examples and tools when developing new documents using the |
| 83 | Python documentation tools. This section describes this directory |
| 84 | structure. |
| 85 | |
| 86 | The documentation sources are usually placed within the Python |
Fred Drake | 7a737df | 1999-04-23 14:41:44 +0000 | [diff] [blame] | 87 | source distribution as the top-level directory \file{Doc/}, but |
| 88 | are not dependent on the Python source distribution in any way. |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 89 | |
| 90 | The \file{Doc/} directory contains a few files and several |
| 91 | subdirectories. The files are mostly self-explanatory, including a |
| 92 | \file{README} and a \file{Makefile}. The directories fall into |
| 93 | three categories: |
| 94 | |
| 95 | \begin{definitions} |
| 96 | \term{Document Sources} |
Fred Drake | e7f343d | 2003-07-11 03:36:15 +0000 | [diff] [blame] | 97 | The \LaTeX{} sources for each document are placed in a |
| 98 | separate directory. These directories are given short |
| 99 | names which vaguely indicate the document in each: |
Fred Drake | 2f4bebd | 1999-04-28 16:43:11 +0000 | [diff] [blame] | 100 | |
Fred Drake | e7f343d | 2003-07-11 03:36:15 +0000 | [diff] [blame] | 101 | \begin{tableii}{p{.75in}|p{3in}}{filenq}{Directory}{Document Title} |
| 102 | \lineii{api/} |
Fred Drake | 31edf4d | 2000-09-07 20:06:07 +0000 | [diff] [blame] | 103 | {\citetitle[../api/api.html]{The Python/C API}} |
Fred Drake | e7f343d | 2003-07-11 03:36:15 +0000 | [diff] [blame] | 104 | \lineii{dist/} |
Fred Drake | 31edf4d | 2000-09-07 20:06:07 +0000 | [diff] [blame] | 105 | {\citetitle[../dist/dist.html]{Distributing Python Modules}} |
Fred Drake | e7f343d | 2003-07-11 03:36:15 +0000 | [diff] [blame] | 106 | \lineii{doc/} |
Fred Drake | 31edf4d | 2000-09-07 20:06:07 +0000 | [diff] [blame] | 107 | {\citetitle[../doc/doc.html]{Documenting Python}} |
Fred Drake | e7f343d | 2003-07-11 03:36:15 +0000 | [diff] [blame] | 108 | \lineii{ext/} |
Fred Drake | 31edf4d | 2000-09-07 20:06:07 +0000 | [diff] [blame] | 109 | {\citetitle[../ext/ext.html]{Extending and Embedding the Python Interpreter}} |
Fred Drake | e7f343d | 2003-07-11 03:36:15 +0000 | [diff] [blame] | 110 | \lineii{inst/} |
Fred Drake | 31edf4d | 2000-09-07 20:06:07 +0000 | [diff] [blame] | 111 | {\citetitle[../inst/inst.html]{Installing Python Modules}} |
Fred Drake | e7f343d | 2003-07-11 03:36:15 +0000 | [diff] [blame] | 112 | \lineii{lib/} |
Fred Drake | 31edf4d | 2000-09-07 20:06:07 +0000 | [diff] [blame] | 113 | {\citetitle[../lib/lib.html]{Python Library Reference}} |
Fred Drake | e7f343d | 2003-07-11 03:36:15 +0000 | [diff] [blame] | 114 | \lineii{mac/} |
Fred Drake | 31edf4d | 2000-09-07 20:06:07 +0000 | [diff] [blame] | 115 | {\citetitle[../mac/mac.html]{Macintosh Module Reference}} |
Fred Drake | e7f343d | 2003-07-11 03:36:15 +0000 | [diff] [blame] | 116 | \lineii{ref/} |
Fred Drake | 31edf4d | 2000-09-07 20:06:07 +0000 | [diff] [blame] | 117 | {\citetitle[../ref/ref.html]{Python Reference Manual}} |
Fred Drake | e7f343d | 2003-07-11 03:36:15 +0000 | [diff] [blame] | 118 | \lineii{tut/} |
Fred Drake | 31edf4d | 2000-09-07 20:06:07 +0000 | [diff] [blame] | 119 | {\citetitle[../tut/tut.html]{Python Tutorial}} |
Fred Drake | e7f343d | 2003-07-11 03:36:15 +0000 | [diff] [blame] | 120 | \end{tableii} |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 121 | |
| 122 | \term{Format-Specific Output} |
Fred Drake | e7f343d | 2003-07-11 03:36:15 +0000 | [diff] [blame] | 123 | Most output formats have a directory which contains a |
| 124 | \file{Makefile} which controls the generation of that format |
| 125 | and provides storage for the formatted documents. The only |
| 126 | variations within this category are the Portable Document |
Fred Drake | 2c4e009 | 1999-03-29 14:55:55 +0000 | [diff] [blame] | 127 | Format (PDF) and PostScript versions are placed in the |
Fred Drake | e7f343d | 2003-07-11 03:36:15 +0000 | [diff] [blame] | 128 | directories \file{paper-a4/} and \file{paper-letter/} (this |
| 129 | causes all the temporary files created by \LaTeX{} to be kept |
| 130 | in the same place for each paper size, where they can be more |
| 131 | easily ignored). |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 132 | |
Fred Drake | e7f343d | 2003-07-11 03:36:15 +0000 | [diff] [blame] | 133 | \begin{tableii}{p{.75in}|p{3in}}{filenq}{Directory}{Output Formats} |
| 134 | \lineii{html/}{HTML output} |
| 135 | \lineii{info/}{GNU info output} |
| 136 | \lineii{isilo/}{\ulink{iSilo}{http://www.isilo.com/} |
| 137 | documents (for Palm OS devices)} |
| 138 | \lineii{paper-a4/}{PDF and PostScript, A4 paper} |
| 139 | \lineii{paper-letter/}{PDF and PostScript, US-Letter paper} |
| 140 | \end{tableii} |
Fred Drake | 2f4bebd | 1999-04-28 16:43:11 +0000 | [diff] [blame] | 141 | |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 142 | \term{Supplemental Files} |
Fred Drake | e7f343d | 2003-07-11 03:36:15 +0000 | [diff] [blame] | 143 | Some additional directories are used to store supplemental |
| 144 | files used for the various processes. Directories are |
| 145 | included for the shared \LaTeX{} document classes, the |
| 146 | \LaTeX2HTML support, template files for various document |
| 147 | components, and the scripts used to perform various steps in |
| 148 | the formatting processes. |
Fred Drake | 2f4bebd | 1999-04-28 16:43:11 +0000 | [diff] [blame] | 149 | |
Fred Drake | e7f343d | 2003-07-11 03:36:15 +0000 | [diff] [blame] | 150 | \begin{tableii}{p{.75in}|p{3in}}{filenq}{Directory}{Contents} |
Fred Drake | 2bc9b2f | 2003-09-27 07:18:52 +0000 | [diff] [blame] | 151 | \lineii{commontex/}{Document content shared among documents} |
| 152 | \lineii{perl/} {Support for \LaTeX2HTML processing} |
Fred Drake | e7f343d | 2003-07-11 03:36:15 +0000 | [diff] [blame] | 153 | \lineii{templates/}{Example files for source documents} |
| 154 | \lineii{texinputs/}{Style implementation for \LaTeX} |
Fred Drake | 2bc9b2f | 2003-09-27 07:18:52 +0000 | [diff] [blame] | 155 | \lineii{tools/} {Custom processing scripts} |
Fred Drake | e7f343d | 2003-07-11 03:36:15 +0000 | [diff] [blame] | 156 | \end{tableii} |
Fred Drake | 2f4bebd | 1999-04-28 16:43:11 +0000 | [diff] [blame] | 157 | |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 158 | \end{definitions} |
| 159 | |
Fred Drake | 2c4e009 | 1999-03-29 14:55:55 +0000 | [diff] [blame] | 160 | |
Fred Drake | f1b3de8 | 2001-07-24 14:38:34 +0000 | [diff] [blame] | 161 | \section{Style Guide \label{style-guide}} |
Fred Drake | 432cef0 | 2001-07-06 22:34:33 +0000 | [diff] [blame] | 162 | |
| 163 | The Python documentation should follow the \citetitle |
Fred Drake | 192b95b | 2003-07-11 03:34:17 +0000 | [diff] [blame] | 164 | [http://developer.apple.com/documentation/UserExperience/Conceptual/APStyleGuide/AppleStyleGuide2003.pdf] |
Fred Drake | 432cef0 | 2001-07-06 22:34:33 +0000 | [diff] [blame] | 165 | {Apple Publications Style Guide} wherever possible. This particular |
| 166 | style guide was selected mostly because it seems reasonable and is |
Fred Drake | 192b95b | 2003-07-11 03:34:17 +0000 | [diff] [blame] | 167 | easy to get online. |
Fred Drake | 432cef0 | 2001-07-06 22:34:33 +0000 | [diff] [blame] | 168 | |
| 169 | Topics which are not covered in the Apple's style guide will be |
| 170 | discussed in this document if necessary. |
| 171 | |
| 172 | Many special names are used in the Python documentation, including |
| 173 | the names of operating systems, programming languages, standards |
| 174 | bodies, and the like. Many of these were assigned \LaTeX{} macros |
| 175 | at some point in the distant past, and these macros lived on long |
Fred Drake | 9120df3 | 2001-07-14 02:34:12 +0000 | [diff] [blame] | 176 | past their usefulness. In the current markup, most of these entities |
| 177 | are not assigned any special markup, but the preferred spellings are |
Fred Drake | 432cef0 | 2001-07-06 22:34:33 +0000 | [diff] [blame] | 178 | given here to aid authors in maintaining the consistency of |
| 179 | presentation in the Python documentation. |
| 180 | |
Fred Drake | 9120df3 | 2001-07-14 02:34:12 +0000 | [diff] [blame] | 181 | Other terms and words deserve special mention as well; these conventions |
| 182 | should be used to ensure consistency throughout the documentation: |
| 183 | |
Fred Drake | 432cef0 | 2001-07-06 22:34:33 +0000 | [diff] [blame] | 184 | \begin{description} |
Fred Drake | 9120df3 | 2001-07-14 02:34:12 +0000 | [diff] [blame] | 185 | \item[CPU] |
| 186 | For ``central processing unit.'' Many style guides say this |
| 187 | should be spelled out on the first use (and if you must use it, |
| 188 | do so!). For the Python documentation, this abbreviation should |
| 189 | be avoided since there's no reasonable way to predict which occurance |
| 190 | will be the first seen by the reader. It is better to use the |
| 191 | word ``processor'' instead. |
| 192 | |
| 193 | \item[\POSIX] |
Fred Drake | e7f343d | 2003-07-11 03:36:15 +0000 | [diff] [blame] | 194 | The name assigned to a particular group of standards. This is |
| 195 | always uppercase. Use the macro \macro{POSIX} to represent this |
| 196 | name. |
Fred Drake | 432cef0 | 2001-07-06 22:34:33 +0000 | [diff] [blame] | 197 | |
| 198 | \item[Python] |
Fred Drake | e7f343d | 2003-07-11 03:36:15 +0000 | [diff] [blame] | 199 | The name of our favorite programming language is always |
| 200 | capitalized. |
Fred Drake | 432cef0 | 2001-07-06 22:34:33 +0000 | [diff] [blame] | 201 | |
| 202 | \item[Unicode] |
Fred Drake | e7f343d | 2003-07-11 03:36:15 +0000 | [diff] [blame] | 203 | The name of a character set and matching encoding. This is |
| 204 | always written capitalized. |
Fred Drake | 9120df3 | 2001-07-14 02:34:12 +0000 | [diff] [blame] | 205 | |
| 206 | \item[\UNIX] |
Fred Drake | e7f343d | 2003-07-11 03:36:15 +0000 | [diff] [blame] | 207 | The name of the operating system developed at AT\&T Bell Labs |
| 208 | in the early 1970s. Use the macro \macro{UNIX} to use this |
| 209 | name. |
Fred Drake | 432cef0 | 2001-07-06 22:34:33 +0000 | [diff] [blame] | 210 | \end{description} |
| 211 | |
| 212 | |
Fred Drake | adade92 | 1999-04-22 13:05:27 +0000 | [diff] [blame] | 213 | \section{\LaTeX{} Primer \label{latex-primer}} |
Fred Drake | 2c4e009 | 1999-03-29 14:55:55 +0000 | [diff] [blame] | 214 | |
Fred Drake | adade92 | 1999-04-22 13:05:27 +0000 | [diff] [blame] | 215 | This section is a brief introduction to \LaTeX{} concepts and |
| 216 | syntax, to provide authors enough information to author documents |
Fred Drake | 20a175a | 2004-10-18 21:30:40 +0000 | [diff] [blame^] | 217 | productively without having to become ``\TeX{}nicians.'' This does |
| 218 | not teach everything needed to know about writing \LaTeX{} for |
| 219 | Python documentation; many of the standard ``environments'' are not |
| 220 | described here (though you will learn how to mark something as an |
| 221 | environment). |
Fred Drake | adade92 | 1999-04-22 13:05:27 +0000 | [diff] [blame] | 222 | |
Fred Drake | 5eb992b | 1999-06-11 14:25:45 +0000 | [diff] [blame] | 223 | Perhaps the most important concept to keep in mind while marking up |
Fred Drake | 0299749 | 2000-09-21 05:26:43 +0000 | [diff] [blame] | 224 | Python documentation is that while \TeX{} is unstructured, \LaTeX{} was |
Fred Drake | e7f343d | 2003-07-11 03:36:15 +0000 | [diff] [blame] | 225 | designed as a layer on top of \TeX{} which specifically supports |
Fred Drake | 5eb992b | 1999-06-11 14:25:45 +0000 | [diff] [blame] | 226 | structured markup. The Python-specific markup is intended to extend |
| 227 | the structure provided by standard \LaTeX{} document classes to |
| 228 | support additional information specific to Python. |
| 229 | |
Fred Drake | adade92 | 1999-04-22 13:05:27 +0000 | [diff] [blame] | 230 | \LaTeX{} documents contain two parts: the preamble and the body. |
| 231 | The preamble is used to specify certain metadata about the document |
| 232 | itself, such as the title, the list of authors, the date, and the |
| 233 | \emph{class} the document belongs to. Additional information used |
| 234 | to control index generation and the use of bibliographic databases |
Fred Drake | 7a737df | 1999-04-23 14:41:44 +0000 | [diff] [blame] | 235 | can also be placed in the preamble. For most authors, the preamble |
Fred Drake | adade92 | 1999-04-22 13:05:27 +0000 | [diff] [blame] | 236 | can be most easily created by copying it from an existing document |
| 237 | and modifying a few key pieces of information. |
| 238 | |
| 239 | The \dfn{class} of a document is used to place a document within a |
| 240 | broad category of documents and set some fundamental formatting |
| 241 | properties. For Python documentation, two classes are used: the |
| 242 | \code{manual} class and the \code{howto} class. These classes also |
| 243 | define the additional markup used to document Python concepts and |
| 244 | structures. Specific information about these classes is provided in |
Fred Drake | 7a737df | 1999-04-23 14:41:44 +0000 | [diff] [blame] | 245 | section \ref{classes}, ``Document Classes,'' below. The first thing |
Fred Drake | adade92 | 1999-04-22 13:05:27 +0000 | [diff] [blame] | 246 | in the preamble is the declaration of the document's class. |
| 247 | |
| 248 | After the class declaration, a number of \emph{macros} are used to |
| 249 | provide further information about the document and setup any |
Fred Drake | 7a737df | 1999-04-23 14:41:44 +0000 | [diff] [blame] | 250 | additional markup that is needed. No output is generated from the |
| 251 | preamble; it is an error to include free text in the preamble |
| 252 | because it would cause output. |
Fred Drake | adade92 | 1999-04-22 13:05:27 +0000 | [diff] [blame] | 253 | |
| 254 | The document body follows the preamble. This contains all the |
Fred Drake | 63568aa | 2000-10-19 05:36:10 +0000 | [diff] [blame] | 255 | printed components of the document marked up structurally. Generic |
Fred Drake | 4c6f17a | 2001-04-18 05:12:47 +0000 | [diff] [blame] | 256 | \LaTeX{} structures include hierarchical sections, numbered and |
| 257 | bulleted lists, and special structures for the document abstract and |
| 258 | indexes. |
Fred Drake | adade92 | 1999-04-22 13:05:27 +0000 | [diff] [blame] | 259 | |
Fred Drake | f1b3de8 | 2001-07-24 14:38:34 +0000 | [diff] [blame] | 260 | \subsection{Syntax \label{latex-syntax}} |
Fred Drake | 63568aa | 2000-10-19 05:36:10 +0000 | [diff] [blame] | 261 | |
Fred Drake | 4c6f17a | 2001-04-18 05:12:47 +0000 | [diff] [blame] | 262 | There are some things that an author of Python documentation needs |
| 263 | to know about \LaTeX{} syntax. |
Fred Drake | 63568aa | 2000-10-19 05:36:10 +0000 | [diff] [blame] | 264 | |
| 265 | A \dfn{comment} is started by the ``percent'' character |
| 266 | (\character{\%}) and continues through the end of the line and all |
| 267 | leading whitespace on the following line. This is a little |
| 268 | different from any programming language I know of, so an example |
| 269 | is in order: |
| 270 | |
| 271 | \begin{verbatim} |
| 272 | This is text.% comment |
| 273 | This is more text. % another comment |
| 274 | Still more text. |
| 275 | \end{verbatim} |
| 276 | |
| 277 | The first non-comment character following the first comment is the |
| 278 | letter \character{T} on the second line; the leading whitespace on |
| 279 | that line is consumed as part of the first comment. This means |
| 280 | that there is no space between the first and second sentences, so |
| 281 | the period and letter \character{T} will be directly adjacent in |
| 282 | the typeset document. |
| 283 | |
| 284 | Note also that though the first non-comment character after the |
| 285 | second comment is the letter \character{S}, there is whitespace |
| 286 | preceding the comment, so the two sentences are separated as |
| 287 | expected. |
| 288 | |
| 289 | A \dfn{group} is an enclosure for a collection of text and |
| 290 | commands which encloses the formatting context and constrains the |
| 291 | scope of any changes to that context made by commands within the |
| 292 | group. Groups can be nested hierarchically. The formatting |
| 293 | context includes the font and the definition of additional macros |
| 294 | (or overrides of macros defined in outer groups). Syntactically, |
| 295 | groups are enclosed in braces: |
| 296 | |
| 297 | \begin{verbatim} |
| 298 | {text in a group} |
| 299 | \end{verbatim} |
| 300 | |
Fred Drake | 4c6f17a | 2001-04-18 05:12:47 +0000 | [diff] [blame] | 301 | An alternate syntax for a group using brackets, \code{[...]}, is |
Fred Drake | 63568aa | 2000-10-19 05:36:10 +0000 | [diff] [blame] | 302 | used by macros and environment constructors which take optional |
| 303 | parameters; brackets do not normally hold syntactic significance. |
| 304 | A degenerate group, containing only one atomic bit of content, |
| 305 | does not need to have an explicit group, unless it is required to |
| 306 | avoid ambiguity. Since Python tends toward the explicit, groups |
| 307 | are also made explicit in the documentation markup. |
| 308 | |
| 309 | Groups are used only sparingly in the Python documentation, except |
| 310 | for their use in marking parameters to macros and environments. |
| 311 | |
Fred Drake | 4c6f17a | 2001-04-18 05:12:47 +0000 | [diff] [blame] | 312 | A \dfn{macro} is usually a simple construct which is identified by |
Fred Drake | 63568aa | 2000-10-19 05:36:10 +0000 | [diff] [blame] | 313 | name and can take some number of parameters. In normal \LaTeX{} |
| 314 | usage, one of these can be optional. The markup is introduced |
| 315 | using the backslash character (\character{\e}), and the name is |
| 316 | given by alphabetic characters (no digits, hyphens, or |
| 317 | underscores). Required parameters should be marked as a group, |
| 318 | and optional parameters should be marked using the alternate |
| 319 | syntax for a group. |
| 320 | |
Neal Norwitz | 750f060 | 2004-08-01 22:36:40 +0000 | [diff] [blame] | 321 | For example, a macro which takes a single parameter |
Fred Drake | 63568aa | 2000-10-19 05:36:10 +0000 | [diff] [blame] | 322 | would appear like this: |
| 323 | |
| 324 | \begin{verbatim} |
| 325 | \name{parameter} |
| 326 | \end{verbatim} |
| 327 | |
| 328 | A macro which takes an optional parameter would be typed like this |
Raymond Hettinger | 5232f50 | 2004-03-25 08:51:36 +0000 | [diff] [blame] | 329 | when the optional parameter is given: |
Fred Drake | 63568aa | 2000-10-19 05:36:10 +0000 | [diff] [blame] | 330 | |
| 331 | \begin{verbatim} |
| 332 | \name[optional] |
| 333 | \end{verbatim} |
| 334 | |
| 335 | If both optional and required parameters are to be required, it |
| 336 | looks like this: |
| 337 | |
| 338 | \begin{verbatim} |
| 339 | \name[optional]{required} |
| 340 | \end{verbatim} |
| 341 | |
| 342 | A macro name may be followed by a space or newline; a space |
| 343 | between the macro name and any parameters will be consumed, but |
| 344 | this usage is not practiced in the Python documentation. Such a |
Fred Drake | 4c6f17a | 2001-04-18 05:12:47 +0000 | [diff] [blame] | 345 | space is still consumed if there are no parameters to the macro, |
Fred Drake | 63568aa | 2000-10-19 05:36:10 +0000 | [diff] [blame] | 346 | in which case inserting an empty group (\code{\{\}}) or explicit |
| 347 | word space (\samp{\e\ }) immediately after the macro name helps to |
| 348 | avoid running the expansion of the macro into the following text. |
| 349 | Macros which take no parameters but which should not be followed |
| 350 | by a word space do not need special treatment if the following |
| 351 | character in the document source if not a name character (such as |
Fred Drake | 4c6f17a | 2001-04-18 05:12:47 +0000 | [diff] [blame] | 352 | punctuation). |
Fred Drake | 63568aa | 2000-10-19 05:36:10 +0000 | [diff] [blame] | 353 | |
| 354 | Each line of this example shows an appropriate way to write text |
| 355 | which includes a macro which takes no parameters: |
| 356 | |
| 357 | \begin{verbatim} |
| 358 | This \UNIX{} is followed by a space. |
| 359 | This \UNIX\ is also followed by a space. |
| 360 | \UNIX, followed by a comma, needs no additional markup. |
| 361 | \end{verbatim} |
| 362 | |
Fred Drake | d097d48 | 2000-10-20 20:51:31 +0000 | [diff] [blame] | 363 | An \dfn{environment} is a larger construct than a macro, and can |
Fred Drake | 4c6f17a | 2001-04-18 05:12:47 +0000 | [diff] [blame] | 364 | be used for things with more content than would conveniently fit |
Fred Drake | d097d48 | 2000-10-20 20:51:31 +0000 | [diff] [blame] | 365 | in a macro parameter. They are primarily used when formatting |
| 366 | parameters need to be changed before and after a large chunk of |
| 367 | content, but the content itself needs to be highly flexible. Code |
| 368 | samples are presented using an environment, and descriptions of |
Fred Drake | 4c6f17a | 2001-04-18 05:12:47 +0000 | [diff] [blame] | 369 | functions, methods, and classes are also marked using environments. |
Fred Drake | d097d48 | 2000-10-20 20:51:31 +0000 | [diff] [blame] | 370 | |
| 371 | Since the content of an environment is free-form and can consist |
| 372 | of several paragraphs, they are actually marked using a pair of |
| 373 | macros: \macro{begin} and \macro{end}. These macros both take the |
| 374 | name of the environment as a parameter. An example is the |
| 375 | environment used to mark the abstract of a document: |
| 376 | |
| 377 | \begin{verbatim} |
| 378 | \begin{abstract} |
| 379 | This is the text of the abstract. It concisely explains what |
| 380 | information is found in the document. |
| 381 | |
| 382 | It can consist of multiple paragraphs. |
| 383 | \end{abstract} |
| 384 | \end{verbatim} |
| 385 | |
| 386 | An environment can also have required and optional parameters of |
| 387 | its own. These follow the parameter of the \macro{begin} macro. |
| 388 | This example shows an environment which takes a single required |
| 389 | parameter: |
| 390 | |
| 391 | \begin{verbatim} |
Fred Drake | 2bbc697 | 2001-03-28 16:51:20 +0000 | [diff] [blame] | 392 | \begin{datadesc}{controlnames} |
Fred Drake | d097d48 | 2000-10-20 20:51:31 +0000 | [diff] [blame] | 393 | A 33-element string array that contains the \ASCII{} mnemonics for |
| 394 | the thirty-two \ASCII{} control characters from 0 (NUL) to 0x1f |
| 395 | (US), in order, plus the mnemonic \samp{SP} for the space character. |
| 396 | \end{datadesc} |
| 397 | \end{verbatim} |
Fred Drake | 63568aa | 2000-10-19 05:36:10 +0000 | [diff] [blame] | 398 | |
Fred Drake | 4c6f17a | 2001-04-18 05:12:47 +0000 | [diff] [blame] | 399 | There are a number of less-used marks in \LaTeX{} which are used |
Fred Drake | e789ea1 | 2002-03-13 02:48:24 +0000 | [diff] [blame] | 400 | to enter characters which are not found in \ASCII{} or which a |
| 401 | considered special, or \emph{active} in \TeX{} or \LaTeX. Given |
| 402 | that these are often used adjacent to other characters, the markup |
| 403 | required to produce the proper character may need to be followed |
| 404 | by a space or an empty group, or the markup can be enclosed in a |
| 405 | group. Some which are found in Python documentation are: |
Fred Drake | 63568aa | 2000-10-19 05:36:10 +0000 | [diff] [blame] | 406 | |
Fred Drake | d097d48 | 2000-10-20 20:51:31 +0000 | [diff] [blame] | 407 | \begin{tableii}{c|l}{textrm}{Character}{Markup} |
Fred Drake | e789ea1 | 2002-03-13 02:48:24 +0000 | [diff] [blame] | 408 | \lineii{\textasciicircum}{\code{\e textasciicircum}} |
| 409 | \lineii{\textasciitilde}{\code{\e textasciitilde}} |
| 410 | \lineii{\textgreater}{\code{\e textgreater}} |
| 411 | \lineii{\textless}{\code{\e textless}} |
Fred Drake | d097d48 | 2000-10-20 20:51:31 +0000 | [diff] [blame] | 412 | \lineii{\c c}{\code{\e c c}} |
| 413 | \lineii{\"o}{\code{\e"o}} |
| 414 | \lineii{\o}{\code{\e o}} |
| 415 | \end{tableii} |
Fred Drake | 63568aa | 2000-10-19 05:36:10 +0000 | [diff] [blame] | 416 | |
| 417 | |
Skip Montanaro | 176bda4cd | 2002-04-19 04:50:44 +0000 | [diff] [blame] | 418 | \subsection{Hierarchical Structure \label{latex-structure}} |
Fred Drake | 63568aa | 2000-10-19 05:36:10 +0000 | [diff] [blame] | 419 | |
Fred Drake | d097d48 | 2000-10-20 20:51:31 +0000 | [diff] [blame] | 420 | \LaTeX{} expects documents to be arranged in a conventional, |
| 421 | hierarchical way, with chapters, sections, sub-sections, |
| 422 | appendixes, and the like. These are marked using macros rather |
| 423 | than environments, probably because the end of a section can be |
| 424 | safely inferred when a section of equal or higher level starts. |
| 425 | |
| 426 | There are six ``levels'' of sectioning in the document classes |
Fred Drake | 4c6f17a | 2001-04-18 05:12:47 +0000 | [diff] [blame] | 427 | used for Python documentation, and the deepest two |
| 428 | levels\footnote{The deepest levels have the highest numbers in the |
| 429 | table.} are not used. The levels are: |
Fred Drake | d097d48 | 2000-10-20 20:51:31 +0000 | [diff] [blame] | 430 | |
| 431 | \begin{tableiii}{c|l|c}{textrm}{Level}{Macro Name}{Notes} |
| 432 | \lineiii{1}{\macro{chapter}}{(1)} |
| 433 | \lineiii{2}{\macro{section}}{} |
| 434 | \lineiii{3}{\macro{subsection}}{} |
Fred Drake | b7a52c9 | 2000-11-27 20:10:18 +0000 | [diff] [blame] | 435 | \lineiii{4}{\macro{subsubsection}}{} |
Fred Drake | d097d48 | 2000-10-20 20:51:31 +0000 | [diff] [blame] | 436 | \lineiii{5}{\macro{paragraph}}{(2)} |
| 437 | \lineiii{6}{\macro{subparagraph}}{} |
| 438 | \end{tableiii} |
| 439 | |
| 440 | \noindent |
| 441 | Notes: |
| 442 | |
| 443 | \begin{description} |
| 444 | \item[(1)] |
| 445 | Only used for the \code{manual} documents, as described in |
| 446 | section \ref{classes}, ``Document Classes.'' |
| 447 | \item[(2)] |
| 448 | Not the same as a paragraph of text; nobody seems to use this. |
| 449 | \end{description} |
Fred Drake | 2c4e009 | 1999-03-29 14:55:55 +0000 | [diff] [blame] | 450 | |
| 451 | |
Fred Drake | 20a175a | 2004-10-18 21:30:40 +0000 | [diff] [blame^] | 452 | \subsection{Common Environments \label{latex-environments}} |
| 453 | |
| 454 | \LaTeX{} provides a variety of environments even without the |
| 455 | additional markup provided by the Python-specific document classes |
| 456 | introducted in the next section. The following environments are |
| 457 | provided as part of standard \LaTeX{} and are being used in the |
| 458 | standard Python documentation; descriptions will be added here as |
| 459 | time allows. |
| 460 | |
| 461 | \begin{verbatim} |
| 462 | abstract |
| 463 | alltt |
| 464 | description |
| 465 | displaymath |
| 466 | document |
| 467 | enumerate |
| 468 | figure |
| 469 | flushleft |
| 470 | itemize |
| 471 | list |
| 472 | math |
| 473 | quotation |
| 474 | quote |
| 475 | sloppypar |
| 476 | verbatim |
| 477 | \end{verbatim} |
| 478 | |
| 479 | |
Fred Drake | adade92 | 1999-04-22 13:05:27 +0000 | [diff] [blame] | 480 | \section{Document Classes \label{classes}} |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 481 | |
| 482 | Two \LaTeX{} document classes are defined specifically for use with |
| 483 | the Python documentation. The \code{manual} class is for large |
| 484 | documents which are sectioned into chapters, and the \code{howto} |
| 485 | class is for smaller documents. |
| 486 | |
| 487 | The \code{manual} documents are larger and are used for most of the |
| 488 | standard documents. This document class is based on the standard |
| 489 | \LaTeX{} \code{report} class and is formatted very much like a long |
Fred Drake | 698d520 | 1999-11-10 15:54:57 +0000 | [diff] [blame] | 490 | technical report. The \citetitle[../ref/ref.html]{Python Reference |
| 491 | Manual} is a good example of a \code{manual} document, and the |
| 492 | \citetitle[../lib/lib.html]{Python Library Reference} is a large |
| 493 | example. |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 494 | |
| 495 | The \code{howto} documents are shorter, and don't have the large |
| 496 | structure of the \code{manual} documents. This class is based on |
| 497 | the standard \LaTeX{} \code{article} class and is formatted somewhat |
| 498 | like the Linux Documentation Project's ``HOWTO'' series as done |
| 499 | originally using the LinuxDoc software. The original intent for the |
| 500 | document class was that it serve a similar role as the LDP's HOWTO |
| 501 | series, but the applicability of the class turns out to be somewhat |
Fred Drake | 0299749 | 2000-09-21 05:26:43 +0000 | [diff] [blame] | 502 | broader. This class is used for ``how-to'' documents (this |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 503 | document is an example) and for shorter reference manuals for small, |
| 504 | fairly cohesive module libraries. Examples of the later use include |
Fred Drake | 6a547c7 | 2000-09-15 22:11:24 +0000 | [diff] [blame] | 505 | \citetitle[http://starship.python.net/crew/fdrake/manuals/krb5py/krb5py.html]{Using |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 506 | Kerberos from Python}, which contains reference material for an |
| 507 | extension package. These documents are roughly equivalent to a |
| 508 | single chapter from a larger work. |
| 509 | |
| 510 | |
Fred Drake | f1b3de8 | 2001-07-24 14:38:34 +0000 | [diff] [blame] | 511 | \section{Special Markup Constructs \label{special-constructs}} |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 512 | |
Fred Drake | 2c4e009 | 1999-03-29 14:55:55 +0000 | [diff] [blame] | 513 | The Python document classes define a lot of new environments and |
| 514 | macros. This section contains the reference material for these |
Fred Drake | 20a175a | 2004-10-18 21:30:40 +0000 | [diff] [blame^] | 515 | facilities. Documentation for ``standard'' \LaTeX{} constructs is |
| 516 | not included here, though they are used in the Python documentation. |
Fred Drake | 2c4e009 | 1999-03-29 14:55:55 +0000 | [diff] [blame] | 517 | |
Fred Drake | af2b714 | 2000-09-14 20:11:05 +0000 | [diff] [blame] | 518 | \subsection{Markup for the Preamble \label{preamble-info}} |
| 519 | |
| 520 | \begin{macrodesc}{release}{\p{ver}} |
| 521 | Set the version number for the software described in the |
| 522 | document. |
| 523 | \end{macrodesc} |
| 524 | |
| 525 | \begin{macrodesc}{setshortversion}{\p{sver}} |
| 526 | Specify the ``short'' version number of the documented software |
| 527 | to be \var{sver}. |
| 528 | \end{macrodesc} |
| 529 | |
Fred Drake | e15956b | 2000-04-03 04:51:13 +0000 | [diff] [blame] | 530 | \subsection{Meta-information Markup \label{meta-info}} |
| 531 | |
| 532 | \begin{macrodesc}{sectionauthor}{\p{author}\p{email}} |
| 533 | Identifies the author of the current section. \var{author} |
| 534 | should be the author's name such that it can be used for |
| 535 | presentation (though it isn't), and \var{email} should be the |
| 536 | author's email address. The domain name portion of |
| 537 | the address should be lower case. |
| 538 | |
Fred Drake | e7f343d | 2003-07-11 03:36:15 +0000 | [diff] [blame] | 539 | No presentation is generated from this markup, but it is used to |
Fred Drake | e15956b | 2000-04-03 04:51:13 +0000 | [diff] [blame] | 540 | help keep track of contributions. |
| 541 | \end{macrodesc} |
| 542 | |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 543 | \subsection{Information Units \label{info-units}} |
| 544 | |
Fred Drake | 2f4bebd | 1999-04-28 16:43:11 +0000 | [diff] [blame] | 545 | XXX Explain terminology, or come up with something more ``lay.'' |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 546 | |
Fred Drake | adade92 | 1999-04-22 13:05:27 +0000 | [diff] [blame] | 547 | There are a number of environments used to describe specific |
| 548 | features provided by modules. Each environment requires |
| 549 | parameters needed to provide basic information about what is being |
| 550 | described, and the environment content should be the description. |
| 551 | Most of these environments make entries in the general index (if |
| 552 | one is being produced for the document); if no index entry is |
| 553 | desired, non-indexing variants are available for many of these |
| 554 | environments. The environments have names of the form |
| 555 | \code{\var{feature}desc}, and the non-indexing variants are named |
| 556 | \code{\var{feature}descni}. The available variants are explicitly |
| 557 | included in the list below. |
| 558 | |
| 559 | For each of these environments, the first parameter, \var{name}, |
| 560 | provides the name by which the feature is accessed. |
| 561 | |
| 562 | Environments which describe features of objects within a module, |
| 563 | such as object methods or data attributes, allow an optional |
| 564 | \var{type name} parameter. When the feature is an attribute of |
| 565 | class instances, \var{type name} only needs to be given if the |
| 566 | class was not the most recently described class in the module; the |
| 567 | \var{name} value from the most recent \env{classdesc} is implied. |
| 568 | For features of built-in or extension types, the \var{type name} |
Fred Drake | 7a737df | 1999-04-23 14:41:44 +0000 | [diff] [blame] | 569 | value should always be provided. Another special case includes |
| 570 | methods and members of general ``protocols,'' such as the |
| 571 | formatter and writer protocols described for the |
| 572 | \module{formatter} module: these may be documented without any |
| 573 | specific implementation classes, and will always require the |
| 574 | \var{type name} parameter to be provided. |
Fred Drake | adade92 | 1999-04-22 13:05:27 +0000 | [diff] [blame] | 575 | |
Fred Drake | 7be440d | 2000-09-16 21:23:25 +0000 | [diff] [blame] | 576 | \begin{envdesc}{cfuncdesc}{\p{type}\p{name}\p{args}} |
| 577 | Environment used to described a C function. The \var{type} |
| 578 | should be specified as a \keyword{typedef} name, \code{struct |
| 579 | \var{tag}}, or the name of a primitive type. If it is a pointer |
Fred Drake | 0299749 | 2000-09-21 05:26:43 +0000 | [diff] [blame] | 580 | type, the trailing asterisk should not be preceded by a space. |
Fred Drake | 7be440d | 2000-09-16 21:23:25 +0000 | [diff] [blame] | 581 | \var{name} should be the name of the function (or function-like |
| 582 | pre-processor macro), and \var{args} should give the types and |
| 583 | names of the parameters. The names need to be given so they may |
| 584 | be used in the description. |
| 585 | \end{envdesc} |
| 586 | |
Fred Drake | 1251b0e | 2002-04-15 20:10:23 +0000 | [diff] [blame] | 587 | \begin{envdesc}{cmemberdesc}{\p{container}\p{type}\p{name}} |
| 588 | Description for a structure member. \var{container} should be |
| 589 | the \keyword{typedef} name, if there is one, otherwise if should |
| 590 | be \samp{struct \var{tag}}. The type of the member should given |
| 591 | as \var{type}, and the name should be given as \var{name}. The |
| 592 | text of the description should include the range of values |
| 593 | allowed, how the value should be interpreted, and whether the |
| 594 | value can be changed. References to structure members in text |
| 595 | should use the \macro{member} macro. |
| 596 | \end{envdesc} |
| 597 | |
Fred Drake | 79bf99c | 2002-04-09 20:17:42 +0000 | [diff] [blame] | 598 | \begin{envdesc}{csimplemacrodesc}{\p{name}} |
| 599 | Documentation for a ``simple'' macro. Simple macros are macros |
| 600 | which are used for code expansion, but which do not take |
| 601 | arguments so cannot be described as functions. This is not to |
| 602 | be used for simple constant definitions. Examples of it's use |
| 603 | in the Python documentation include |
| 604 | \csimplemacro{PyObject_HEAD} and |
| 605 | \csimplemacro{Py_BEGIN_ALLOW_THREADS}. |
| 606 | \end{envdesc} |
| 607 | |
Fred Drake | 7be440d | 2000-09-16 21:23:25 +0000 | [diff] [blame] | 608 | \begin{envdesc}{ctypedesc}{\op{tag}\p{name}} |
| 609 | Environment used to described a C type. The \var{name} |
| 610 | parameter should be the \keyword{typedef} name. If the type is |
| 611 | defined as a \keyword{struct} without a \keyword{typedef}, |
| 612 | \var{name} should have the form \code{struct \var{tag}}. |
| 613 | \var{name} will be added to the index unless \var{tag} is |
| 614 | provided, in which case \var{tag} will be used instead. |
| 615 | \var{tag} should not be used for a \keyword{typedef} name. |
| 616 | \end{envdesc} |
| 617 | |
| 618 | \begin{envdesc}{cvardesc}{\p{type}\p{name}} |
| 619 | Description of a global C variable. \var{type} should be the |
| 620 | \keyword{typedef} name, \code{struct \var{tag}}, or the name of |
| 621 | a primitive type. If variable has a pointer type, the trailing |
Fred Drake | 0299749 | 2000-09-21 05:26:43 +0000 | [diff] [blame] | 622 | asterisk should \emph{not} be preceded by a space. |
Fred Drake | 7be440d | 2000-09-16 21:23:25 +0000 | [diff] [blame] | 623 | \end{envdesc} |
| 624 | |
Fred Drake | adade92 | 1999-04-22 13:05:27 +0000 | [diff] [blame] | 625 | \begin{envdesc}{datadesc}{\p{name}} |
| 626 | This environment is used to document global data in a module, |
| 627 | including both variables and values used as ``defined |
| 628 | constants.'' Class and object attributes are not documented |
| 629 | using this environment. |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 630 | \end{envdesc} |
Fred Drake | 7a737df | 1999-04-23 14:41:44 +0000 | [diff] [blame] | 631 | \begin{envdesc}{datadescni}{\p{name}} |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 632 | Like \env{datadesc}, but without creating any index entries. |
| 633 | \end{envdesc} |
| 634 | |
Fred Drake | 9f2376d | 2001-05-11 01:01:12 +0000 | [diff] [blame] | 635 | \begin{envdesc}{excclassdesc}{\p{name}\p{constructor parameters}} |
| 636 | Descibe an exception defined by a class. \var{constructor |
| 637 | parameters} should not include the \var{self} parameter or |
| 638 | the parentheses used in the call syntax. To describe an |
| 639 | exception class without describing the parameters to its |
| 640 | constructor, use the \env{excdesc} environment. |
| 641 | \end{envdesc} |
| 642 | |
Fred Drake | adade92 | 1999-04-22 13:05:27 +0000 | [diff] [blame] | 643 | \begin{envdesc}{excdesc}{\p{name}} |
Neal Norwitz | 847207a | 2003-05-29 02:17:23 +0000 | [diff] [blame] | 644 | Describe an exception. In the case of class exceptions, the |
Fred Drake | 9f2376d | 2001-05-11 01:01:12 +0000 | [diff] [blame] | 645 | constructor parameters are not described; use \env{excclassdesc} |
| 646 | to describe an exception class and its constructor. |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 647 | \end{envdesc} |
| 648 | |
Fred Drake | adade92 | 1999-04-22 13:05:27 +0000 | [diff] [blame] | 649 | \begin{envdesc}{funcdesc}{\p{name}\p{parameters}} |
| 650 | Describe a module-level function. \var{parameters} should |
| 651 | not include the parentheses used in the call syntax. Object |
| 652 | methods are not documented using this environment. Bound object |
| 653 | methods placed in the module namespace as part of the public |
| 654 | interface of the module are documented using this, as they are |
| 655 | equivalent to normal functions for most purposes. |
| 656 | |
| 657 | The description should include information about the parameters |
| 658 | required and how they are used (especially whether mutable |
| 659 | objects passed as parameters are modified), side effects, and |
| 660 | possible exceptions. A small example may be provided. |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 661 | \end{envdesc} |
Fred Drake | adade92 | 1999-04-22 13:05:27 +0000 | [diff] [blame] | 662 | \begin{envdesc}{funcdescni}{\p{name}\p{parameters}} |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 663 | Like \env{funcdesc}, but without creating any index entries. |
| 664 | \end{envdesc} |
| 665 | |
Fred Drake | adade92 | 1999-04-22 13:05:27 +0000 | [diff] [blame] | 666 | \begin{envdesc}{classdesc}{\p{name}\p{constructor parameters}} |
| 667 | Describe a class and its constructor. \var{constructor |
| 668 | parameters} should not include the \var{self} parameter or |
| 669 | the parentheses used in the call syntax. |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 670 | \end{envdesc} |
| 671 | |
Fred Drake | 9f2376d | 2001-05-11 01:01:12 +0000 | [diff] [blame] | 672 | \begin{envdesc}{classdesc*}{\p{name}} |
| 673 | Describe a class without describing the constructor. This can |
| 674 | be used to describe classes that are merely containers for |
| 675 | attributes or which should never be instantiated or subclassed |
| 676 | by user code. |
| 677 | \end{envdesc} |
| 678 | |
Fred Drake | adade92 | 1999-04-22 13:05:27 +0000 | [diff] [blame] | 679 | \begin{envdesc}{memberdesc}{\op{type name}\p{name}} |
| 680 | Describe an object data attribute. The description should |
| 681 | include information about the type of the data to be expected |
| 682 | and whether it may be changed directly. |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 683 | \end{envdesc} |
Fred Drake | adade92 | 1999-04-22 13:05:27 +0000 | [diff] [blame] | 684 | \begin{envdesc}{memberdescni}{\op{type name}\p{name}} |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 685 | Like \env{memberdesc}, but without creating any index entries. |
| 686 | \end{envdesc} |
| 687 | |
Fred Drake | adade92 | 1999-04-22 13:05:27 +0000 | [diff] [blame] | 688 | \begin{envdesc}{methoddesc}{\op{type name}\p{name}\p{parameters}} |
| 689 | Describe an object method. \var{parameters} should not include |
| 690 | the \var{self} parameter or the parentheses used in the call |
| 691 | syntax. The description should include similar information to |
| 692 | that described for \env{funcdesc}. |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 693 | \end{envdesc} |
Fred Drake | adade92 | 1999-04-22 13:05:27 +0000 | [diff] [blame] | 694 | \begin{envdesc}{methoddescni}{\op{type name}\p{name}\p{parameters}} |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 695 | Like \env{methoddesc}, but without creating any index entries. |
| 696 | \end{envdesc} |
| 697 | |
| 698 | |
Fred Drake | f1b3de8 | 2001-07-24 14:38:34 +0000 | [diff] [blame] | 699 | \subsection{Showing Code Examples \label{showing-examples}} |
Fred Drake | 5eb992b | 1999-06-11 14:25:45 +0000 | [diff] [blame] | 700 | |
| 701 | Examples of Python source code or interactive sessions are |
| 702 | represented as \env{verbatim} environments. This environment |
| 703 | is a standard part of \LaTeX{}. It is important to only use |
| 704 | spaces for indentation in code examples since \TeX{} drops tabs |
| 705 | instead of converting them to spaces. |
| 706 | |
| 707 | Representing an interactive session requires including the prompts |
| 708 | and output along with the Python code. No special markup is |
Fred Drake | 63568aa | 2000-10-19 05:36:10 +0000 | [diff] [blame] | 709 | required for interactive sessions. After the last line of input |
| 710 | or output presented, there should not be an ``unused'' primary |
| 711 | prompt; this is an example of what \emph{not} to do: |
| 712 | |
| 713 | \begin{verbatim} |
| 714 | >>> 1 + 1 |
| 715 | 2 |
Fred Drake | e7f343d | 2003-07-11 03:36:15 +0000 | [diff] [blame] | 716 | >>> |
Fred Drake | 63568aa | 2000-10-19 05:36:10 +0000 | [diff] [blame] | 717 | \end{verbatim} |
Fred Drake | 5eb992b | 1999-06-11 14:25:45 +0000 | [diff] [blame] | 718 | |
| 719 | Within the \env{verbatim} environment, characters special to |
| 720 | \LaTeX{} do not need to be specially marked in any way. The entire |
| 721 | example will be presented in a monospaced font; no attempt at |
| 722 | ``pretty-printing'' is made, as the environment must work for |
Fred Drake | 63568aa | 2000-10-19 05:36:10 +0000 | [diff] [blame] | 723 | non-Python code and non-code displays. There should be no blank |
| 724 | lines at the top or bottom of any \env{verbatim} display. |
Fred Drake | 5eb992b | 1999-06-11 14:25:45 +0000 | [diff] [blame] | 725 | |
Fred Drake | 66eed24 | 2001-06-18 14:59:58 +0000 | [diff] [blame] | 726 | Longer displays of verbatim text may be included by storing the |
| 727 | example text in an external file containing only plain text. The |
| 728 | file may be included using the standard \macro{verbatiminput} |
| 729 | macro; this macro takes a single argument naming the file |
| 730 | containing the text. For example, to include the Python source |
| 731 | file \file{example.py}, use: |
| 732 | |
| 733 | \begin{verbatim} |
| 734 | \verbatiminput{example.py} |
| 735 | \end{verbatim} |
| 736 | |
| 737 | Use of \macro{verbatiminput} allows easier use of special editing |
| 738 | modes for the included file. The file should be placed in the |
| 739 | same directory as the \LaTeX{} files for the document. |
| 740 | |
Fred Drake | 5eb992b | 1999-06-11 14:25:45 +0000 | [diff] [blame] | 741 | The Python Documentation Special Interest Group has discussed a |
| 742 | number of approaches to creating pretty-printed code displays and |
| 743 | interactive sessions; see the Doc-SIG area on the Python Web site |
| 744 | for more information on this topic. |
| 745 | |
| 746 | |
Fred Drake | f1b3de8 | 2001-07-24 14:38:34 +0000 | [diff] [blame] | 747 | \subsection{Inline Markup \label{inline-markup}} |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 748 | |
Fred Drake | 87f768e | 1999-05-17 15:22:45 +0000 | [diff] [blame] | 749 | The macros described in this section are used to mark just about |
| 750 | anything interesting in the document text. They may be used in |
| 751 | headings (though anything involving hyperlinks should be avoided |
| 752 | there) as well as in the body text. |
Fred Drake | 2f4bebd | 1999-04-28 16:43:11 +0000 | [diff] [blame] | 753 | |
| 754 | \begin{macrodesc}{bfcode}{\p{text}} |
| 755 | Like \macro{code}, but also makes the font bold-face. |
| 756 | \end{macrodesc} |
| 757 | |
| 758 | \begin{macrodesc}{cdata}{\p{name}} |
| 759 | The name of a C-language variable. |
| 760 | \end{macrodesc} |
| 761 | |
| 762 | \begin{macrodesc}{cfunction}{\p{name}} |
| 763 | The name of a C-language function. \var{name} should include the |
| 764 | function name and the trailing parentheses. |
| 765 | \end{macrodesc} |
| 766 | |
| 767 | \begin{macrodesc}{character}{\p{char}} |
| 768 | A character when discussing the character rather than a one-byte |
| 769 | string value. The character will be typeset as with \macro{samp}. |
| 770 | \end{macrodesc} |
| 771 | |
Fred Drake | 29a710f | 1999-11-10 22:51:18 +0000 | [diff] [blame] | 772 | \begin{macrodesc}{citetitle}{\op{url}\p{title}} |
| 773 | A title for a referenced publication. If \var{url} is specified, |
| 774 | the title will be made into a hyperlink when formatted as HTML. |
| 775 | \end{macrodesc} |
| 776 | |
Fred Drake | 2f4bebd | 1999-04-28 16:43:11 +0000 | [diff] [blame] | 777 | \begin{macrodesc}{class}{\p{name}} |
| 778 | A class name; a dotted name may be used. |
| 779 | \end{macrodesc} |
| 780 | |
| 781 | \begin{macrodesc}{code}{\p{text}} |
| 782 | A short code fragment or literal constant value. Typically, it |
| 783 | should not include any spaces since no quotation marks are |
| 784 | added. |
| 785 | \end{macrodesc} |
| 786 | |
| 787 | \begin{macrodesc}{constant}{\p{name}} |
| 788 | The name of a ``defined'' constant. This may be a C-language |
| 789 | \code{\#define} or a Python variable that is not intended to be |
| 790 | changed. |
| 791 | \end{macrodesc} |
| 792 | |
Fred Drake | 79bf99c | 2002-04-09 20:17:42 +0000 | [diff] [blame] | 793 | \begin{macrodesc}{csimplemacro}{\p{name}} |
| 794 | The name of a ``simple'' macro. Simple macros are macros |
| 795 | which are used for code expansion, but which do not take |
| 796 | arguments so cannot be described as functions. This is not to |
| 797 | be used for simple constant definitions. Examples of it's use |
| 798 | in the Python documentation include |
| 799 | \csimplemacro{PyObject_HEAD} and |
| 800 | \csimplemacro{Py_BEGIN_ALLOW_THREADS}. |
| 801 | \end{macrodesc} |
| 802 | |
Fred Drake | 2f4bebd | 1999-04-28 16:43:11 +0000 | [diff] [blame] | 803 | \begin{macrodesc}{ctype}{\p{name}} |
| 804 | The name of a C \keyword{typedef} or structure. For structures |
| 805 | defined without a \keyword{typedef}, use \code{\e ctype\{struct |
| 806 | struct_tag\}} to make it clear that the \keyword{struct} is |
| 807 | required. |
| 808 | \end{macrodesc} |
| 809 | |
| 810 | \begin{macrodesc}{deprecated}{\p{version}\p{what to do}} |
Fred Drake | e7f343d | 2003-07-11 03:36:15 +0000 | [diff] [blame] | 811 | Declare whatever is being described as being deprecated starting |
Fred Drake | 2f4bebd | 1999-04-28 16:43:11 +0000 | [diff] [blame] | 812 | with release \var{version}. The text given as \var{what to do} |
Fred Drake | f79f2f9 | 2002-05-21 16:27:20 +0000 | [diff] [blame] | 813 | should recommend something to use instead. It should be |
| 814 | complete sentences. The entire deprecation notice will be |
| 815 | presented as a separate paragraph; it should either preceed or |
| 816 | succeed the description of the deprecated feature. |
Fred Drake | 2f4bebd | 1999-04-28 16:43:11 +0000 | [diff] [blame] | 817 | \end{macrodesc} |
| 818 | |
| 819 | \begin{macrodesc}{dfn}{\p{term}} |
Fred Drake | e7f343d | 2003-07-11 03:36:15 +0000 | [diff] [blame] | 820 | Mark the defining instance of \var{term} in the text. (No index |
Fred Drake | 2f4bebd | 1999-04-28 16:43:11 +0000 | [diff] [blame] | 821 | entries are generated.) |
| 822 | \end{macrodesc} |
| 823 | |
Fred Drake | d1fb779 | 1999-05-17 16:33:54 +0000 | [diff] [blame] | 824 | \begin{macrodesc}{e}{} |
Fred Drake | 27da291 | 2004-02-09 21:00:29 +0000 | [diff] [blame] | 825 | Produces a backslash. This is convenient in \macro{code}, |
Fred Drake | 29f5933 | 2004-02-10 18:30:22 +0000 | [diff] [blame] | 826 | \macro{file}, and similar macros, and the \env{alltt} |
| 827 | environment, and is only defined there. To |
Fred Drake | 27da291 | 2004-02-09 21:00:29 +0000 | [diff] [blame] | 828 | create a backslash in ordinary text (such as the contents of the |
| 829 | \macro{citetitle} macro), use the standard \macro{textbackslash} |
| 830 | macro. |
Fred Drake | d1fb779 | 1999-05-17 16:33:54 +0000 | [diff] [blame] | 831 | \end{macrodesc} |
| 832 | |
Fred Drake | 2f4bebd | 1999-04-28 16:43:11 +0000 | [diff] [blame] | 833 | \begin{macrodesc}{email}{\p{address}} |
| 834 | An email address. Note that this is \emph{not} hyperlinked in |
Fred Drake | e15956b | 2000-04-03 04:51:13 +0000 | [diff] [blame] | 835 | any of the possible output formats. The domain name portion of |
| 836 | the address should be lower case. |
Fred Drake | 2f4bebd | 1999-04-28 16:43:11 +0000 | [diff] [blame] | 837 | \end{macrodesc} |
| 838 | |
| 839 | \begin{macrodesc}{emph}{\p{text}} |
| 840 | Emphasized text; this will be presented in an italic font. |
| 841 | \end{macrodesc} |
| 842 | |
| 843 | \begin{macrodesc}{envvar}{\p{name}} |
| 844 | An environment variable. Index entries are generated. |
| 845 | \end{macrodesc} |
| 846 | |
| 847 | \begin{macrodesc}{exception}{\p{name}} |
| 848 | The name of an exception. A dotted name may be used. |
| 849 | \end{macrodesc} |
| 850 | |
| 851 | \begin{macrodesc}{file}{\p{file or dir}} |
| 852 | The name of a file or directory. In the PDF and PostScript |
| 853 | outputs, single quotes and a font change are used to indicate |
| 854 | the file name, but no quotes are used in the HTML output. |
Fred Drake | 64a5aaf | 2001-10-20 04:18:14 +0000 | [diff] [blame] | 855 | \warning{The \macro{file} macro cannot be used in the |
| 856 | content of a section title due to processing limitations.} |
Fred Drake | 2f4bebd | 1999-04-28 16:43:11 +0000 | [diff] [blame] | 857 | \end{macrodesc} |
| 858 | |
| 859 | \begin{macrodesc}{filenq}{\p{file or dir}} |
| 860 | Like \macro{file}, but single quotes are never used. This can |
Fred Drake | e7f343d | 2003-07-11 03:36:15 +0000 | [diff] [blame] | 861 | be used in conjunction with tables if a column will only contain |
Fred Drake | 2f4bebd | 1999-04-28 16:43:11 +0000 | [diff] [blame] | 862 | file or directory names. |
Fred Drake | 64a5aaf | 2001-10-20 04:18:14 +0000 | [diff] [blame] | 863 | \warning{The \macro{filenq} macro cannot be used in the |
| 864 | content of a section title due to processing limitations.} |
Fred Drake | 2f4bebd | 1999-04-28 16:43:11 +0000 | [diff] [blame] | 865 | \end{macrodesc} |
| 866 | |
| 867 | \begin{macrodesc}{function}{\p{name}} |
| 868 | The name of a Python function; dotted names may be used. |
| 869 | \end{macrodesc} |
| 870 | |
Fred Drake | 432cef0 | 2001-07-06 22:34:33 +0000 | [diff] [blame] | 871 | \begin{macrodesc}{infinity}{} |
| 872 | The symbol for mathematical infinity: \infinity. Some Web |
| 873 | browsers are not able to render the HTML representation of this |
| 874 | symbol properly, but support is growing. |
| 875 | \end{macrodesc} |
| 876 | |
Fred Drake | 2f4bebd | 1999-04-28 16:43:11 +0000 | [diff] [blame] | 877 | \begin{macrodesc}{kbd}{\p{key sequence}} |
| 878 | Mark a sequence of keystrokes. What form \var{key sequence} |
| 879 | takes may depend on platform- or application-specific |
Fred Drake | 07178d2 | 2001-07-12 02:08:29 +0000 | [diff] [blame] | 880 | conventions. When there are no relevant conventions, the names |
| 881 | of modifier keys should be spelled out, to improve accessibility |
| 882 | for new users and non-native speakers. For example, an |
| 883 | \program{xemacs} key sequence may be marked like |
| 884 | \code{\e kbd\{C-x C-f\}}, but without reference to a specific |
| 885 | application or platform, the same sequence should be marked as |
| 886 | \code{\e kbd\{Control-x Control-f\}}. |
Fred Drake | 2f4bebd | 1999-04-28 16:43:11 +0000 | [diff] [blame] | 887 | \end{macrodesc} |
| 888 | |
| 889 | \begin{macrodesc}{keyword}{\p{name}} |
| 890 | The name of a keyword in a programming language. |
| 891 | \end{macrodesc} |
| 892 | |
Fred Drake | 8b3a7b5 | 2001-09-26 17:01:58 +0000 | [diff] [blame] | 893 | \begin{macrodesc}{mailheader}{\p{name}} |
| 894 | The name of an \rfc{822}-style mail header. This markup does |
| 895 | not imply that the header is being used in an email message, but |
| 896 | can be used to refer to any header of the same ``style.'' This |
| 897 | is also used for headers defined by the various MIME |
| 898 | specifications. The header name should be entered in the same |
| 899 | way it would normally be found in practice, with the |
| 900 | camel-casing conventions being preferred where there is more |
Fred Drake | 203d91a | 2001-09-26 18:43:20 +0000 | [diff] [blame] | 901 | than one common usage. The colon which follows the name of the |
| 902 | header should not be included. |
| 903 | For example: \code{\e mailheader\{Content-Type\}}. |
Fred Drake | 8b3a7b5 | 2001-09-26 17:01:58 +0000 | [diff] [blame] | 904 | \end{macrodesc} |
| 905 | |
Fred Drake | 2f4bebd | 1999-04-28 16:43:11 +0000 | [diff] [blame] | 906 | \begin{macrodesc}{makevar}{\p{name}} |
| 907 | The name of a \program{make} variable. |
| 908 | \end{macrodesc} |
| 909 | |
| 910 | \begin{macrodesc}{manpage}{\p{name}\p{section}} |
| 911 | A reference to a \UNIX{} manual page. |
| 912 | \end{macrodesc} |
| 913 | |
| 914 | \begin{macrodesc}{member}{\p{name}} |
| 915 | The name of a data attribute of an object. |
| 916 | \end{macrodesc} |
| 917 | |
| 918 | \begin{macrodesc}{method}{\p{name}} |
| 919 | The name of a method of an object. \var{name} should include the |
| 920 | method name and the trailing parentheses. A dotted name may be |
| 921 | used. |
| 922 | \end{macrodesc} |
| 923 | |
| 924 | \begin{macrodesc}{mimetype}{\p{name}} |
Fred Drake | 8b3a7b5 | 2001-09-26 17:01:58 +0000 | [diff] [blame] | 925 | The name of a MIME type, or a component of a MIME type (the |
| 926 | major or minor portion, taken alone). |
Fred Drake | 2f4bebd | 1999-04-28 16:43:11 +0000 | [diff] [blame] | 927 | \end{macrodesc} |
| 928 | |
| 929 | \begin{macrodesc}{module}{\p{name}} |
Fred Drake | 2b85341 | 2000-04-11 19:08:30 +0000 | [diff] [blame] | 930 | The name of a module; a dotted name may be used. This should |
| 931 | also be used for package names. |
Fred Drake | 2f4bebd | 1999-04-28 16:43:11 +0000 | [diff] [blame] | 932 | \end{macrodesc} |
| 933 | |
| 934 | \begin{macrodesc}{newsgroup}{\p{name}} |
Fred Drake | 9120df3 | 2001-07-14 02:34:12 +0000 | [diff] [blame] | 935 | The name of a Usenet newsgroup. |
Fred Drake | 2f4bebd | 1999-04-28 16:43:11 +0000 | [diff] [blame] | 936 | \end{macrodesc} |
| 937 | |
Fred Drake | 92350b3 | 2001-10-09 18:01:23 +0000 | [diff] [blame] | 938 | \begin{macrodesc}{note}{\p{text}} |
| 939 | An especially important bit of information about an API that a |
| 940 | user should be aware of when using whatever bit of API the |
| 941 | note pertains to. This should be the last thing in the |
| 942 | paragraph as the end of the note is not visually marked in |
Fred Drake | 64a5aaf | 2001-10-20 04:18:14 +0000 | [diff] [blame] | 943 | any way. The content of \var{text} should be written in |
| 944 | complete sentences and include all appropriate punctuation. |
Fred Drake | 92350b3 | 2001-10-09 18:01:23 +0000 | [diff] [blame] | 945 | \end{macrodesc} |
| 946 | |
Fred Drake | 432cef0 | 2001-07-06 22:34:33 +0000 | [diff] [blame] | 947 | \begin{macrodesc}{pep}{\p{number}} |
| 948 | A reference to a Python Enhancement Proposal. This generates |
| 949 | appropriate index entries. The text \samp{PEP \var{number}} is |
| 950 | generated; in the HTML output, this text is a hyperlink to an |
| 951 | online copy of the specified PEP. |
| 952 | \end{macrodesc} |
| 953 | |
| 954 | \begin{macrodesc}{plusminus}{} |
| 955 | The symbol for indicating a value that may take a positive or |
| 956 | negative value of a specified magnitude, typically represented |
| 957 | by a plus sign placed over a minus sign. For example: |
Fred Drake | 203d91a | 2001-09-26 18:43:20 +0000 | [diff] [blame] | 958 | \code{\e plusminus 3\%{}}. |
Fred Drake | 432cef0 | 2001-07-06 22:34:33 +0000 | [diff] [blame] | 959 | \end{macrodesc} |
| 960 | |
Fred Drake | 2f4bebd | 1999-04-28 16:43:11 +0000 | [diff] [blame] | 961 | \begin{macrodesc}{program}{\p{name}} |
| 962 | The name of an executable program. This may differ from the |
Fred Drake | e7f343d | 2003-07-11 03:36:15 +0000 | [diff] [blame] | 963 | file name for the executable for some platforms. In particular, |
| 964 | the \file{.exe} (or other) extension should be omitted for |
Martin v. Löwis | 36a4d8c | 2002-10-10 18:24:54 +0000 | [diff] [blame] | 965 | Windows programs. |
Fred Drake | 2f4bebd | 1999-04-28 16:43:11 +0000 | [diff] [blame] | 966 | \end{macrodesc} |
| 967 | |
Fred Drake | 29a710f | 1999-11-10 22:51:18 +0000 | [diff] [blame] | 968 | \begin{macrodesc}{programopt}{\p{option}} |
Fred Drake | ce44498 | 2000-04-11 18:52:52 +0000 | [diff] [blame] | 969 | A command-line option to an executable program. Use this only |
Greg Ward | 8b46c71 | 2002-06-29 01:23:45 +0000 | [diff] [blame] | 970 | for ``short'' options, and include the leading hyphen. |
Fred Drake | ce44498 | 2000-04-11 18:52:52 +0000 | [diff] [blame] | 971 | \end{macrodesc} |
| 972 | |
| 973 | \begin{macrodesc}{longprogramopt}{\p{option}} |
| 974 | A long command-line option to an executable program. This |
| 975 | should only be used for long option names which will be prefixed |
| 976 | by two hyphens; the hyphens should not be provided as part of |
| 977 | \var{option}. |
Fred Drake | 29a710f | 1999-11-10 22:51:18 +0000 | [diff] [blame] | 978 | \end{macrodesc} |
| 979 | |
Fred Drake | 2f4bebd | 1999-04-28 16:43:11 +0000 | [diff] [blame] | 980 | \begin{macrodesc}{refmodule}{\op{key}\p{name}} |
Fred Drake | e7f343d | 2003-07-11 03:36:15 +0000 | [diff] [blame] | 981 | Like \macro{module}, but create a hyperlink to the documentation |
Fred Drake | 2f4bebd | 1999-04-28 16:43:11 +0000 | [diff] [blame] | 982 | for the named module. Note that the corresponding |
| 983 | \macro{declaremodule} must be in the same document. If the |
| 984 | \macro{declaremodule} defines a module key different from the |
| 985 | module name, it must also be provided as \var{key} to the |
| 986 | \macro{refmodule} macro. |
| 987 | \end{macrodesc} |
| 988 | |
| 989 | \begin{macrodesc}{regexp}{\p{string}} |
| 990 | Mark a regular expression. |
| 991 | \end{macrodesc} |
| 992 | |
| 993 | \begin{macrodesc}{rfc}{\p{number}} |
Fred Drake | e7f343d | 2003-07-11 03:36:15 +0000 | [diff] [blame] | 994 | A reference to an Internet Request for Comments. This generates |
Fred Drake | 2f4bebd | 1999-04-28 16:43:11 +0000 | [diff] [blame] | 995 | appropriate index entries. The text \samp{RFC \var{number}} is |
| 996 | generated; in the HTML output, this text is a hyperlink to an |
| 997 | online copy of the specified RFC. |
| 998 | \end{macrodesc} |
| 999 | |
| 1000 | \begin{macrodesc}{samp}{\p{text}} |
| 1001 | A short code sample, but possibly longer than would be given |
Fred Drake | e7f343d | 2003-07-11 03:36:15 +0000 | [diff] [blame] | 1002 | using \macro{code}. Since quotation marks are added, spaces are |
Fred Drake | 2f4bebd | 1999-04-28 16:43:11 +0000 | [diff] [blame] | 1003 | acceptable. |
| 1004 | \end{macrodesc} |
| 1005 | |
Fred Drake | af2b714 | 2000-09-14 20:11:05 +0000 | [diff] [blame] | 1006 | \begin{macrodesc}{shortversion}{} |
| 1007 | The ``short'' version number of the documented software, as |
| 1008 | specified using the \macro{setshortversion} macro in the |
| 1009 | preamble. For Python, the short version number for a release is |
| 1010 | the first three characters of the \code{sys.version} value. For |
| 1011 | example, versions 2.0b1 and 2.0.1 both have a short version of |
| 1012 | 2.0. This may not apply for all packages; if |
| 1013 | \macro{setshortversion} is not used, this produces an empty |
| 1014 | expansion. See also the \macro{version} macro. |
| 1015 | \end{macrodesc} |
| 1016 | |
Fred Drake | 2f4bebd | 1999-04-28 16:43:11 +0000 | [diff] [blame] | 1017 | \begin{macrodesc}{strong}{\p{text}} |
| 1018 | Strongly emphasized text; this will be presented using a bold |
| 1019 | font. |
| 1020 | \end{macrodesc} |
| 1021 | |
Fred Drake | 432cef0 | 2001-07-06 22:34:33 +0000 | [diff] [blame] | 1022 | \begin{macrodesc}{ulink}{\p{text}\p{url}} |
| 1023 | A hypertext link with a target specified by a URL, but for which |
| 1024 | the link text should not be the title of the resource. For |
| 1025 | resources being referenced by name, use the \macro{citetitle} |
| 1026 | macro. Not all formatted versions support arbitrary hypertext |
| 1027 | links. Note that many characters are special to \LaTeX{} and |
| 1028 | this macro does not always do the right thing. In particular, |
| 1029 | the tilde character (\character{\~}) is mis-handled; encoding it |
| 1030 | as a hex-sequence does work, use \samp{\%7e} in place of the |
| 1031 | tilde character. |
| 1032 | \end{macrodesc} |
| 1033 | |
Fred Drake | d1fb779 | 1999-05-17 16:33:54 +0000 | [diff] [blame] | 1034 | \begin{macrodesc}{url}{\p{url}} |
Fred Drake | e7f343d | 2003-07-11 03:36:15 +0000 | [diff] [blame] | 1035 | A URL (or URN). The URL will be presented as text. In the HTML |
Fred Drake | d1fb779 | 1999-05-17 16:33:54 +0000 | [diff] [blame] | 1036 | and PDF formatted versions, the URL will also be a hyperlink. |
Fred Drake | 432cef0 | 2001-07-06 22:34:33 +0000 | [diff] [blame] | 1037 | This can be used when referring to external resources without |
| 1038 | specific titles; references to resources which have titles |
| 1039 | should be marked using the \macro{citetitle} macro. See the |
| 1040 | comments about special characters in the description of the |
| 1041 | \macro{ulink} macro for special considerations. |
Fred Drake | d1fb779 | 1999-05-17 16:33:54 +0000 | [diff] [blame] | 1042 | \end{macrodesc} |
| 1043 | |
Fred Drake | 2f4bebd | 1999-04-28 16:43:11 +0000 | [diff] [blame] | 1044 | \begin{macrodesc}{var}{\p{name}} |
| 1045 | The name of a variable or formal parameter in running text. |
| 1046 | \end{macrodesc} |
| 1047 | |
| 1048 | \begin{macrodesc}{version}{} |
Fred Drake | af2b714 | 2000-09-14 20:11:05 +0000 | [diff] [blame] | 1049 | The version number of the described software, as specified using |
| 1050 | \macro{release} in the preamble. See also the |
| 1051 | \macro{shortversion} macro. |
Fred Drake | 2f4bebd | 1999-04-28 16:43:11 +0000 | [diff] [blame] | 1052 | \end{macrodesc} |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 1053 | |
Fred Drake | 92350b3 | 2001-10-09 18:01:23 +0000 | [diff] [blame] | 1054 | \begin{macrodesc}{warning}{\p{text}} |
| 1055 | An important bit of information about an API that a user should |
| 1056 | be very aware of when using whatever bit of API the warning |
| 1057 | pertains to. This should be the last thing in the paragraph as |
Fred Drake | 64a5aaf | 2001-10-20 04:18:14 +0000 | [diff] [blame] | 1058 | the end of the warning is not visually marked in any way. The |
| 1059 | content of \var{text} should be written in complete sentences |
| 1060 | and include all appropriate punctuation. This differs from |
| 1061 | \macro{note} in that it is recommended over \macro{note} for |
| 1062 | information regarding security. |
Fred Drake | 92350b3 | 2001-10-09 18:01:23 +0000 | [diff] [blame] | 1063 | \end{macrodesc} |
| 1064 | |
Fred Drake | c0ed9c4 | 2004-07-13 21:04:26 +0000 | [diff] [blame] | 1065 | The following two macros are used to describe information that's |
| 1066 | associated with changes from one release to another. For features |
| 1067 | which are described by a single paragraph, these are typically |
| 1068 | added as separate source lines at the end of the paragraph. When |
| 1069 | adding these to features described by multiple paragraphs, they |
| 1070 | are usually collected in a single separate paragraph after the |
| 1071 | description. When both \macro{versionadded} and |
| 1072 | \macro{versionchanged} are used, \macro{versionadded} should come |
| 1073 | first; the versions should be listed in chronological order. Both |
| 1074 | of these should come before availability statements. The location |
| 1075 | should be selected so the explanation makes sense and may vary as |
| 1076 | needed. |
| 1077 | |
| 1078 | \begin{macrodesc}{versionadded}{\op{explanation}\p{version}} |
| 1079 | The version of Python which added the described feature to the |
| 1080 | library or C API. \var{explanation} should be a \emph{brief} |
| 1081 | explanation of the change consisting of a capitalized sentence |
| 1082 | fragment; a period will be appended by the formatting process. |
| 1083 | When this applies to an entire module, it should be placed at |
| 1084 | the top of the module section before any prose. |
| 1085 | \end{macrodesc} |
| 1086 | |
| 1087 | \begin{macrodesc}{versionchanged}{\op{explanation}\p{version}} |
| 1088 | The version of Python in which the named feature was changed in |
| 1089 | some way (new parameters, changed side effects, etc.). |
| 1090 | \var{explanation} should be a \emph{brief} explanation of the |
| 1091 | change consisting of a capitalized sentence fragment; a |
| 1092 | period will be appended by the formatting process. This should |
| 1093 | not generally be applied to modules. |
| 1094 | \end{macrodesc} |
| 1095 | |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 1096 | |
Fred Drake | 6ca3377 | 2001-12-14 22:50:06 +0000 | [diff] [blame] | 1097 | \subsection{Miscellaneous Text Markup \label{misc-text-markup}} |
| 1098 | |
| 1099 | In addition to the inline markup, some additional ``block'' markup |
| 1100 | is defined to make it easier to bring attention to various bits of |
| 1101 | text. The markup described here serves this purpose, and is |
| 1102 | intended to be used when marking one or more paragraphs or other |
| 1103 | block constructs (such as \env{verbatim} environments). |
| 1104 | |
| 1105 | \begin{envdesc}{notice}{\op{type}} |
| 1106 | Label some paragraphs as being worthy of additional attention from |
| 1107 | the reader. What sort of attention is warrented can be indicated |
| 1108 | by specifying the \var{type} of the notice. The only values |
| 1109 | defined for \var{type} are \code{note} and \code{warning}; these |
| 1110 | are equivalent in intent to the inline markup of the same name. |
| 1111 | If \var{type} is omitted, \code{note} is used. Additional values |
| 1112 | may be defined in the future. |
| 1113 | \end{envdesc} |
| 1114 | |
| 1115 | |
Fred Drake | f1b3de8 | 2001-07-24 14:38:34 +0000 | [diff] [blame] | 1116 | \subsection{Module-specific Markup \label{module-markup}} |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 1117 | |
| 1118 | The markup described in this section is used to provide information |
| 1119 | about a module being documented. A typical use of this markup |
| 1120 | appears at the top of the section used to document a module. A |
| 1121 | typical example might look like this: |
| 1122 | |
| 1123 | \begin{verbatim} |
| 1124 | \section{\module{spam} --- |
| 1125 | Access to the SPAM facility} |
| 1126 | |
| 1127 | \declaremodule{extension}{spam} |
Fred Drake | 2c4e009 | 1999-03-29 14:55:55 +0000 | [diff] [blame] | 1128 | \platform{Unix} |
Fred Drake | 9120df3 | 2001-07-14 02:34:12 +0000 | [diff] [blame] | 1129 | \modulesynopsis{Access to the SPAM facility of \UNIX.} |
Fred Drake | 2c4e009 | 1999-03-29 14:55:55 +0000 | [diff] [blame] | 1130 | \moduleauthor{Jane Doe}{jane.doe@frobnitz.org} |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 1131 | \end{verbatim} |
| 1132 | |
Fred Drake | 7932ed0 | 2000-08-11 17:37:33 +0000 | [diff] [blame] | 1133 | Python packages\index{packages} --- collections of modules that can |
| 1134 | be described as a unit --- are documented using the same markup as |
| 1135 | modules. The name for a module in a package should be typed in |
Fred Drake | 432cef0 | 2001-07-06 22:34:33 +0000 | [diff] [blame] | 1136 | ``fully qualified'' form (it should include the package name). |
Fred Drake | 7932ed0 | 2000-08-11 17:37:33 +0000 | [diff] [blame] | 1137 | For example, a module ``foo'' in package ``bar'' should be marked as |
Fred Drake | 203d91a | 2001-09-26 18:43:20 +0000 | [diff] [blame] | 1138 | \code{\e module\{bar.foo\}}, and the beginning of the reference |
Fred Drake | 7932ed0 | 2000-08-11 17:37:33 +0000 | [diff] [blame] | 1139 | section would appear as: |
| 1140 | |
| 1141 | \begin{verbatim} |
| 1142 | \section{\module{bar.foo} --- |
| 1143 | Module from the \module{bar} package} |
| 1144 | |
| 1145 | \declaremodule{extension}{bar.foo} |
| 1146 | \modulesynopsis{Nifty module from the \module{bar} package.} |
| 1147 | \moduleauthor{Jane Doe}{jane.doe@frobnitz.org} |
| 1148 | \end{verbatim} |
| 1149 | |
| 1150 | Note that the name of a package is also marked using |
| 1151 | \macro{module}. |
| 1152 | |
Fred Drake | adade92 | 1999-04-22 13:05:27 +0000 | [diff] [blame] | 1153 | \begin{macrodesc}{declaremodule}{\op{key}\p{type}\p{name}} |
Fred Drake | 87f768e | 1999-05-17 15:22:45 +0000 | [diff] [blame] | 1154 | Requires two parameters: module type (\samp{standard}, |
| 1155 | \samp{builtin}, \samp{extension}, or \samp{}), and the module |
| 1156 | name. An optional parameter should be given as the basis for the |
| 1157 | module's ``key'' used for linking to or referencing the section. |
| 1158 | The ``key'' should only be given if the module's name contains any |
| 1159 | underscores, and should be the name with the underscores stripped. |
| 1160 | Note that the \var{type} parameter must be one of the values |
| 1161 | listed above or an error will be printed. For modules which are |
| 1162 | contained in packages, the fully-qualified name should be given as |
| 1163 | \var{name} parameter. This should be the first thing after the |
| 1164 | \macro{section} used to introduce the module. |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 1165 | \end{macrodesc} |
| 1166 | |
Fred Drake | adade92 | 1999-04-22 13:05:27 +0000 | [diff] [blame] | 1167 | \begin{macrodesc}{platform}{\p{specifier}} |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 1168 | Specifies the portability of the module. \var{specifier} is a |
| 1169 | comma-separated list of keys that specify what platforms the |
| 1170 | module is available on. The keys are short identifiers; |
| 1171 | examples that are in use include \samp{IRIX}, \samp{Mac}, |
| 1172 | \samp{Windows}, and \samp{Unix}. It is important to use a key |
Fred Drake | 7a737df | 1999-04-23 14:41:44 +0000 | [diff] [blame] | 1173 | which has already been used when applicable. This is used to |
| 1174 | provide annotations in the Module Index and the HTML and GNU info |
| 1175 | output. |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 1176 | \end{macrodesc} |
| 1177 | |
Fred Drake | adade92 | 1999-04-22 13:05:27 +0000 | [diff] [blame] | 1178 | \begin{macrodesc}{modulesynopsis}{\p{text}} |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 1179 | The \var{text} is a short, ``one line'' description of the |
| 1180 | module that can be used as part of the chapter introduction. |
Fred Drake | adade92 | 1999-04-22 13:05:27 +0000 | [diff] [blame] | 1181 | This is must be placed after \macro{declaremodule}. |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 1182 | The synopsis is used in building the contents of the table |
| 1183 | inserted as the \macro{localmoduletable}. No text is |
| 1184 | produced at the point of the markup. |
| 1185 | \end{macrodesc} |
| 1186 | |
Fred Drake | adade92 | 1999-04-22 13:05:27 +0000 | [diff] [blame] | 1187 | \begin{macrodesc}{moduleauthor}{\p{name}\p{email}} |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 1188 | This macro is used to encode information about who authored a |
| 1189 | module. This is currently not used to generate output, but can be |
| 1190 | used to help determine the origin of the module. |
| 1191 | \end{macrodesc} |
| 1192 | |
| 1193 | |
Fred Drake | f1b3de8 | 2001-07-24 14:38:34 +0000 | [diff] [blame] | 1194 | \subsection{Library-level Markup \label{library-markup}} |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 1195 | |
| 1196 | This markup is used when describing a selection of modules. For |
Fred Drake | 698d520 | 1999-11-10 15:54:57 +0000 | [diff] [blame] | 1197 | example, the \citetitle[../mac/mac.html]{Macintosh Library |
| 1198 | Modules} document uses this to help provide an overview of the |
| 1199 | modules in the collection, and many chapters in the |
| 1200 | \citetitle[../lib/lib.html]{Python Library Reference} use it for |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 1201 | the same purpose. |
| 1202 | |
| 1203 | \begin{macrodesc}{localmoduletable}{} |
Fred Drake | 2c4e009 | 1999-03-29 14:55:55 +0000 | [diff] [blame] | 1204 | If a \file{.syn} file exists for the current |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 1205 | chapter (or for the entire document in \code{howto} documents), a |
| 1206 | \env{synopsistable} is created with the contents loaded from the |
| 1207 | \file{.syn} file. |
| 1208 | \end{macrodesc} |
| 1209 | |
| 1210 | |
Fred Drake | f1b3de8 | 2001-07-24 14:38:34 +0000 | [diff] [blame] | 1211 | \subsection{Table Markup \label{table-markup}} |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 1212 | |
| 1213 | There are three general-purpose table environments defined which |
| 1214 | should be used whenever possible. These environments are defined |
| 1215 | to provide tables of specific widths and some convenience for |
| 1216 | formatting. These environments are not meant to be general |
| 1217 | replacements for the standard \LaTeX{} table environments, but can |
| 1218 | be used for an advantage when the documents are processed using |
| 1219 | the tools for Python documentation processing. In particular, the |
| 1220 | generated HTML looks good! There is also an advantage for the |
Fred Drake | 67f193f | 2001-07-09 16:04:03 +0000 | [diff] [blame] | 1221 | eventual conversion of the documentation to XML (see section |
Fred Drake | 2c4e009 | 1999-03-29 14:55:55 +0000 | [diff] [blame] | 1222 | \ref{futures}, ``Future Directions''). |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 1223 | |
| 1224 | Each environment is named \env{table\var{cols}}, where \var{cols} |
| 1225 | is the number of columns in the table specified in lower-case |
| 1226 | Roman numerals. Within each of these environments, an additional |
| 1227 | macro, \macro{line\var{cols}}, is defined, where \var{cols} |
| 1228 | matches the \var{cols} value of the corresponding table |
Fred Drake | 2c4e009 | 1999-03-29 14:55:55 +0000 | [diff] [blame] | 1229 | environment. These are supported for \var{cols} values of |
| 1230 | \code{ii}, \code{iii}, and \code{iv}. These environments are all |
Fred Drake | da72b93 | 2000-09-21 15:58:02 +0000 | [diff] [blame] | 1231 | built on top of the \env{tabular} environment. Variants based on |
| 1232 | the \env{longtable} environment are also provided. |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 1233 | |
Fred Drake | 2b85341 | 2000-04-11 19:08:30 +0000 | [diff] [blame] | 1234 | Note that all tables in the standard Python documentation use |
| 1235 | vertical lines between columns, and this must be specified in the |
| 1236 | markup for each table. A general border around the outside of the |
| 1237 | table is not used, but would be the responsibility of the |
Fred Drake | da72b93 | 2000-09-21 15:58:02 +0000 | [diff] [blame] | 1238 | processor; the document markup should not include an exterior |
| 1239 | border. |
| 1240 | |
| 1241 | The \env{longtable}-based variants of the table environments are |
| 1242 | formatted with extra space before and after, so should only be |
| 1243 | used on tables which are long enough that splitting over multiple |
| 1244 | pages is reasonable; tables with fewer than twenty rows should |
| 1245 | never by marked using the long flavors of the table environments. |
| 1246 | The header row is repeated across the top of each part of the |
| 1247 | table. |
Fred Drake | 2b85341 | 2000-04-11 19:08:30 +0000 | [diff] [blame] | 1248 | |
Fred Drake | adade92 | 1999-04-22 13:05:27 +0000 | [diff] [blame] | 1249 | \begin{envdesc}{tableii}{\p{colspec}\p{col1font}\p{heading1}\p{heading2}} |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 1250 | Create a two-column table using the \LaTeX{} column specifier |
| 1251 | \var{colspec}. The column specifier should indicate vertical |
| 1252 | bars between columns as appropriate for the specific table, but |
| 1253 | should not specify vertical bars on the outside of the table |
| 1254 | (that is considered a stylesheet issue). The \var{col1font} |
| 1255 | parameter is used as a stylistic treatment of the first column |
| 1256 | of the table: the first column is presented as |
| 1257 | \code{\e\var{col1font}\{column1\}}. To avoid treating the first |
Fred Drake | adade92 | 1999-04-22 13:05:27 +0000 | [diff] [blame] | 1258 | column specially, \var{col1font} may be \samp{textrm}. The |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 1259 | column headings are taken from the values \var{heading1} and |
| 1260 | \var{heading2}. |
| 1261 | \end{envdesc} |
| 1262 | |
Fred Drake | da72b93 | 2000-09-21 15:58:02 +0000 | [diff] [blame] | 1263 | \begin{envdesc}{longtableii}{\unspecified} |
| 1264 | Like \env{tableii}, but produces a table which may be broken |
| 1265 | across page boundaries. The parameters are the same as for |
| 1266 | \env{tableii}. |
| 1267 | \end{envdesc} |
| 1268 | |
Fred Drake | adade92 | 1999-04-22 13:05:27 +0000 | [diff] [blame] | 1269 | \begin{macrodesc}{lineii}{\p{column1}\p{column2}} |
Fred Drake | da72b93 | 2000-09-21 15:58:02 +0000 | [diff] [blame] | 1270 | Create a single table row within a \env{tableii} or |
| 1271 | \env{longtableii} environment. |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 1272 | The text for the first column will be generated by applying the |
| 1273 | macro named by the \var{col1font} value when the \env{tableii} |
| 1274 | was opened. |
| 1275 | \end{macrodesc} |
| 1276 | |
Fred Drake | adade92 | 1999-04-22 13:05:27 +0000 | [diff] [blame] | 1277 | \begin{envdesc}{tableiii}{\p{colspec}\p{col1font}\p{heading1}\p{heading2}\p{heading3}} |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 1278 | Like the \env{tableii} environment, but with a third column. |
| 1279 | The heading for the third column is given by \var{heading3}. |
| 1280 | \end{envdesc} |
| 1281 | |
Fred Drake | da72b93 | 2000-09-21 15:58:02 +0000 | [diff] [blame] | 1282 | \begin{envdesc}{longtableiii}{\unspecified} |
| 1283 | Like \env{tableiii}, but produces a table which may be broken |
| 1284 | across page boundaries. The parameters are the same as for |
| 1285 | \env{tableiii}. |
| 1286 | \end{envdesc} |
| 1287 | |
Fred Drake | adade92 | 1999-04-22 13:05:27 +0000 | [diff] [blame] | 1288 | \begin{macrodesc}{lineiii}{\p{column1}\p{column2}\p{column3}} |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 1289 | Like the \macro{lineii} macro, but with a third column. The |
| 1290 | text for the third column is given by \var{column3}. |
| 1291 | \end{macrodesc} |
| 1292 | |
Fred Drake | adade92 | 1999-04-22 13:05:27 +0000 | [diff] [blame] | 1293 | \begin{envdesc}{tableiv}{\p{colspec}\p{col1font}\p{heading1}\p{heading2}\p{heading3}\p{heading4}} |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 1294 | Like the \env{tableiii} environment, but with a fourth column. |
| 1295 | The heading for the fourth column is given by \var{heading4}. |
| 1296 | \end{envdesc} |
| 1297 | |
Fred Drake | da72b93 | 2000-09-21 15:58:02 +0000 | [diff] [blame] | 1298 | \begin{envdesc}{longtableiv}{\unspecified} |
| 1299 | Like \env{tableiv}, but produces a table which may be broken |
| 1300 | across page boundaries. The parameters are the same as for |
| 1301 | \env{tableiv}. |
| 1302 | \end{envdesc} |
| 1303 | |
Fred Drake | adade92 | 1999-04-22 13:05:27 +0000 | [diff] [blame] | 1304 | \begin{macrodesc}{lineiv}{\p{column1}\p{column2}\p{column3}\p{column4}} |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 1305 | Like the \macro{lineiii} macro, but with a fourth column. The |
| 1306 | text for the fourth column is given by \var{column4}. |
| 1307 | \end{macrodesc} |
| 1308 | |
Fred Drake | f269e59 | 2001-07-17 23:05:57 +0000 | [diff] [blame] | 1309 | \begin{envdesc}{tablev}{\p{colspec}\p{col1font}\p{heading1}\p{heading2}\p{heading3}\p{heading4}\p{heading5}} |
| 1310 | Like the \env{tableiv} environment, but with a fifth column. |
| 1311 | The heading for the fifth column is given by \var{heading5}. |
| 1312 | \end{envdesc} |
| 1313 | |
| 1314 | \begin{envdesc}{longtablev}{\unspecified} |
| 1315 | Like \env{tablev}, but produces a table which may be broken |
| 1316 | across page boundaries. The parameters are the same as for |
| 1317 | \env{tablev}. |
| 1318 | \end{envdesc} |
| 1319 | |
| 1320 | \begin{macrodesc}{linev}{\p{column1}\p{column2}\p{column3}\p{column4}\p{column5}} |
| 1321 | Like the \macro{lineiv} macro, but with a fifth column. The |
| 1322 | text for the fifth column is given by \var{column5}. |
| 1323 | \end{macrodesc} |
| 1324 | |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 1325 | |
| 1326 | An additional table-like environment is \env{synopsistable}. The |
| 1327 | table generated by this environment contains two columns, and each |
| 1328 | row is defined by an alternate definition of |
Fred Drake | e15956b | 2000-04-03 04:51:13 +0000 | [diff] [blame] | 1329 | \macro{modulesynopsis}. This environment is not normally used by |
| 1330 | authors, but is created by the \macro{localmoduletable} macro. |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 1331 | |
Fred Drake | 0cac5f6 | 2001-08-14 21:36:19 +0000 | [diff] [blame] | 1332 | Here is a small example of a table given in the documentation for |
| 1333 | the \module{warnings} module; markup inside the table cells is |
| 1334 | minimal so the markup for the table itself is readily discernable. |
| 1335 | Here is the markup for the table: |
| 1336 | |
| 1337 | \begin{verbatim} |
| 1338 | \begin{tableii}{l|l}{exception}{Class}{Description} |
| 1339 | \lineii{Warning} |
| 1340 | {This is the base class of all warning category classes. It |
| 1341 | is a subclass of \exception{Exception}.} |
| 1342 | \lineii{UserWarning} |
| 1343 | {The default category for \function{warn()}.} |
| 1344 | \lineii{DeprecationWarning} |
| 1345 | {Base category for warnings about deprecated features.} |
| 1346 | \lineii{SyntaxWarning} |
| 1347 | {Base category for warnings about dubious syntactic |
| 1348 | features.} |
| 1349 | \lineii{RuntimeWarning} |
| 1350 | {Base category for warnings about dubious runtime features.} |
Barry Warsaw | b8c20a7 | 2002-08-14 16:40:54 +0000 | [diff] [blame] | 1351 | \lineii{FutureWarning} |
Fred Drake | e7f343d | 2003-07-11 03:36:15 +0000 | [diff] [blame] | 1352 | {Base category for warnings about constructs that will change |
| 1353 | semantically in the future.} |
Fred Drake | 0cac5f6 | 2001-08-14 21:36:19 +0000 | [diff] [blame] | 1354 | \end{tableii} |
| 1355 | \end{verbatim} |
| 1356 | |
| 1357 | Here is the resulting table: |
| 1358 | |
| 1359 | \begin{tableii}{l|l}{exception}{Class}{Description} |
| 1360 | \lineii{Warning} |
| 1361 | {This is the base class of all warning category classes. It |
| 1362 | is a subclass of \exception{Exception}.} |
| 1363 | \lineii{UserWarning} |
| 1364 | {The default category for \function{warn()}.} |
| 1365 | \lineii{DeprecationWarning} |
| 1366 | {Base category for warnings about deprecated features.} |
| 1367 | \lineii{SyntaxWarning} |
| 1368 | {Base category for warnings about dubious syntactic |
| 1369 | features.} |
| 1370 | \lineii{RuntimeWarning} |
| 1371 | {Base category for warnings about dubious runtime features.} |
| 1372 | \end{tableii} |
| 1373 | |
| 1374 | Note that the class names are implicitly marked using the |
| 1375 | \macro{exception} macro, since that is given as the \var{col1font} |
| 1376 | value for the \env{tableii} environment. To create a table using |
| 1377 | different markup for the first column, use \code{textrm} for the |
| 1378 | \var{col1font} value and mark each entry individually. |
| 1379 | |
| 1380 | To add a horizontal line between vertical sections of a table, use |
| 1381 | the standard \macro{hline} macro between the rows which should be |
| 1382 | separated: |
| 1383 | |
| 1384 | \begin{verbatim} |
| 1385 | \begin{tableii}{l|l}{constant}{Language}{Audience} |
| 1386 | \lineii{APL}{Masochists.} |
| 1387 | \lineii{BASIC}{First-time programmers on PC hardware.} |
| 1388 | \lineii{C}{\UNIX{} \&\ Linux kernel developers.} |
| 1389 | \hline |
| 1390 | \lineii{Python}{Everyone!} |
| 1391 | \end{tableii} |
| 1392 | \end{verbatim} |
| 1393 | |
| 1394 | Note that not all presentation formats are capable of displaying a |
| 1395 | horizontal rule in this position. This is how the table looks in |
| 1396 | the format you're reading now: |
| 1397 | |
| 1398 | \begin{tableii}{l|l}{constant}{Language}{Audience} |
| 1399 | \lineii{APL}{Masochists.} |
| 1400 | \lineii{C}{\UNIX{} \&\ Linux kernel developers.} |
| 1401 | \lineii{JavaScript}{Web developers.} |
| 1402 | \hline |
| 1403 | \lineii{Python}{Everyone!} |
| 1404 | \end{tableii} |
| 1405 | |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 1406 | |
| 1407 | \subsection{Reference List Markup \label{references}} |
| 1408 | |
| 1409 | Many sections include a list of references to module documentation |
| 1410 | or external documents. These lists are created using the |
Fred Drake | 5ed35fd | 2001-11-30 18:09:54 +0000 | [diff] [blame] | 1411 | \env{seealso} or \env{seealso*} environments. These environments |
| 1412 | define some additional macros to support creating reference |
| 1413 | entries in a reasonable manner. |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 1414 | |
Fred Drake | 5802e48 | 2000-07-06 05:24:41 +0000 | [diff] [blame] | 1415 | The \env{seealso} environment is typically placed in a section |
| 1416 | just before any sub-sections. This is done to ensure that |
| 1417 | reference links related to the section are not hidden in a |
Fred Drake | 5ed35fd | 2001-11-30 18:09:54 +0000 | [diff] [blame] | 1418 | subsection in the hypertext renditions of the documentation. For |
| 1419 | the HTML output, it is shown as a ``side bar,'' boxed off from the |
| 1420 | main flow of the text. The \env{seealso*} environment is |
| 1421 | different in that it should be used when a list of references is |
| 1422 | being presented as part of the primary content; it is not |
| 1423 | specially set off from the text. |
Fred Drake | 5802e48 | 2000-07-06 05:24:41 +0000 | [diff] [blame] | 1424 | |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 1425 | \begin{envdesc}{seealso}{} |
| 1426 | This environment creates a ``See also:'' heading and defines the |
| 1427 | markup used to describe individual references. |
| 1428 | \end{envdesc} |
| 1429 | |
Fred Drake | 5ed35fd | 2001-11-30 18:09:54 +0000 | [diff] [blame] | 1430 | \begin{envdesc}{seealso*}{} |
| 1431 | This environment is used to create a list of references which |
| 1432 | form part of the main content. It is not given a special |
| 1433 | header and is not set off from the main flow of the text. It |
| 1434 | provides the same additional markup used to describe individual |
| 1435 | references. |
| 1436 | \end{envdesc} |
| 1437 | |
Fred Drake | 4844998 | 2000-09-12 17:52:33 +0000 | [diff] [blame] | 1438 | For each of the following macros, \var{why} should be one or more |
| 1439 | complete sentences, starting with a capital letter (unless it |
| 1440 | starts with an identifier, which should not be modified), and |
Fred Drake | 4f687b3 | 2004-01-08 14:57:27 +0000 | [diff] [blame] | 1441 | ending with the appropriate punctuation. |
Fred Drake | 5802e48 | 2000-07-06 05:24:41 +0000 | [diff] [blame] | 1442 | |
Fred Drake | b7cf378 | 2000-09-12 19:58:10 +0000 | [diff] [blame] | 1443 | These macros are only defined within the content of the |
Fred Drake | 5ed35fd | 2001-11-30 18:09:54 +0000 | [diff] [blame] | 1444 | \env{seealso} and \env{seealso*} environments. |
Fred Drake | b7cf378 | 2000-09-12 19:58:10 +0000 | [diff] [blame] | 1445 | |
Fred Drake | 4f687b3 | 2004-01-08 14:57:27 +0000 | [diff] [blame] | 1446 | \begin{macrodesc}{seelink}{\p{url}\p{linktext}\p{why}} |
| 1447 | References to specific on-line resources should be given using |
| 1448 | the \macro{seelink} macro if they don't have a meaningful title |
| 1449 | but there is some short description of what's at the end of the |
| 1450 | link. Online documents which have identifiable titles should be |
| 1451 | referenced using the \macro{seetitle} macro, using the optional |
| 1452 | parameter to that macro to provide the URL. |
| 1453 | \end{macrodesc} |
| 1454 | |
Fred Drake | adade92 | 1999-04-22 13:05:27 +0000 | [diff] [blame] | 1455 | \begin{macrodesc}{seemodule}{\op{key}\p{name}\p{why}} |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 1456 | Refer to another module. \var{why} should be a brief |
| 1457 | explanation of why the reference may be interesting. The module |
| 1458 | name is given in \var{name}, with the link key given in |
| 1459 | \var{key} if necessary. In the HTML and PDF conversions, the |
| 1460 | module name will be a hyperlink to the referred-to module. |
Fred Drake | 64a5aaf | 2001-10-20 04:18:14 +0000 | [diff] [blame] | 1461 | \note{The module must be documented in the same |
| 1462 | document (the corresponding \macro{declaremodule} is required).} |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 1463 | \end{macrodesc} |
| 1464 | |
Fred Drake | 08c5d0c | 2000-09-11 05:22:30 +0000 | [diff] [blame] | 1465 | \begin{macrodesc}{seepep}{\p{number}\p{title}\p{why}} |
| 1466 | Refer to an Python Enhancement Proposal (PEP). \var{number} |
| 1467 | should be the official number assigned by the PEP Editor, |
| 1468 | \var{title} should be the human-readable title of the PEP as |
Fred Drake | 5802e48 | 2000-07-06 05:24:41 +0000 | [diff] [blame] | 1469 | found in the official copy of the document, and \var{why} should |
Fred Drake | 08c5d0c | 2000-09-11 05:22:30 +0000 | [diff] [blame] | 1470 | explain what's interesting about the PEP. This should be used |
| 1471 | to refer the reader to PEPs which specify interfaces or language |
| 1472 | features relevant to the material in the annotated section of the |
| 1473 | documentation. |
| 1474 | \end{macrodesc} |
| 1475 | |
| 1476 | \begin{macrodesc}{seerfc}{\p{number}\p{title}\p{why}} |
| 1477 | Refer to an IETF Request for Comments (RFC). Otherwise very |
| 1478 | similar to \macro{seepep}. This should be used |
| 1479 | to refer the reader to PEPs which specify protocols or data |
Fred Drake | 5802e48 | 2000-07-06 05:24:41 +0000 | [diff] [blame] | 1480 | formats relevant to the material in the annotated section of the |
| 1481 | documentation. |
| 1482 | \end{macrodesc} |
| 1483 | |
Fred Drake | adade92 | 1999-04-22 13:05:27 +0000 | [diff] [blame] | 1484 | \begin{macrodesc}{seetext}{\p{text}} |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 1485 | Add arbitrary text \var{text} to the ``See also:'' list. This |
| 1486 | can be used to refer to off-line materials or on-line materials |
Fred Drake | 5802e48 | 2000-07-06 05:24:41 +0000 | [diff] [blame] | 1487 | using the \macro{url} macro. This should consist of one or more |
| 1488 | complete sentences. |
| 1489 | \end{macrodesc} |
| 1490 | |
Fred Drake | 4844998 | 2000-09-12 17:52:33 +0000 | [diff] [blame] | 1491 | \begin{macrodesc}{seetitle}{\op{url}\p{title}\p{why}} |
| 1492 | Add a reference to an external document named \var{title}. If |
| 1493 | \var{url} is given, the title is made a hyperlink in the HTML |
| 1494 | version of the documentation, and displayed below the title in |
| 1495 | the typeset versions of the documentation. |
| 1496 | \end{macrodesc} |
| 1497 | |
Fred Drake | 5802e48 | 2000-07-06 05:24:41 +0000 | [diff] [blame] | 1498 | \begin{macrodesc}{seeurl}{\p{url}\p{why}} |
| 1499 | References to specific on-line resources should be given using |
Fred Drake | 5ed35fd | 2001-11-30 18:09:54 +0000 | [diff] [blame] | 1500 | the \macro{seeurl} macro if they don't have a meaningful title. |
| 1501 | Online documents which have identifiable titles should be |
| 1502 | referenced using the \macro{seetitle} macro, using the optional |
| 1503 | parameter to that macro to provide the URL. |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 1504 | \end{macrodesc} |
| 1505 | |
| 1506 | |
| 1507 | \subsection{Index-generating Markup \label{indexing}} |
| 1508 | |
| 1509 | Effective index generation for technical documents can be very |
Fred Drake | e15956b | 2000-04-03 04:51:13 +0000 | [diff] [blame] | 1510 | difficult, especially for someone familiar with the topic but not |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 1511 | the creation of indexes. Much of the difficulty arises in the |
| 1512 | area of terminology: including the terms an expert would use for a |
| 1513 | concept is not sufficient. Coming up with the terms that a novice |
Fred Drake | 2c4e009 | 1999-03-29 14:55:55 +0000 | [diff] [blame] | 1514 | would look up is fairly difficult for an author who, typically, is |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 1515 | an expert in the area she is writing on. |
| 1516 | |
Fred Drake | 2c4e009 | 1999-03-29 14:55:55 +0000 | [diff] [blame] | 1517 | The truly difficult aspects of index generation are not areas with |
| 1518 | which the documentation tools can help. However, ease |
Fred Drake | e15956b | 2000-04-03 04:51:13 +0000 | [diff] [blame] | 1519 | of producing the index once content decisions are made is within |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 1520 | the scope of the tools. Markup is provided which the processing |
| 1521 | software is able to use to generate a variety of kinds of index |
| 1522 | entry with minimal effort. Additionally, many of the environments |
Fred Drake | 7a737df | 1999-04-23 14:41:44 +0000 | [diff] [blame] | 1523 | described in section \ref{info-units}, ``Information Units,'' will |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 1524 | generate appropriate entries into the general and module indexes. |
| 1525 | |
| 1526 | The following macro can be used to control the generation of index |
Fred Drake | adade92 | 1999-04-22 13:05:27 +0000 | [diff] [blame] | 1527 | data, and should be used in the document preamble: |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 1528 | |
| 1529 | \begin{macrodesc}{makemodindex}{} |
Fred Drake | adade92 | 1999-04-22 13:05:27 +0000 | [diff] [blame] | 1530 | This should be used in the document preamble if a ``Module |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 1531 | Index'' is desired for a document containing reference material |
| 1532 | on many modules. This causes a data file |
Fred Drake | d1fb779 | 1999-05-17 16:33:54 +0000 | [diff] [blame] | 1533 | \code{lib\var{jobname}.idx} to be created from the |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 1534 | \macro{declaremodule} macros. This file can be processed by the |
| 1535 | \program{makeindex} program to generate a file which can be |
| 1536 | \macro{input} into the document at the desired location of the |
| 1537 | module index. |
| 1538 | \end{macrodesc} |
| 1539 | |
| 1540 | There are a number of macros that are useful for adding index |
| 1541 | entries for particular concepts, many of which are specific to |
| 1542 | programming languages or even Python. |
| 1543 | |
Fred Drake | adade92 | 1999-04-22 13:05:27 +0000 | [diff] [blame] | 1544 | \begin{macrodesc}{bifuncindex}{\p{name}} |
Fred Drake | ec8b905 | 1999-04-23 20:01:17 +0000 | [diff] [blame] | 1545 | Add an index entry referring to a built-in function named |
| 1546 | \var{name}; parentheses should not be included after |
Fred Drake | 2c4e009 | 1999-03-29 14:55:55 +0000 | [diff] [blame] | 1547 | \var{name}. |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 1548 | \end{macrodesc} |
| 1549 | |
Fred Drake | adade92 | 1999-04-22 13:05:27 +0000 | [diff] [blame] | 1550 | \begin{macrodesc}{exindex}{\p{exception}} |
Fred Drake | 2c4e009 | 1999-03-29 14:55:55 +0000 | [diff] [blame] | 1551 | Add a reference to an exception named \var{exception}. The |
Neal Norwitz | 847207a | 2003-05-29 02:17:23 +0000 | [diff] [blame] | 1552 | exception should be class-based. |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 1553 | \end{macrodesc} |
| 1554 | |
Fred Drake | adade92 | 1999-04-22 13:05:27 +0000 | [diff] [blame] | 1555 | \begin{macrodesc}{kwindex}{\p{keyword}} |
Fred Drake | 2c4e009 | 1999-03-29 14:55:55 +0000 | [diff] [blame] | 1556 | Add a reference to a language keyword (not a keyword parameter |
| 1557 | in a function or method call). |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 1558 | \end{macrodesc} |
| 1559 | |
Fred Drake | adade92 | 1999-04-22 13:05:27 +0000 | [diff] [blame] | 1560 | \begin{macrodesc}{obindex}{\p{object type}} |
Fred Drake | 2c4e009 | 1999-03-29 14:55:55 +0000 | [diff] [blame] | 1561 | Add an index entry for a built-in object type. |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 1562 | \end{macrodesc} |
| 1563 | |
Fred Drake | adade92 | 1999-04-22 13:05:27 +0000 | [diff] [blame] | 1564 | \begin{macrodesc}{opindex}{\p{operator}} |
Fred Drake | 2c4e009 | 1999-03-29 14:55:55 +0000 | [diff] [blame] | 1565 | Add a reference to an operator, such as \samp{+}. |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 1566 | \end{macrodesc} |
| 1567 | |
Fred Drake | adade92 | 1999-04-22 13:05:27 +0000 | [diff] [blame] | 1568 | \begin{macrodesc}{refmodindex}{\op{key}\p{module}} |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 1569 | Add an index entry for module \var{module}; if \var{module} |
| 1570 | contains an underscore, the optional parameter \var{key} should |
| 1571 | be provided as the same string with underscores removed. An |
| 1572 | index entry ``\var{module} (module)'' will be generated. This |
| 1573 | is intended for use with non-standard modules implemented in |
| 1574 | Python. |
| 1575 | \end{macrodesc} |
| 1576 | |
Fred Drake | adade92 | 1999-04-22 13:05:27 +0000 | [diff] [blame] | 1577 | \begin{macrodesc}{refexmodindex}{\op{key}\p{module}} |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 1578 | As for \macro{refmodindex}, but the index entry will be |
| 1579 | ``\var{module} (extension module).'' This is intended for use |
| 1580 | with non-standard modules not implemented in Python. |
| 1581 | \end{macrodesc} |
| 1582 | |
Fred Drake | adade92 | 1999-04-22 13:05:27 +0000 | [diff] [blame] | 1583 | \begin{macrodesc}{refbimodindex}{\op{key}\p{module}} |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 1584 | As for \macro{refmodindex}, but the index entry will be |
| 1585 | ``\var{module} (built-in module).'' This is intended for use |
| 1586 | with standard modules not implemented in Python. |
| 1587 | \end{macrodesc} |
| 1588 | |
Fred Drake | adade92 | 1999-04-22 13:05:27 +0000 | [diff] [blame] | 1589 | \begin{macrodesc}{refstmodindex}{\op{key}\p{module}} |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 1590 | As for \macro{refmodindex}, but the index entry will be |
| 1591 | ``\var{module} (standard module).'' This is intended for use |
| 1592 | with standard modules implemented in Python. |
| 1593 | \end{macrodesc} |
| 1594 | |
Fred Drake | adade92 | 1999-04-22 13:05:27 +0000 | [diff] [blame] | 1595 | \begin{macrodesc}{stindex}{\p{statement}} |
Fred Drake | 2c4e009 | 1999-03-29 14:55:55 +0000 | [diff] [blame] | 1596 | Add an index entry for a statement type, such as \keyword{print} |
Fred Drake | adade92 | 1999-04-22 13:05:27 +0000 | [diff] [blame] | 1597 | or \keyword{try}/\keyword{finally}. |
| 1598 | |
| 1599 | XXX Need better examples of difference from \macro{kwindex}. |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 1600 | \end{macrodesc} |
| 1601 | |
| 1602 | |
| 1603 | Additional macros are provided which are useful for conveniently |
| 1604 | creating general index entries which should appear at many places |
| 1605 | in the index by rotating a list of words. These are simple macros |
| 1606 | that simply use \macro{index} to build some number of index |
| 1607 | entries. Index entries build using these macros contain both |
| 1608 | primary and secondary text. |
| 1609 | |
Fred Drake | adade92 | 1999-04-22 13:05:27 +0000 | [diff] [blame] | 1610 | \begin{macrodesc}{indexii}{\p{word1}\p{word2}} |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 1611 | Build two index entries. This is exactly equivalent to using |
Fred Drake | e7f343d | 2003-07-11 03:36:15 +0000 | [diff] [blame] | 1612 | \code{\e index\{\var{word1}!\var{word2}\}} and |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 1613 | \code{\e index\{\var{word2}!\var{word1}\}}. |
| 1614 | \end{macrodesc} |
| 1615 | |
Fred Drake | adade92 | 1999-04-22 13:05:27 +0000 | [diff] [blame] | 1616 | \begin{macrodesc}{indexiii}{\p{word1}\p{word2}\p{word3}} |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 1617 | Build three index entries. This is exactly equivalent to using |
| 1618 | \code{\e index\{\var{word1}!\var{word2} \var{word3}\}}, |
| 1619 | \code{\e index\{\var{word2}!\var{word3}, \var{word1}\}}, and |
| 1620 | \code{\e index\{\var{word3}!\var{word1} \var{word2}\}}. |
| 1621 | \end{macrodesc} |
| 1622 | |
Fred Drake | adade92 | 1999-04-22 13:05:27 +0000 | [diff] [blame] | 1623 | \begin{macrodesc}{indexiv}{\p{word1}\p{word2}\p{word3}\p{word4}} |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 1624 | Build four index entries. This is exactly equivalent to using |
| 1625 | \code{\e index\{\var{word1}!\var{word2} \var{word3} \var{word4}\}}, |
| 1626 | \code{\e index\{\var{word2}!\var{word3} \var{word4}, \var{word1}\}}, |
| 1627 | \code{\e index\{\var{word3}!\var{word4}, \var{word1} \var{word2}\}}, |
| 1628 | and |
| 1629 | \code{\e index\{\var{word4}!\var{word1} \var{word2} \var{word3}\}}. |
| 1630 | \end{macrodesc} |
| 1631 | |
Fred Drake | 432cef0 | 2001-07-06 22:34:33 +0000 | [diff] [blame] | 1632 | \subsection{Grammar Production Displays \label{grammar-displays}} |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 1633 | |
Fred Drake | 432cef0 | 2001-07-06 22:34:33 +0000 | [diff] [blame] | 1634 | Special markup is available for displaying the productions of a |
| 1635 | formal grammar. The markup is simple and does not attempt to |
| 1636 | model all aspects of BNF (or any derived forms), but provides |
| 1637 | enough to allow context-free grammars to be displayed in a way |
| 1638 | that causes uses of a symbol to be rendered as hyperlinks to the |
| 1639 | definition of the symbol. There is one environment and a pair of |
| 1640 | macros: |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 1641 | |
Fred Drake | 432cef0 | 2001-07-06 22:34:33 +0000 | [diff] [blame] | 1642 | \begin{envdesc}{productionlist}{\op{language}} |
| 1643 | This environment is used to enclose a group of productions. The |
| 1644 | two macros are only defined within this environment. If a |
| 1645 | document descibes more than one language, the optional parameter |
| 1646 | \var{language} should be used to distinguish productions between |
| 1647 | languages. The value of the parameter should be a short name |
| 1648 | that can be used as part of a filename; colons or other |
| 1649 | characters that can't be used in filename across platforms |
| 1650 | should be included. |
| 1651 | \end{envdesc} |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 1652 | |
Fred Drake | 432cef0 | 2001-07-06 22:34:33 +0000 | [diff] [blame] | 1653 | \begin{macrodesc}{production}{\p{name}\p{definition}} |
| 1654 | A production rule in the grammar. The rule defines the symbol |
| 1655 | \var{name} to be \var{definition}. \var{name} should not |
| 1656 | contain any markup, and the use of hyphens in a document which |
| 1657 | supports more than one grammar is undefined. \var{definition} |
| 1658 | may contain \macro{token} macros and any additional content |
| 1659 | needed to describe the grammatical model of \var{symbol}. Only |
| 1660 | one \macro{production} may be used to define a symbol --- |
| 1661 | multiple definitions are not allowed. |
| 1662 | \end{macrodesc} |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 1663 | |
Fred Drake | 432cef0 | 2001-07-06 22:34:33 +0000 | [diff] [blame] | 1664 | \begin{macrodesc}{token}{\p{name}} |
| 1665 | The name of a symbol defined by a \macro{production} macro, used |
| 1666 | in the \var{definition} of a symbol. Where possible, this will |
| 1667 | be rendered as a hyperlink to the definition of the symbol |
| 1668 | \var{name}. |
| 1669 | \end{macrodesc} |
Fred Drake | 4293468 | 2000-04-03 15:00:28 +0000 | [diff] [blame] | 1670 | |
Fred Drake | 432cef0 | 2001-07-06 22:34:33 +0000 | [diff] [blame] | 1671 | Note that the entire grammar does not need to be defined in a |
| 1672 | single \env{productionlist} environment; any number of |
| 1673 | groupings may be used to describe the grammar. Every use of the |
| 1674 | \macro{token} must correspond to a \macro{production}. |
| 1675 | |
| 1676 | The following is an example taken from the |
| 1677 | \citetitle[../ref/identifiers.html]{Python Reference Manual}: |
| 1678 | |
| 1679 | \begin{verbatim} |
| 1680 | \begin{productionlist} |
| 1681 | \production{identifier} |
| 1682 | {(\token{letter}|"_") (\token{letter} | \token{digit} | "_")*} |
| 1683 | \production{letter} |
| 1684 | {\token{lowercase} | \token{uppercase}} |
| 1685 | \production{lowercase} |
| 1686 | {"a"..."z"} |
| 1687 | \production{uppercase} |
| 1688 | {"A"..."Z"} |
| 1689 | \production{digit} |
| 1690 | {"0"..."9"} |
| 1691 | \end{productionlist} |
| 1692 | \end{verbatim} |
| 1693 | |
| 1694 | |
Fred Drake | e134158 | 2002-09-25 18:44:21 +0000 | [diff] [blame] | 1695 | \subsection{Graphical Interface Components \label{gui-markup}} |
Fred Drake | 432cef0 | 2001-07-06 22:34:33 +0000 | [diff] [blame] | 1696 | |
| 1697 | The components of graphical interfaces will be assigned markup, but |
Fred Drake | e134158 | 2002-09-25 18:44:21 +0000 | [diff] [blame] | 1698 | most of the specifics have not been determined. |
| 1699 | |
Fred Drake | f0f6d12 | 2004-01-23 08:52:28 +0000 | [diff] [blame] | 1700 | \begin{macrodesc}{guilabel}{\p{label}} |
| 1701 | Labels presented as part of an interactive user interface should |
| 1702 | be marked using \macro{guilabel}. This includes labels from |
| 1703 | text-based interfaces such as those created using \code{curses} or |
| 1704 | other text-based libraries. Any label used in the interface |
| 1705 | should be marked with this macro, including button labels, window |
| 1706 | titles, field names, menu and menu selection names, and even |
| 1707 | values in selection lists. |
| 1708 | \end{macrodesc} |
| 1709 | |
Fred Drake | e134158 | 2002-09-25 18:44:21 +0000 | [diff] [blame] | 1710 | \begin{macrodesc}{menuselection}{\p{menupath}} |
| 1711 | Menu selections should be marked using a combination of |
| 1712 | \macro{menuselection} and \macro{sub}. This macro is used to mark |
| 1713 | a complete sequence of menu selections, including selecting |
| 1714 | submenus and choosing a specific operation, or any subsequence of |
| 1715 | such a sequence. The names of individual selections should be |
| 1716 | separated by occurances of \macro{sub}. |
| 1717 | |
| 1718 | For example, to mark the selection ``\menuselection{Start \sub |
| 1719 | Programs}'', use this markup: |
| 1720 | |
| 1721 | \begin{verbatim} |
| 1722 | \menuselection{Start \sub Programs} |
| 1723 | \end{verbatim} |
| 1724 | |
| 1725 | When including a selection that includes some trailing indicator, |
| 1726 | such as the ellipsis some operating systems use to indicate that |
| 1727 | the command opens a dialog, the indicator should be omitted from |
| 1728 | the selection name. |
Fred Drake | f0f6d12 | 2004-01-23 08:52:28 +0000 | [diff] [blame] | 1729 | |
| 1730 | Individual selection names within the \macro{menuselection} should |
| 1731 | not be marked using \macro{guilabel} since that's implied by using |
| 1732 | \macro{menuselection}. |
Fred Drake | e134158 | 2002-09-25 18:44:21 +0000 | [diff] [blame] | 1733 | \end{macrodesc} |
| 1734 | |
| 1735 | \begin{macrodesc}{sub}{} |
| 1736 | Separator for menu selections that include multiple levels. This |
| 1737 | macro is only defined within the context of the |
| 1738 | \macro{menuselection} macro. |
| 1739 | \end{macrodesc} |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 1740 | |
| 1741 | |
Fred Drake | f1b3de8 | 2001-07-24 14:38:34 +0000 | [diff] [blame] | 1742 | \section{Processing Tools \label{tools}} |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 1743 | |
Fred Drake | f1b3de8 | 2001-07-24 14:38:34 +0000 | [diff] [blame] | 1744 | \subsection{External Tools \label{tools-external}} |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 1745 | |
| 1746 | Many tools are needed to be able to process the Python |
| 1747 | documentation if all supported formats are required. This |
Fred Drake | adade92 | 1999-04-22 13:05:27 +0000 | [diff] [blame] | 1748 | section lists the tools used and when each is required. Consult |
| 1749 | the \file{Doc/README} file to see if there are specific version |
| 1750 | requirements for any of these. |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 1751 | |
| 1752 | \begin{description} |
| 1753 | \item[\program{dvips}] |
| 1754 | This program is a typical part of \TeX{} installations. It is |
| 1755 | used to generate PostScript from the ``device independent'' |
Fred Drake | 2c4e009 | 1999-03-29 14:55:55 +0000 | [diff] [blame] | 1756 | \file{.dvi} files. It is needed for the conversion to |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 1757 | PostScript. |
| 1758 | |
| 1759 | \item[\program{emacs}] |
| 1760 | Emacs is the kitchen sink of programmers' editors, and a damn |
| 1761 | fine kitchen sink it is. It also comes with some of the |
| 1762 | processing needed to support the proper menu structures for |
| 1763 | Texinfo documents when an info conversion is desired. This is |
Fred Drake | 2c4e009 | 1999-03-29 14:55:55 +0000 | [diff] [blame] | 1764 | needed for the info conversion. Using \program{xemacs} |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 1765 | instead of FSF \program{emacs} may lead to instability in the |
| 1766 | conversion, but that's because nobody seems to maintain the |
| 1767 | Emacs Texinfo code in a portable manner. |
| 1768 | |
| 1769 | \item[\program{latex}] |
Fred Drake | b5f17f2 | 2001-08-28 18:09:11 +0000 | [diff] [blame] | 1770 | \LaTeX{} is a large and extensible macro package by Leslie |
| 1771 | Lamport, based on \TeX, a world-class typesetter by Donald |
| 1772 | Knuth. It is used for the conversion to PostScript, and is |
| 1773 | needed for the HTML conversion as well (\LaTeX2HTML requires |
| 1774 | one of the intermediate files it creates). |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 1775 | |
| 1776 | \item[\program{latex2html}] |
| 1777 | Probably the longest Perl script anyone ever attempted to |
| 1778 | maintain. This converts \LaTeX{} documents to HTML documents, |
| 1779 | and does a pretty reasonable job. It is required for the |
| 1780 | conversions to HTML and GNU info. |
| 1781 | |
| 1782 | \item[\program{lynx}] |
| 1783 | This is a text-mode Web browser which includes an |
| 1784 | HTML-to-plain text conversion. This is used to convert |
| 1785 | \code{howto} documents to text. |
| 1786 | |
| 1787 | \item[\program{make}] |
| 1788 | Just about any version should work for the standard documents, |
| 1789 | but GNU \program{make} is required for the experimental |
| 1790 | processes in \file{Doc/tools/sgmlconv/}, at least while |
Fred Drake | b5f17f2 | 2001-08-28 18:09:11 +0000 | [diff] [blame] | 1791 | they're experimental. This is not required for running the |
Fred Drake | f9dc043 | 2001-08-29 02:34:10 +0000 | [diff] [blame] | 1792 | \program{mkhowto} script. |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 1793 | |
| 1794 | \item[\program{makeindex}] |
| 1795 | This is a standard program for converting \LaTeX{} index data |
| 1796 | to a formatted index; it should be included with all \LaTeX{} |
| 1797 | installations. It is needed for the PDF and PostScript |
| 1798 | conversions. |
| 1799 | |
| 1800 | \item[\program{makeinfo}] |
| 1801 | GNU \program{makeinfo} is used to convert Texinfo documents to |
| 1802 | GNU info files. Since Texinfo is used as an intermediate |
| 1803 | format in the info conversion, this program is needed in that |
| 1804 | conversion. |
| 1805 | |
| 1806 | \item[\program{pdflatex}] |
| 1807 | pdf\TeX{} is a relatively new variant of \TeX, and is used to |
| 1808 | generate the PDF version of the manuals. It is typically |
| 1809 | installed as part of most of the large \TeX{} distributions. |
Fred Drake | 7a737df | 1999-04-23 14:41:44 +0000 | [diff] [blame] | 1810 | \program{pdflatex} is pdf\TeX{} using the \LaTeX{} format. |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 1811 | |
| 1812 | \item[\program{perl}] |
| 1813 | Perl is required for \LaTeX2HTML{} and one of the scripts used |
| 1814 | to post-process \LaTeX2HTML output, as well as the |
Fred Drake | 2c4e009 | 1999-03-29 14:55:55 +0000 | [diff] [blame] | 1815 | HTML-to-Texinfo conversion. This is required for |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 1816 | the HTML and GNU info conversions. |
| 1817 | |
| 1818 | \item[\program{python}] |
| 1819 | Python is used for many of the scripts in the |
| 1820 | \file{Doc/tools/} directory; it is required for all |
| 1821 | conversions. This shouldn't be a problem if you're interested |
| 1822 | in writing documentation for Python! |
| 1823 | \end{description} |
| 1824 | |
| 1825 | |
Fred Drake | f1b3de8 | 2001-07-24 14:38:34 +0000 | [diff] [blame] | 1826 | \subsection{Internal Tools \label{tools-internal}} |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 1827 | |
| 1828 | This section describes the various scripts that are used to |
| 1829 | implement various stages of document processing or to orchestrate |
Fred Drake | 2c4e009 | 1999-03-29 14:55:55 +0000 | [diff] [blame] | 1830 | entire build sequences. Most of these tools are only useful |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 1831 | in the context of building the standard documentation, but some |
| 1832 | are more general. |
| 1833 | |
| 1834 | \begin{description} |
| 1835 | \item[\program{mkhowto}] |
Fred Drake | 87f768e | 1999-05-17 15:22:45 +0000 | [diff] [blame] | 1836 | This is the primary script used to format third-party |
Fred Drake | e7f343d | 2003-07-11 03:36:15 +0000 | [diff] [blame] | 1837 | documents. It contains all the logic needed to ``get it |
| 1838 | right.'' The proper way to use this script is to make a |
| 1839 | symbolic link to it or run it in place; the actual script file |
| 1840 | must be stored as part of the documentation source tree, |
Fred Drake | efb3a16 | 2003-10-01 04:15:09 +0000 | [diff] [blame] | 1841 | though it may be used to format documents outside the tree. |
| 1842 | Use \program{mkhowto} \longprogramopt{help} for a list of |
Fred Drake | d2a727f | 1999-05-27 21:45:54 +0000 | [diff] [blame] | 1843 | command line options. |
Fred Drake | 87f768e | 1999-05-17 15:22:45 +0000 | [diff] [blame] | 1844 | |
Fred Drake | d1fb779 | 1999-05-17 16:33:54 +0000 | [diff] [blame] | 1845 | \program{mkhowto} can be used for both \code{howto} and |
Fred Drake | d80032b | 2002-09-25 21:41:22 +0000 | [diff] [blame] | 1846 | \code{manual} class documents. It is usually a good idea to |
| 1847 | always use the latest version of this tool rather than a |
Fred Drake | efb3a16 | 2003-10-01 04:15:09 +0000 | [diff] [blame] | 1848 | version from an older source release of Python. It can be |
| 1849 | used to generate DVI, HTML, PDF, PostScript, and plain text |
| 1850 | documents. The GNU info and iSilo formats will be supported |
| 1851 | by this script in some future version. |
| 1852 | |
| 1853 | Use the \longprogramopt{help} option on this script's command |
| 1854 | line to get a summary of options for this script. |
Fred Drake | d1fb779 | 1999-05-17 16:33:54 +0000 | [diff] [blame] | 1855 | |
Fred Drake | e7f343d | 2003-07-11 03:36:15 +0000 | [diff] [blame] | 1856 | XXX Need more here. |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 1857 | \end{description} |
| 1858 | |
| 1859 | |
Fred Drake | eb2b833 | 2002-05-01 22:05:30 +0000 | [diff] [blame] | 1860 | \subsection{Working on Cygwin \label{cygwin}} |
| 1861 | |
Fred Drake | eb2b833 | 2002-05-01 22:05:30 +0000 | [diff] [blame] | 1862 | Installing the required tools under Cygwin under Cygwin can be a |
| 1863 | little tedious, if only because many packages are more difficult |
| 1864 | to install under Cygwin. |
| 1865 | |
| 1866 | Using the Cygwin installer, make sure your Cygwin installation |
| 1867 | includes Perl, Python, and the \TeX{} packages. Perl and Python |
Fred Drake | a66b6c1 | 2003-07-16 13:50:28 +0000 | [diff] [blame] | 1868 | are located under \menuselection{Interpreters} in the installer. |
Fred Drake | eb2b833 | 2002-05-01 22:05:30 +0000 | [diff] [blame] | 1869 | The \TeX{} packages are located in the \menuselection{Text} |
Fred Drake | a66b6c1 | 2003-07-16 13:50:28 +0000 | [diff] [blame] | 1870 | section; installing the \code{tetex-beta}, \code{texmf}, |
| 1871 | \code{texmf-base}, and \code{texmf-extra} ensures that all the |
| 1872 | required packages are available. (There may be a more minimal |
| 1873 | set, but I've not spent time trying to minimize the installation.) |
Fred Drake | eb2b833 | 2002-05-01 22:05:30 +0000 | [diff] [blame] | 1874 | |
| 1875 | The netpbm package is used by \LaTeX2HTML, and \emph{must} be |
| 1876 | installed before \LaTeX2HTML can be successfully installed, even |
| 1877 | though they will never be used for most Python documentation. |
| 1878 | References to download locations are located in the \ulink{netpbm |
| 1879 | README}{http://netpbm.sourceforge.net/README}. Install according |
| 1880 | to the instructions. |
| 1881 | |
| 1882 | \LaTeX2HTML can be installed from the source archive, but only |
| 1883 | after munging one of the files in the distribution. Edit the file |
| 1884 | \file{L2hos.pm} in the top level of the unpacked distribution; |
| 1885 | near the bottom of the file, change the text |
| 1886 | \code{\$\textasciicircum{}O} with the text \code{'unix'}. Proceed |
| 1887 | using this command to build and install the software: |
| 1888 | |
| 1889 | \begin{verbatim} |
Fred Drake | c7c9a3a | 2004-05-10 18:39:32 +0000 | [diff] [blame] | 1890 | % ./configure && make install |
Fred Drake | eb2b833 | 2002-05-01 22:05:30 +0000 | [diff] [blame] | 1891 | \end{verbatim} |
| 1892 | |
Fred Drake | efb3a16 | 2003-10-01 04:15:09 +0000 | [diff] [blame] | 1893 | You should now be able to build at least the DVI, HTML, PDF, and |
Fred Drake | 77c1895 | 2002-05-02 21:10:48 +0000 | [diff] [blame] | 1894 | PostScript versions of the formatted documentation. |
| 1895 | |
Fred Drake | eb2b833 | 2002-05-01 22:05:30 +0000 | [diff] [blame] | 1896 | |
Fred Drake | 40b9df2 | 2003-10-11 05:25:24 +0000 | [diff] [blame] | 1897 | \section{Including Graphics \label{graphics}} |
| 1898 | |
| 1899 | The standard documentation included with Python makes no use of |
| 1900 | diagrams or images; this is intentional. The outside tools used to |
| 1901 | format the documentation have not always been suited to working with |
| 1902 | graphics. As the tools have evolved and been improved by their |
| 1903 | maintainers, support for graphics has improved. |
| 1904 | |
| 1905 | The internal tools, starting with the \program{mkhowto} script, do |
| 1906 | not provide any direct support for graphics. However, |
| 1907 | \program{mkhowto} will not interfere with graphics support in the |
| 1908 | external tools. |
| 1909 | |
| 1910 | Experience using graphics together with these tools and the |
| 1911 | \code{howto} and \code{manual} document classes is not extensive, |
| 1912 | but has been known to work. The basic approach is this: |
| 1913 | |
| 1914 | \begin{enumerate} |
| 1915 | \item Create the image or graphic using your favorite |
| 1916 | application. |
| 1917 | |
| 1918 | \item Convert the image to a format supported by the conversion to |
| 1919 | your desired output format. If you want to generate HTML or |
| 1920 | PostScript, you can convert the image or graphic to |
| 1921 | encapsulated PostScript (a \file{.eps} file); \LaTeX2HTML |
| 1922 | can convert that to a \file{.gif} file; it may be possible |
| 1923 | to provide a \file{.gif} file directly. If you want to |
| 1924 | generate PDF, you need to provide an ``encapsulated'' PDF |
| 1925 | file. This can be generated from encapsulated PostScript |
| 1926 | using the \program{epstopdf} tool provided with the te\TeX{} |
| 1927 | distribution on Linux and \UNIX. |
| 1928 | |
| 1929 | \item In your document, add this line to ``import'' the general |
| 1930 | graphics support package \code{graphicx}: |
| 1931 | |
| 1932 | \begin{verbatim} |
| 1933 | \usepackage{graphicx} |
| 1934 | \end{verbatim} |
| 1935 | |
| 1936 | \item Where you want to include your graphic or image, include |
| 1937 | markup similar to this: |
| 1938 | |
| 1939 | \begin{verbatim} |
| 1940 | \begin{figure} |
| 1941 | \centering |
| 1942 | \includegraphics[width=5in]{myimage} |
| 1943 | \caption{Description of my image} |
| 1944 | \end{figure} |
| 1945 | \end{verbatim} |
| 1946 | |
| 1947 | In particular, note for the \macro{includegraphics} macro |
| 1948 | that no file extension is provided. If you're only |
| 1949 | interested in one target format, you can include the |
| 1950 | extension of the appropriate input file, but to allow |
| 1951 | support for multiple formats, omitting the extension makes |
| 1952 | life easier. |
| 1953 | |
| 1954 | \item Run \program{mkhowto} normally. |
| 1955 | \end{enumerate} |
| 1956 | |
| 1957 | If you're working on systems which support some sort of |
| 1958 | \program{make} facility, you can use that to ensure the intermediate |
| 1959 | graphic formats are kept up to date. This example shows a |
| 1960 | \file{Makefile} used to format a document containing a diagram |
| 1961 | created using the \program{dia} application: |
| 1962 | |
| 1963 | \begin{verbatim} |
| 1964 | default: pdf |
| 1965 | all: html pdf ps |
| 1966 | |
| 1967 | html: mydoc/mydoc.html |
| 1968 | pdf: mydoc.pdf |
| 1969 | ps: mydoc.ps |
| 1970 | |
| 1971 | mydoc/mydoc.html: mydoc.tex mygraphic.eps |
| 1972 | mkhowto --html $< |
| 1973 | |
| 1974 | mydoc.pdf: mydoc.tex mygraphic.pdf |
| 1975 | mkhowto --pdf $< |
| 1976 | |
| 1977 | mydoc.ps: mydoc.tex mygraphic.eps |
| 1978 | mkhowto --postscript $< |
| 1979 | |
| 1980 | .SUFFIXES: .dia .eps .pdf |
| 1981 | |
| 1982 | .dia.eps: |
| 1983 | dia --nosplash --export $@ $< |
| 1984 | |
| 1985 | .eps.pdf: |
| 1986 | epstopdf $< |
| 1987 | \end{verbatim} % $ <-- bow to font-lock |
| 1988 | |
| 1989 | |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 1990 | \section{Future Directions \label{futures}} |
| 1991 | |
| 1992 | The history of the Python documentation is full of changes, most of |
| 1993 | which have been fairly small and evolutionary. There has been a |
| 1994 | great deal of discussion about making large changes in the markup |
| 1995 | languages and tools used to process the documentation. This section |
| 1996 | deals with the nature of the changes and what appears to be the most |
| 1997 | likely path of future development. |
| 1998 | |
| 1999 | \subsection{Structured Documentation \label{structured}} |
| 2000 | |
| 2001 | Most of the small changes to the \LaTeX{} markup have been made |
| 2002 | with an eye to divorcing the markup from the presentation, making |
| 2003 | both a bit more maintainable. Over the course of 1998, a large |
| 2004 | number of changes were made with exactly this in mind; previously, |
| 2005 | changes had been made but in a less systematic manner and with |
| 2006 | more concern for not needing to update the existing content. The |
| 2007 | result has been a highly structured and semantically loaded markup |
| 2008 | language implemented in \LaTeX. With almost no basic \TeX{} or |
| 2009 | \LaTeX{} markup in use, however, the markup syntax is about the |
| 2010 | only evidence of \LaTeX{} in the actual document sources. |
| 2011 | |
| 2012 | One side effect of this is that while we've been able to use |
| 2013 | standard ``engines'' for manipulating the documents, such as |
| 2014 | \LaTeX{} and \LaTeX2HTML, most of the actual transformations have |
Fred Drake | 7a737df | 1999-04-23 14:41:44 +0000 | [diff] [blame] | 2015 | been created specifically for Python. The \LaTeX{} document |
| 2016 | classes and \LaTeX2HTML support are both complete implementations |
| 2017 | of the specific markup designed for these documents. |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 2018 | |
| 2019 | Combining highly customized markup with the somewhat esoteric |
| 2020 | systems used to process the documents leads us to ask some |
| 2021 | questions: Can we do this more easily? and, Can we do this |
| 2022 | better? After a great deal of discussion with the community, we |
| 2023 | have determined that actively pursuing modern structured |
Fred Drake | 2c4e009 | 1999-03-29 14:55:55 +0000 | [diff] [blame] | 2024 | documentation systems is worth some investment of time. |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 2025 | |
| 2026 | There appear to be two real contenders in this arena: the Standard |
| 2027 | General Markup Language (SGML), and the Extensible Markup Language |
| 2028 | (XML). Both of these standards have advantages and disadvantages, |
| 2029 | and many advantages are shared. |
| 2030 | |
| 2031 | SGML offers advantages which may appeal most to authors, |
| 2032 | especially those using ordinary text editors. There are also |
| 2033 | additional abilities to define content models. A number of |
Fred Drake | 67f193f | 2001-07-09 16:04:03 +0000 | [diff] [blame] | 2034 | high-quality tools with demonstrated maturity are available, but |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 2035 | most are not free; for those which are, portability issues remain |
| 2036 | a problem. |
| 2037 | |
| 2038 | The advantages of XML include the availability of a large number |
| 2039 | of evolving tools. Unfortunately, many of the associated |
| 2040 | standards are still evolving, and the tools will have to follow |
| 2041 | along. This means that developing a robust tool set that uses |
| 2042 | more than the basic XML 1.0 recommendation is not possible in the |
| 2043 | short term. The promised availability of a wide variety of |
| 2044 | high-quality tools which support some of the most important |
| 2045 | related standards is not immediate. Many tools are likely to be |
Fred Drake | 67f193f | 2001-07-09 16:04:03 +0000 | [diff] [blame] | 2046 | free, and the portability issues of those which are, are not |
| 2047 | expected to be significant. |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 2048 | |
Fred Drake | 67f193f | 2001-07-09 16:04:03 +0000 | [diff] [blame] | 2049 | It turns out that converting to an XML or SGML system holds |
| 2050 | promise for translators as well; how much can be done to ease the |
| 2051 | burden on translators remains to be seen, and may have some impact |
| 2052 | on the schema and specific technologies used. |
| 2053 | |
| 2054 | XXX Eventual migration to XML. |
| 2055 | |
| 2056 | The documentation will be moved to XML in the future, and tools |
| 2057 | are being written which will convert the documentation from the |
| 2058 | current format to something close to a finished version, to the |
| 2059 | extent that the desired information is already present in the |
| 2060 | documentation. Some XSLT stylesheets have been started for |
| 2061 | presenting a preliminary XML version as HTML, but the results are |
Fred Drake | e7f343d | 2003-07-11 03:36:15 +0000 | [diff] [blame] | 2062 | fairly rough. |
Fred Drake | 67f193f | 2001-07-09 16:04:03 +0000 | [diff] [blame] | 2063 | |
| 2064 | The timeframe for the conversion is not clear since there doesn't |
| 2065 | seem to be much time available to work on this, but the appearant |
| 2066 | benefits are growing more substantial at a moderately rapid pace. |
| 2067 | |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 2068 | |
| 2069 | \subsection{Discussion Forums \label{discussion}} |
| 2070 | |
| 2071 | Discussion of the future of the Python documentation and related |
Fred Drake | 7a737df | 1999-04-23 14:41:44 +0000 | [diff] [blame] | 2072 | topics takes place in the Documentation Special Interest Group, or |
| 2073 | ``Doc-SIG.'' Information on the group, including mailing list |
| 2074 | archives and subscription information, is available at |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 2075 | \url{http://www.python.org/sigs/doc-sig/}. The SIG is open to all |
| 2076 | interested parties. |
| 2077 | |
| 2078 | Comments and bug reports on the standard documents should be sent |
Fred Drake | 9d84308 | 2003-07-30 02:55:28 +0000 | [diff] [blame] | 2079 | to \email{docs@python.org}. This may include comments |
Fred Drake | adade92 | 1999-04-22 13:05:27 +0000 | [diff] [blame] | 2080 | about formatting, content, grammatical and spelling errors, or |
Fred Drake | d1fb779 | 1999-05-17 16:33:54 +0000 | [diff] [blame] | 2081 | this document. You can also send comments on this document |
| 2082 | directly to the author at \email{fdrake@acm.org}. |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 2083 | |
Skip Montanaro | 176bda4cd | 2002-04-19 04:50:44 +0000 | [diff] [blame] | 2084 | \input{doc.ind} |
| 2085 | |
Fred Drake | acffaee | 1999-03-16 16:09:13 +0000 | [diff] [blame] | 2086 | \end{document} |