@@ -191,10 +191,127 @@ \section{\LaTeX{} Primer \label{latex-primer}}
191191 because it would cause output.
192192
193193 The document body follows the preamble. This contains all the
194- printed components of the document marked up structurally.
194+ printed components of the document marked up structurally. Generic
195+ \LaTeX {} structures include hierarchical sections
195196
196- XXX This section will discuss what the markup looks like, and
197- explain the difference between an environment and a macro.
197+ \subsection {Syntax }
198+
199+ There are only a things that an author of Python documentation
200+ needs to know about \LaTeX {} syntax.
201+
202+ A \dfn {comment} is started by the `` percent'' character
203+ (\character {\% }) and continues through the end of the line and all
204+ leading whitespace on the following line. This is a little
205+ different from any programming language I know of, so an example
206+ is in order:
207+
208+ \begin {verbatim }
209+ This is text.% comment
210+ This is more text. % another comment
211+ Still more text.
212+ \end {verbatim }
213+
214+ The first non-comment character following the first comment is the
215+ letter \character {T} on the second line; the leading whitespace on
216+ that line is consumed as part of the first comment. This means
217+ that there is no space between the first and second sentences, so
218+ the period and letter \character {T} will be directly adjacent in
219+ the typeset document.
220+
221+ Note also that though the first non-comment character after the
222+ second comment is the letter \character {S}, there is whitespace
223+ preceding the comment, so the two sentences are separated as
224+ expected.
225+
226+ A \dfn {group} is an enclosure for a collection of text and
227+ commands which encloses the formatting context and constrains the
228+ scope of any changes to that context made by commands within the
229+ group. Groups can be nested hierarchically. The formatting
230+ context includes the font and the definition of additional macros
231+ (or overrides of macros defined in outer groups). Syntactically,
232+ groups are enclosed in braces:
233+
234+ \begin {verbatim }
235+ {text in a group}
236+ \end {verbatim }
237+
238+ An alternate syntax for a group using brackets (\code {\{ ...\} }) is
239+ used by macros and environment constructors which take optional
240+ parameters; brackets do not normally hold syntactic significance.
241+ A degenerate group, containing only one atomic bit of content,
242+ does not need to have an explicit group, unless it is required to
243+ avoid ambiguity. Since Python tends toward the explicit, groups
244+ are also made explicit in the documentation markup.
245+
246+ Groups are used only sparingly in the Python documentation, except
247+ for their use in marking parameters to macros and environments.
248+
249+ A \dfn {macro} is usually simple construct which is identified by
250+ name and can take some number of parameters. In normal \LaTeX {}
251+ usage, one of these can be optional. The markup is introduced
252+ using the backslash character (\character {\e }), and the name is
253+ given by alphabetic characters (no digits, hyphens, or
254+ underscores). Required parameters should be marked as a group,
255+ and optional parameters should be marked using the alternate
256+ syntax for a group.
257+
258+ For example, a macro named `` foo'' which takes a single parameter
259+ would appear like this:
260+
261+ \begin {verbatim }
262+ \name{parameter}
263+ \end {verbatim }
264+
265+ A macro which takes an optional parameter would be typed like this
266+ when the optional paramter is given:
267+
268+ \begin {verbatim }
269+ \name[optional]
270+ \end {verbatim }
271+
272+ If both optional and required parameters are to be required, it
273+ looks like this:
274+
275+ \begin {verbatim }
276+ \name[optional]{required}
277+ \end {verbatim }
278+
279+ A macro name may be followed by a space or newline; a space
280+ between the macro name and any parameters will be consumed, but
281+ this usage is not practiced in the Python documentation. Such a
282+ space is still consumed if there are no parameters to the marco,
283+ in which case inserting an empty group (\code {\{\} }) or explicit
284+ word space (\samp {\e \ }) immediately after the macro name helps to
285+ avoid running the expansion of the macro into the following text.
286+ Macros which take no parameters but which should not be followed
287+ by a word space do not need special treatment if the following
288+ character in the document source if not a name character (such as
289+ puctuation).
290+
291+ Each line of this example shows an appropriate way to write text
292+ which includes a macro which takes no parameters:
293+
294+ \begin {verbatim }
295+ This \UNIX{} is followed by a space.
296+ This \UNIX\ is also followed by a space.
297+ \UNIX, followed by a comma, needs no additional markup.
298+ \end {verbatim }
299+
300+ An \dfn {environment} is ...
301+
302+ There are a number of less-used marks in \LaTeX {} are used to
303+ enter non-\ASCII {} characters, especially those used in European
304+ names. Some which are found in the Python documentation are:
305+
306+ XXX Table of Latin-1 characters that we've actually used in the
307+ Python documentation, pointer to other, more complete
308+ documentation elsewhere.
309+
310+
311+ \subsection {Hierarchical Structure }
312+
313+ XXX Talk about the traditional sectional hierarchy and how it's
314+ marked in \LaTeX .
198315
199316
200317\section {Document Classes \label {classes } }
@@ -390,13 +507,22 @@ \section{Special Markup Constructs}
390507
391508 Representing an interactive session requires including the prompts
392509 and output along with the Python code. No special markup is
393- required for interactive sessions.
510+ required for interactive sessions. After the last line of input
511+ or output presented, there should not be an `` unused'' primary
512+ prompt; this is an example of what \emph {not } to do:
513+
514+ \begin {verbatim }
515+ >>> 1 + 1
516+ 2
517+ >>>
518+ \end {verbatim }
394519
395520 Within the \env {verbatim} environment, characters special to
396521 \LaTeX {} do not need to be specially marked in any way. The entire
397522 example will be presented in a monospaced font; no attempt at
398523 `` pretty-printing'' is made, as the environment must work for
399- non-Python code and non-code displays.
524+ non-Python code and non-code displays. There should be no blank
525+ lines at the top or bottom of any \env {verbatim} display.
400526
401527 The Python Documentation Special Interest Group has discussed a
402528 number of approaches to creating pretty-printed code displays and
@@ -656,7 +782,7 @@ \section{Special Markup Constructs}
656782 The version of Python in which the named feature was changed in
657783 some way (new parameters, changed side effects, etc.).
658784 \var {explanation} should be a \emph {brief } explanation of the
659- change consisting of a non- capitalized sentence fragment; a
785+ change consisting of a capitalized sentence fragment; a
660786 period will be appended by the formatting process.
661787 This is typically added to the end of the first paragraph of the
662788 description before any availability notes and after
0 commit comments