Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit d097d48

Browse files
committed
Flesh out the "LaTeX Primer" some more.
1 parent 9c801ab commit d097d48

1 file changed

Lines changed: 74 additions & 7 deletions

File tree

Doc/doc/doc.tex

Lines changed: 74 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -297,21 +297,88 @@ \section{\LaTeX{} Primer \label{latex-primer}}
297297
\UNIX, followed by a comma, needs no additional markup.
298298
\end{verbatim}
299299

300-
An \dfn{environment} is ...
300+
An \dfn{environment} is a larger construct than a macro, and can
301+
be used for things with more content that would conveniently fit
302+
in a macro parameter. They are primarily used when formatting
303+
parameters need to be changed before and after a large chunk of
304+
content, but the content itself needs to be highly flexible. Code
305+
samples are presented using an environment, and descriptions of
306+
functions, methods, and classes are also marked using envionments.
307+
308+
Since the content of an environment is free-form and can consist
309+
of several paragraphs, they are actually marked using a pair of
310+
macros: \macro{begin} and \macro{end}. These macros both take the
311+
name of the environment as a parameter. An example is the
312+
environment used to mark the abstract of a document:
313+
314+
\begin{verbatim}
315+
\begin{abstract}
316+
This is the text of the abstract. It concisely explains what
317+
information is found in the document.
318+
319+
It can consist of multiple paragraphs.
320+
\end{abstract}
321+
\end{verbatim}
322+
323+
An environment can also have required and optional parameters of
324+
its own. These follow the parameter of the \macro{begin} macro.
325+
This example shows an environment which takes a single required
326+
parameter:
327+
328+
\begin{verbatim}
329+
\begin{datadesc}{datadesc}{controlnames}
330+
A 33-element string array that contains the \ASCII{} mnemonics for
331+
the thirty-two \ASCII{} control characters from 0 (NUL) to 0x1f
332+
(US), in order, plus the mnemonic \samp{SP} for the space character.
333+
\end{datadesc}
334+
\end{verbatim}
301335

302336
There are a number of less-used marks in \LaTeX{} are used to
303337
enter non-\ASCII{} characters, especially those used in European
304-
names. Some which are found in the Python documentation are:
338+
names. Given that these are often used adjacent to other
339+
characters, the markup required to produce the proper character
340+
may need to be followed by a space or an empty group, or the the
341+
markup can be enclosed in a group. Some which are found in Python
342+
documentation are:
305343

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.
344+
\begin{tableii}{c|l}{textrm}{Character}{Markup}
345+
\lineii{\c c}{\code{\e c c}}
346+
\lineii{\"o}{\code{\e"o}}
347+
\lineii{\o}{\code{\e o}}
348+
\end{tableii}
309349

310350

311351
\subsection{Hierarchical Structure}
312352

313-
XXX Talk about the traditional sectional hierarchy and how it's
314-
marked in \LaTeX.
353+
\LaTeX{} expects documents to be arranged in a conventional,
354+
hierarchical way, with chapters, sections, sub-sections,
355+
appendixes, and the like. These are marked using macros rather
356+
than environments, probably because the end of a section can be
357+
safely inferred when a section of equal or higher level starts.
358+
359+
There are six ``levels'' of sectioning in the document classes
360+
used for Python documentation, and the lowest two levels are not
361+
used. The levels are:
362+
363+
\begin{tableiii}{c|l|c}{textrm}{Level}{Macro Name}{Notes}
364+
\lineiii{1}{\macro{chapter}}{(1)}
365+
\lineiii{2}{\macro{section}}{}
366+
\lineiii{3}{\macro{subsection}}{}
367+
\lineiii{4}{\macro{subsubsections}}{}
368+
\lineiii{5}{\macro{paragraph}}{(2)}
369+
\lineiii{6}{\macro{subparagraph}}{}
370+
\end{tableiii}
371+
372+
\noindent
373+
Notes:
374+
375+
\begin{description}
376+
\item[(1)]
377+
Only used for the \code{manual} documents, as described in
378+
section \ref{classes}, ``Document Classes.''
379+
\item[(2)]
380+
Not the same as a paragraph of text; nobody seems to use this.
381+
\end{description}
315382

316383

317384
\section{Document Classes \label{classes}}

0 commit comments

Comments
 (0)