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