blob: 45939c9ca7fc19aea983bb12ae690911e6dd885c [file] [log] [blame]
Fred Drake6659c301998-03-03 22:02:19 +00001%
2% manual.cls for the Python documentation
3%
4
5\NeedsTeXFormat{LaTeX2e}[1995/12/01]
6\ProvidesClass{manual}
Fred Drake28f13911998-03-04 21:47:59 +00007 [1998/03/03 Document class (Python manual)]
8
Fred Drake724473f1998-04-25 04:12:17 +00009\RequirePackage{pypaper}
Fred Drake6659c301998-03-03 22:02:19 +000010
Fred Drake724473f1998-04-25 04:12:17 +000011% 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.
Fred Drake6659c301998-03-03 22:02:19 +000013%
Fred Drake724473f1998-04-25 04:12:17 +000014\LoadClass[\py@paper,\py@ptsize,twoside,openright]{report}
Fred Drake6659c301998-03-03 22:02:19 +000015
Fred Draked85b5a41999-06-29 18:15:59 +000016\setcounter{secnumdepth}{2}
Fred Drake6659c301998-03-03 22:02:19 +000017
18% Optional packages:
19%
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.
24%
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.
28%
Fred Drake6659c301998-03-03 22:02:19 +000029\RequirePackage{fancyhdr}\typeout{Using fancier footers than usual.}
Fred Drake6659c301998-03-03 22:02:19 +000030
31
Fred Drake55730311998-03-25 15:41:23 +000032% Required packages:
33%
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!
37%
38\RequirePackage[Bjarne]{fncychap}\typeout{Using fancy chapter headings.}
39% Do horizontal rules it this way to match:
Fred Drake2a3ab4f1998-04-28 18:31:50 +000040\newcommand{\py@doHorizontalRule}{\mghrulefill{\RW}}
Fred Drake55730311998-03-25 15:41:23 +000041%
Fred Drake6659c301998-03-03 22:02:19 +000042%
43% This gives us all the Python-specific markup that we really want.
44% This should come last. Do not change this.
45%
46\RequirePackage{python}
Fred Drake28f13911998-03-04 21:47:59 +000047
Fred Drake1cc6d531998-07-23 17:36:14 +000048% 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
55}
56
Fred Drake28f13911998-03-04 21:47:59 +000057
58% Change the title page to look a bit better, and fit in with the
59% fncychap ``Bjarne'' style a bit better.
60%
61\renewcommand{\maketitle}{%
62 \begin{titlepage}%
63 \let\footnotesize\small
64 \let\footnoterule\relax
Fred Drake2a3ab4f1998-04-28 18:31:50 +000065 \py@doHorizontalRule%
Fred Drake28f13911998-03-04 21:47:59 +000066 \@ifundefined{pdfinfo}{}{
Fred Drakec0b2e451998-03-25 14:53:43 +000067 \pdfinfo{
68 /Author (\@author)
69 /Title (\@title)
70 }
Fred Drake28f13911998-03-04 21:47:59 +000071 }
72 \begin{flushright}%
Fred Drake2a3ab4f1998-04-28 18:31:50 +000073 {\rm\Huge\py@HeaderFamily \@title \par}%
74 {\em\LARGE\py@HeaderFamily \py@release \par}
Fred Drake28f13911998-03-04 21:47:59 +000075 \vfill
Fred Drake2a3ab4f1998-04-28 18:31:50 +000076 {\LARGE\py@HeaderFamily \@author \par}
Fred Drake28f13911998-03-04 21:47:59 +000077 \vfill\vfill
78 {\large
79 \@date \par
80 \vfill
Fred Drake2a3ab4f1998-04-28 18:31:50 +000081 \py@authoraddress \par
Fred Drake28f13911998-03-04 21:47:59 +000082 }%
83 \end{flushright}%\par
84 \@thanks
85 \end{titlepage}%
86 \setcounter{footnote}{0}%
87 \let\thanks\relax\let\maketitle\relax
88 \gdef\@thanks{}\gdef\@author{}\gdef\@title{}
89}
90
91
Fred Drakeaa54e2d1998-03-05 16:41:42 +000092% Catch the end of the {abstract} environment, but here make sure the
93% abstract is followed by a blank page if the 'openright' option is used.
94%
Fred Drake2a3ab4f1998-04-28 18:31:50 +000095\let\py@OldEndAbstract=\endabstract
Fred Drakeaa54e2d1998-03-05 16:41:42 +000096\renewcommand{\endabstract}{
97 \if@openright
98 \ifodd\value{page}
99 \typeout{Adding blank page after the abstract.}
100 \vfil\pagebreak
101 \fi
102 \fi
Fred Drake2a3ab4f1998-04-28 18:31:50 +0000103 \py@OldEndAbstract
Fred Drakeaa54e2d1998-03-05 16:41:42 +0000104}
105
Fred Drake28f13911998-03-04 21:47:59 +0000106% This wraps the \tableofcontents macro with all the magic to get the
107% spacing right and have the right number of pages if the 'openright'
108% option has been used. This eliminates a fair amount of crud in the
109% individual document files.
110%
Fred Drake2a3ab4f1998-04-28 18:31:50 +0000111\let\py@OldTableofcontents=\tableofcontents
Fred Drake28f13911998-03-04 21:47:59 +0000112\renewcommand{\tableofcontents}{%
113 \setcounter{page}{1}%
114 \pagebreak%
115 \pagestyle{plain}%
116 {%
117 \parskip = 0mm%
Fred Drake2a3ab4f1998-04-28 18:31:50 +0000118 \py@OldTableofcontents%
Fred Drake28f13911998-03-04 21:47:59 +0000119 \if@openright%
120 \ifodd\value{page}%
121 \typeout{Adding blank page after the table of contents.}%
122 \pagebreak\hspace{0pt}%
123 \fi%
124 \fi%
125 \cleardoublepage%
126 }%
127 \pagenumbering{arabic}%
128 \@ifundefined{fancyhf}{}{\pagestyle{normal}}%
Fred Drake2a3ab4f1998-04-28 18:31:50 +0000129 \py@doing@page@targetstrue%
Fred Drake28f13911998-03-04 21:47:59 +0000130}
Fred Drake255284b1998-04-20 16:55:14 +0000131% This is needed to get the width of the section # area wide enough in the
132% library reference. Doing it here keeps it the same for all the manuals.
133%
134\renewcommand*\l@section{\@dottedtocline{1}{1.5em}{2.6em}}
135\renewcommand*\l@subsection{\@dottedtocline{2}{4.1em}{3.5em}}
Fred Drake889f53d1998-07-24 13:54:29 +0000136\setcounter{tocdepth}{1}
Fred Draked579ed81998-04-17 02:45:41 +0000137
138
139% Fix the theindex environment to add an entry to the Table of
140% Contents; this is much nicer than just having to jump to the end of
141% the book and flip around, especially with multiple indexes.
142%
Fred Drake2a3ab4f1998-04-28 18:31:50 +0000143\let\py@OldTheindex=\theindex
Fred Draked579ed81998-04-17 02:45:41 +0000144\renewcommand{\theindex}{
145 \cleardoublepage
Fred Drake2a3ab4f1998-04-28 18:31:50 +0000146 \py@OldTheindex
Fred Draked579ed81998-04-17 02:45:41 +0000147 \addcontentsline{toc}{chapter}{\indexname}
148}