blob: e28d87f850390d5d057ade20151218315084d280 [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 Drake8bdf0bf2000-09-05 15:19:56 +000067 \@ifundefined{pdfinfo}{}{{
68 % This \def is required to deal with multi-line authors; it
69 % changes \\ to ', ' (comma-space), making it pass muster for
70 % generating document info in the PDF file.
71 \def\\{, }
Fred Drakec0b2e451998-03-25 14:53:43 +000072 \pdfinfo{
73 /Author (\@author)
74 /Title (\@title)
75 }
Fred Drake8bdf0bf2000-09-05 15:19:56 +000076 }}
Fred Drake28f13911998-03-04 21:47:59 +000077 \begin{flushright}%
Fred Drake2a3ab4f1998-04-28 18:31:50 +000078 {\rm\Huge\py@HeaderFamily \@title \par}%
Fred Drake7fe80a12002-03-15 22:38:16 +000079 {\em\LARGE\py@HeaderFamily \py@release\releaseinfo \par}
Fred Drake28f13911998-03-04 21:47:59 +000080 \vfill
Fred Drake2a3ab4f1998-04-28 18:31:50 +000081 {\LARGE\py@HeaderFamily \@author \par}
Fred Drake28f13911998-03-04 21:47:59 +000082 \vfill\vfill
83 {\large
84 \@date \par
85 \vfill
Fred Drake2a3ab4f1998-04-28 18:31:50 +000086 \py@authoraddress \par
Fred Drake28f13911998-03-04 21:47:59 +000087 }%
88 \end{flushright}%\par
89 \@thanks
90 \end{titlepage}%
91 \setcounter{footnote}{0}%
92 \let\thanks\relax\let\maketitle\relax
93 \gdef\@thanks{}\gdef\@author{}\gdef\@title{}
94}
95
96
Fred Drakeaa54e2d1998-03-05 16:41:42 +000097% Catch the end of the {abstract} environment, but here make sure the
98% abstract is followed by a blank page if the 'openright' option is used.
99%
Fred Drake2a3ab4f1998-04-28 18:31:50 +0000100\let\py@OldEndAbstract=\endabstract
Fred Drakeaa54e2d1998-03-05 16:41:42 +0000101\renewcommand{\endabstract}{
102 \if@openright
103 \ifodd\value{page}
104 \typeout{Adding blank page after the abstract.}
105 \vfil\pagebreak
106 \fi
107 \fi
Fred Drake2a3ab4f1998-04-28 18:31:50 +0000108 \py@OldEndAbstract
Fred Drakeaa54e2d1998-03-05 16:41:42 +0000109}
110
Fred Drake28f13911998-03-04 21:47:59 +0000111% This wraps the \tableofcontents macro with all the magic to get the
112% spacing right and have the right number of pages if the 'openright'
113% option has been used. This eliminates a fair amount of crud in the
114% individual document files.
115%
Fred Drake2a3ab4f1998-04-28 18:31:50 +0000116\let\py@OldTableofcontents=\tableofcontents
Fred Drake28f13911998-03-04 21:47:59 +0000117\renewcommand{\tableofcontents}{%
118 \setcounter{page}{1}%
119 \pagebreak%
120 \pagestyle{plain}%
121 {%
122 \parskip = 0mm%
Fred Drake2a3ab4f1998-04-28 18:31:50 +0000123 \py@OldTableofcontents%
Fred Drake28f13911998-03-04 21:47:59 +0000124 \if@openright%
125 \ifodd\value{page}%
126 \typeout{Adding blank page after the table of contents.}%
127 \pagebreak\hspace{0pt}%
128 \fi%
129 \fi%
130 \cleardoublepage%
131 }%
132 \pagenumbering{arabic}%
133 \@ifundefined{fancyhf}{}{\pagestyle{normal}}%
Fred Drake2a3ab4f1998-04-28 18:31:50 +0000134 \py@doing@page@targetstrue%
Fred Drake28f13911998-03-04 21:47:59 +0000135}
Fred Drake255284b1998-04-20 16:55:14 +0000136% This is needed to get the width of the section # area wide enough in the
137% library reference. Doing it here keeps it the same for all the manuals.
138%
139\renewcommand*\l@section{\@dottedtocline{1}{1.5em}{2.6em}}
140\renewcommand*\l@subsection{\@dottedtocline{2}{4.1em}{3.5em}}
Fred Drake889f53d1998-07-24 13:54:29 +0000141\setcounter{tocdepth}{1}
Fred Draked579ed81998-04-17 02:45:41 +0000142
143
144% Fix the theindex environment to add an entry to the Table of
145% Contents; this is much nicer than just having to jump to the end of
146% the book and flip around, especially with multiple indexes.
147%
Fred Drake2a3ab4f1998-04-28 18:31:50 +0000148\let\py@OldTheindex=\theindex
Fred Draked579ed81998-04-17 02:45:41 +0000149\renewcommand{\theindex}{
150 \cleardoublepage
Fred Drake2a3ab4f1998-04-28 18:31:50 +0000151 \py@OldTheindex
Fred Draked579ed81998-04-17 02:45:41 +0000152 \addcontentsline{toc}{chapter}{\indexname}
153}