Files for 2.1b1 distribution.
[python/dscho.git] / Doc / texinputs / manual.cls
blob789cae13804738a0aba233eb7d4e2794788cfad8
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}
16 \setcounter{secnumdepth}{2}
18 % Optional packages:
20 % If processing of these documents fails at your TeX installation,
21 % these may be commented out (independently) to make things work.
22 % These are both supplied with the current version of the teTeX
23 % distribution.
25 % The "fancyhdr" package makes nicer page footers reasonable to
26 % implement, and is used to put the chapter and section information in
27 % the footers.
29 \RequirePackage{fancyhdr}\typeout{Using fancier footers than usual.}
32 % Required packages:
34 % The "fncychap" package is used to get the nice chapter headers. The
35 % .sty file is distributed with Python, so you should not need to disable
36 % it. You'd also end up with a mixed page style; uglier than stock LaTeX!
38 \RequirePackage[Bjarne]{fncychap}\typeout{Using fancy chapter headings.}
39 % Do horizontal rules it this way to match:
40 \newcommand{\py@doHorizontalRule}{\mghrulefill{\RW}}
43 % This gives us all the Python-specific markup that we really want.
44 % This should come last. Do not change this.
46 \RequirePackage{python}
48 % support for module synopsis sections:
49 \newcommand{\py@ModSynopsisFilename}{\jobname\thechapter.syn}
50 \let\py@OldChapter=\chapter
51 \renewcommand{\chapter}{
52 \py@ProcessModSynopsis
53 \py@closeModSynopsisFile
54 \py@OldChapter
58 % Change the title page to look a bit better, and fit in with the
59 % fncychap ``Bjarne'' style a bit better.
61 \renewcommand{\maketitle}{%
62 \begin{titlepage}%
63 \let\footnotesize\small
64 \let\footnoterule\relax
65 \py@doHorizontalRule%
66 \@ifundefined{pdfinfo}{}{{
67 % This \def is required to deal with multi-line authors; it
68 % changes \\ to ', ' (comma-space), making it pass muster for
69 % generating document info in the PDF file.
70 \def\\{, }
71 \pdfinfo{
72 /Author (\@author)
73 /Title (\@title)
76 \begin{flushright}%
77 {\rm\Huge\py@HeaderFamily \@title \par}%
78 {\em\LARGE\py@HeaderFamily \py@release \par}
79 \vfill
80 {\LARGE\py@HeaderFamily \@author \par}
81 \vfill\vfill
82 {\large
83 \@date \par
84 \vfill
85 \py@authoraddress \par
87 \end{flushright}%\par
88 \@thanks
89 \end{titlepage}%
90 \setcounter{footnote}{0}%
91 \let\thanks\relax\let\maketitle\relax
92 \gdef\@thanks{}\gdef\@author{}\gdef\@title{}
96 % Catch the end of the {abstract} environment, but here make sure the
97 % abstract is followed by a blank page if the 'openright' option is used.
99 \let\py@OldEndAbstract=\endabstract
100 \renewcommand{\endabstract}{
101 \if@openright
102 \ifodd\value{page}
103 \typeout{Adding blank page after the abstract.}
104 \vfil\pagebreak
107 \py@OldEndAbstract
110 % This wraps the \tableofcontents macro with all the magic to get the
111 % spacing right and have the right number of pages if the 'openright'
112 % option has been used. This eliminates a fair amount of crud in the
113 % individual document files.
115 \let\py@OldTableofcontents=\tableofcontents
116 \renewcommand{\tableofcontents}{%
117 \setcounter{page}{1}%
118 \pagebreak%
119 \pagestyle{plain}%
121 \parskip = 0mm%
122 \py@OldTableofcontents%
123 \if@openright%
124 \ifodd\value{page}%
125 \typeout{Adding blank page after the table of contents.}%
126 \pagebreak\hspace{0pt}%
127 \fi%
128 \fi%
129 \cleardoublepage%
131 \pagenumbering{arabic}%
132 \@ifundefined{fancyhf}{}{\pagestyle{normal}}%
133 \py@doing@page@targetstrue%
135 % This is needed to get the width of the section # area wide enough in the
136 % library reference. Doing it here keeps it the same for all the manuals.
138 \renewcommand*\l@section{\@dottedtocline{1}{1.5em}{2.6em}}
139 \renewcommand*\l@subsection{\@dottedtocline{2}{4.1em}{3.5em}}
140 \setcounter{tocdepth}{1}
143 % Fix the theindex environment to add an entry to the Table of
144 % Contents; this is much nicer than just having to jump to the end of
145 % the book and flip around, especially with multiple indexes.
147 \let\py@OldTheindex=\theindex
148 \renewcommand{\theindex}{
149 \cleardoublepage
150 \py@OldTheindex
151 \addcontentsline{toc}{chapter}{\indexname}