Clarify portability and main program.
[python/dscho.git] / Doc / texinputs / manual.cls
blob21e74c9b1949502e8f119aec8a1cfadc579fc76a
2 % manual.cls for the Python documentation
5 \NeedsTeXFormat{LaTeX2e}[1995/12/01]
6 \ProvidesClass{manual}
7 [1998/03/03 Document class (Python manual)]
9 \RequirePackage{pypaper}
11 % Change the options here to get a different set of basic options, but only
12 % if you have to. Paper and font size should be adjusted in pypaper.sty.
14 \LoadClass[\py@paper,\py@ptsize,twoside,openright]{report}
17 % Optional packages:
19 % If processing of these documents fails at your TeX installation,
20 % these may be commented out (independently) to make things work.
21 % These are both supplied with the current version of the teTeX
22 % distribution.
24 % The "fancyhdr" package makes nicer page footers reasonable to
25 % implement, and is used to put the chapter and section information in
26 % the footers.
28 \RequirePackage{fancyhdr}\typeout{Using fancier footers than usual.}
31 % Required packages:
33 % The "fncychap" package is used to get the nice chapter headers. The
34 % .sty file is distributed with Python, so you should not need to disable
35 % it. You'd also end up with a mixed page style; uglier than stock LaTeX!
37 \RequirePackage[Bjarne]{fncychap}\typeout{Using fancy chapter headings.}
38 % Do horizontal rules it this way to match:
39 \newcommand{\py@doHorizontalRule}{\mghrulefill{\RW}}
42 % This gives us all the Python-specific markup that we really want.
43 % This should come last. Do not change this.
45 \RequirePackage{python}
47 % support for module synopsis sections:
48 \newcommand{\py@ModSynopsisFilename}{\jobname\thechapter.syn}
49 \let\py@OldChapter=\chapter
50 \renewcommand{\chapter}{
51 \py@ProcessModSynopsis
52 \py@closeModSynopsisFile
53 \py@OldChapter
57 % Change the title page to look a bit better, and fit in with the
58 % fncychap ``Bjarne'' style a bit better.
60 \renewcommand{\maketitle}{%
61 \begin{titlepage}%
62 \let\footnotesize\small
63 \let\footnoterule\relax
64 \py@doHorizontalRule%
65 \@ifundefined{pdfinfo}{}{
66 \pdfinfo{
67 /Author (\@author)
68 /Title (\@title)
71 \begin{flushright}%
72 {\rm\Huge\py@HeaderFamily \@title \par}%
73 {\em\LARGE\py@HeaderFamily \py@release \par}
74 \vfill
75 {\LARGE\py@HeaderFamily \@author \par}
76 \vfill\vfill
77 {\large
78 \@date \par
79 \vfill
80 \py@authoraddress \par
82 \end{flushright}%\par
83 \@thanks
84 \end{titlepage}%
85 \setcounter{footnote}{0}%
86 \let\thanks\relax\let\maketitle\relax
87 \gdef\@thanks{}\gdef\@author{}\gdef\@title{}
91 % Catch the end of the {abstract} environment, but here make sure the
92 % abstract is followed by a blank page if the 'openright' option is used.
94 \let\py@OldEndAbstract=\endabstract
95 \renewcommand{\endabstract}{
96 \if@openright
97 \ifodd\value{page}
98 \typeout{Adding blank page after the abstract.}
99 \vfil\pagebreak
102 \py@OldEndAbstract
105 % This wraps the \tableofcontents macro with all the magic to get the
106 % spacing right and have the right number of pages if the 'openright'
107 % option has been used. This eliminates a fair amount of crud in the
108 % individual document files.
110 \let\py@OldTableofcontents=\tableofcontents
111 \renewcommand{\tableofcontents}{%
112 \setcounter{page}{1}%
113 \pagebreak%
114 \pagestyle{plain}%
116 \parskip = 0mm%
117 \py@OldTableofcontents%
118 \if@openright%
119 \ifodd\value{page}%
120 \typeout{Adding blank page after the table of contents.}%
121 \pagebreak\hspace{0pt}%
122 \fi%
123 \fi%
124 \cleardoublepage%
126 \pagenumbering{arabic}%
127 \@ifundefined{fancyhf}{}{\pagestyle{normal}}%
128 \py@doing@page@targetstrue%
130 % This is needed to get the width of the section # area wide enough in the
131 % library reference. Doing it here keeps it the same for all the manuals.
133 \renewcommand*\l@section{\@dottedtocline{1}{1.5em}{2.6em}}
134 \renewcommand*\l@subsection{\@dottedtocline{2}{4.1em}{3.5em}}
135 \setcounter{tocdepth}{1}
138 % Fix the theindex environment to add an entry to the Table of
139 % Contents; this is much nicer than just having to jump to the end of
140 % the book and flip around, especially with multiple indexes.
142 \let\py@OldTheindex=\theindex
143 \renewcommand{\theindex}{
144 \cleardoublepage
145 \py@OldTheindex
146 \addcontentsline{toc}{chapter}{\indexname}