blob: ddaa404f15b8ff9dc9bca3ff29194aa0b4c51126 [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 Drake862b46b2004-03-31 08:08:34 +000010\RequirePackage{fancybox}
Fred Drake6659c301998-03-03 22:02:19 +000011
Fred Drake724473f1998-04-25 04:12:17 +000012% Change the options here to get a different set of basic options, but only
13% if you have to. Paper and font size should be adjusted in pypaper.sty.
Fred Drake6659c301998-03-03 22:02:19 +000014%
Fred Drake724473f1998-04-25 04:12:17 +000015\LoadClass[\py@paper,\py@ptsize,twoside,openright]{report}
Fred Drake6659c301998-03-03 22:02:19 +000016
Fred Draked85b5a41999-06-29 18:15:59 +000017\setcounter{secnumdepth}{2}
Fred Drake6659c301998-03-03 22:02:19 +000018
19% Optional packages:
20%
21% If processing of these documents fails at your TeX installation,
22% these may be commented out (independently) to make things work.
23% These are both supplied with the current version of the teTeX
24% distribution.
25%
26% The "fancyhdr" package makes nicer page footers reasonable to
27% implement, and is used to put the chapter and section information in
28% the footers.
29%
Fred Drake6659c301998-03-03 22:02:19 +000030\RequirePackage{fancyhdr}\typeout{Using fancier footers than usual.}
Fred Drake6659c301998-03-03 22:02:19 +000031
32
Fred Drake55730311998-03-25 15:41:23 +000033% Required packages:
34%
35% The "fncychap" package is used to get the nice chapter headers. The
36% .sty file is distributed with Python, so you should not need to disable
37% it. You'd also end up with a mixed page style; uglier than stock LaTeX!
38%
39\RequirePackage[Bjarne]{fncychap}\typeout{Using fancy chapter headings.}
40% Do horizontal rules it this way to match:
Fred Drake2a3ab4f1998-04-28 18:31:50 +000041\newcommand{\py@doHorizontalRule}{\mghrulefill{\RW}}
Fred Drake55730311998-03-25 15:41:23 +000042%
Fred Drake6659c301998-03-03 22:02:19 +000043%
44% This gives us all the Python-specific markup that we really want.
45% This should come last. Do not change this.
46%
47\RequirePackage{python}
Fred Drake28f13911998-03-04 21:47:59 +000048
Fred Drake1cc6d531998-07-23 17:36:14 +000049% support for module synopsis sections:
50\newcommand{\py@ModSynopsisFilename}{\jobname\thechapter.syn}
51\let\py@OldChapter=\chapter
52\renewcommand{\chapter}{
53 \py@ProcessModSynopsis
54 \py@closeModSynopsisFile
55 \py@OldChapter
56}
57
Fred Drake28f13911998-03-04 21:47:59 +000058
59% Change the title page to look a bit better, and fit in with the
60% fncychap ``Bjarne'' style a bit better.
61%
62\renewcommand{\maketitle}{%
63 \begin{titlepage}%
64 \let\footnotesize\small
65 \let\footnoterule\relax
Fred Drake2a3ab4f1998-04-28 18:31:50 +000066 \py@doHorizontalRule%
Fred Drakefe256432005-07-29 17:17:19 +000067 \ifpdf
68 \begingroup
Fred Drake8bdf0bf2000-09-05 15:19:56 +000069 % This \def is required to deal with multi-line authors; it
70 % changes \\ to ', ' (comma-space), making it pass muster for
71 % generating document info in the PDF file.
72 \def\\{, }
Fred Drakec0b2e451998-03-25 14:53:43 +000073 \pdfinfo{
74 /Author (\@author)
75 /Title (\@title)
76 }
Fred Drakefe256432005-07-29 17:17:19 +000077 \endgroup
78 \fi
Fred Drake28f13911998-03-04 21:47:59 +000079 \begin{flushright}%
Fred Drake2a3ab4f1998-04-28 18:31:50 +000080 {\rm\Huge\py@HeaderFamily \@title \par}%
Fred Drake7fe80a12002-03-15 22:38:16 +000081 {\em\LARGE\py@HeaderFamily \py@release\releaseinfo \par}
Fred Drake28f13911998-03-04 21:47:59 +000082 \vfill
Fred Drake2a3ab4f1998-04-28 18:31:50 +000083 {\LARGE\py@HeaderFamily \@author \par}
Fred Drake28f13911998-03-04 21:47:59 +000084 \vfill\vfill
85 {\large
86 \@date \par
87 \vfill
Fred Drake2a3ab4f1998-04-28 18:31:50 +000088 \py@authoraddress \par
Fred Drake28f13911998-03-04 21:47:59 +000089 }%
90 \end{flushright}%\par
91 \@thanks
92 \end{titlepage}%
93 \setcounter{footnote}{0}%
94 \let\thanks\relax\let\maketitle\relax
95 \gdef\@thanks{}\gdef\@author{}\gdef\@title{}
96}
97
98
Fred Drakeaa54e2d1998-03-05 16:41:42 +000099% Catch the end of the {abstract} environment, but here make sure the
100% abstract is followed by a blank page if the 'openright' option is used.
101%
Fred Drake2a3ab4f1998-04-28 18:31:50 +0000102\let\py@OldEndAbstract=\endabstract
Fred Drakeaa54e2d1998-03-05 16:41:42 +0000103\renewcommand{\endabstract}{
104 \if@openright
105 \ifodd\value{page}
106 \typeout{Adding blank page after the abstract.}
107 \vfil\pagebreak
108 \fi
109 \fi
Fred Drake2a3ab4f1998-04-28 18:31:50 +0000110 \py@OldEndAbstract
Fred Drakeaa54e2d1998-03-05 16:41:42 +0000111}
112
Fred Drake28f13911998-03-04 21:47:59 +0000113% This wraps the \tableofcontents macro with all the magic to get the
114% spacing right and have the right number of pages if the 'openright'
115% option has been used. This eliminates a fair amount of crud in the
116% individual document files.
117%
Fred Drake2a3ab4f1998-04-28 18:31:50 +0000118\let\py@OldTableofcontents=\tableofcontents
Fred Drake28f13911998-03-04 21:47:59 +0000119\renewcommand{\tableofcontents}{%
120 \setcounter{page}{1}%
121 \pagebreak%
122 \pagestyle{plain}%
123 {%
124 \parskip = 0mm%
Fred Drake2a3ab4f1998-04-28 18:31:50 +0000125 \py@OldTableofcontents%
Fred Drake28f13911998-03-04 21:47:59 +0000126 \if@openright%
127 \ifodd\value{page}%
128 \typeout{Adding blank page after the table of contents.}%
129 \pagebreak\hspace{0pt}%
130 \fi%
131 \fi%
132 \cleardoublepage%
133 }%
134 \pagenumbering{arabic}%
135 \@ifundefined{fancyhf}{}{\pagestyle{normal}}%
Fred Drake2a3ab4f1998-04-28 18:31:50 +0000136 \py@doing@page@targetstrue%
Fred Drake28f13911998-03-04 21:47:59 +0000137}
Fred Drake255284b1998-04-20 16:55:14 +0000138% This is needed to get the width of the section # area wide enough in the
139% library reference. Doing it here keeps it the same for all the manuals.
140%
141\renewcommand*\l@section{\@dottedtocline{1}{1.5em}{2.6em}}
142\renewcommand*\l@subsection{\@dottedtocline{2}{4.1em}{3.5em}}
Fred Drake889f53d1998-07-24 13:54:29 +0000143\setcounter{tocdepth}{1}
Fred Draked579ed81998-04-17 02:45:41 +0000144
145
146% Fix the theindex environment to add an entry to the Table of
147% Contents; this is much nicer than just having to jump to the end of
148% the book and flip around, especially with multiple indexes.
149%
Fred Drake2a3ab4f1998-04-28 18:31:50 +0000150\let\py@OldTheindex=\theindex
Fred Draked579ed81998-04-17 02:45:41 +0000151\renewcommand{\theindex}{
152 \cleardoublepage
Fred Drake2a3ab4f1998-04-28 18:31:50 +0000153 \py@OldTheindex
Fred Draked579ed81998-04-17 02:45:41 +0000154 \addcontentsline{toc}{chapter}{\indexname}
155}