blob: 21e74c9b1949502e8f119aec8a1cfadc579fc76a [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
16
17% Optional packages:
18%
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.
23%
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.
27%
Fred Drake6659c301998-03-03 22:02:19 +000028\RequirePackage{fancyhdr}\typeout{Using fancier footers than usual.}
Fred Drake6659c301998-03-03 22:02:19 +000029
30
Fred Drake55730311998-03-25 15:41:23 +000031% Required packages:
32%
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!
36%
37\RequirePackage[Bjarne]{fncychap}\typeout{Using fancy chapter headings.}
38% Do horizontal rules it this way to match:
Fred Drake2a3ab4f1998-04-28 18:31:50 +000039\newcommand{\py@doHorizontalRule}{\mghrulefill{\RW}}
Fred Drake55730311998-03-25 15:41:23 +000040%
Fred Drake6659c301998-03-03 22:02:19 +000041%
42% This gives us all the Python-specific markup that we really want.
43% This should come last. Do not change this.
44%
45\RequirePackage{python}
Fred Drake28f13911998-03-04 21:47:59 +000046
Fred Drake1cc6d531998-07-23 17:36:14 +000047% 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
54}
55
Fred Drake28f13911998-03-04 21:47:59 +000056
57% Change the title page to look a bit better, and fit in with the
58% fncychap ``Bjarne'' style a bit better.
59%
60\renewcommand{\maketitle}{%
61 \begin{titlepage}%
62 \let\footnotesize\small
63 \let\footnoterule\relax
Fred Drake2a3ab4f1998-04-28 18:31:50 +000064 \py@doHorizontalRule%
Fred Drake28f13911998-03-04 21:47:59 +000065 \@ifundefined{pdfinfo}{}{
Fred Drakec0b2e451998-03-25 14:53:43 +000066 \pdfinfo{
67 /Author (\@author)
68 /Title (\@title)
69 }
Fred Drake28f13911998-03-04 21:47:59 +000070 }
71 \begin{flushright}%
Fred Drake2a3ab4f1998-04-28 18:31:50 +000072 {\rm\Huge\py@HeaderFamily \@title \par}%
73 {\em\LARGE\py@HeaderFamily \py@release \par}
Fred Drake28f13911998-03-04 21:47:59 +000074 \vfill
Fred Drake2a3ab4f1998-04-28 18:31:50 +000075 {\LARGE\py@HeaderFamily \@author \par}
Fred Drake28f13911998-03-04 21:47:59 +000076 \vfill\vfill
77 {\large
78 \@date \par
79 \vfill
Fred Drake2a3ab4f1998-04-28 18:31:50 +000080 \py@authoraddress \par
Fred Drake28f13911998-03-04 21:47:59 +000081 }%
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{}
88}
89
90
Fred Drakeaa54e2d1998-03-05 16:41:42 +000091% 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.
93%
Fred Drake2a3ab4f1998-04-28 18:31:50 +000094\let\py@OldEndAbstract=\endabstract
Fred Drakeaa54e2d1998-03-05 16:41:42 +000095\renewcommand{\endabstract}{
96 \if@openright
97 \ifodd\value{page}
98 \typeout{Adding blank page after the abstract.}
99 \vfil\pagebreak
100 \fi
101 \fi
Fred Drake2a3ab4f1998-04-28 18:31:50 +0000102 \py@OldEndAbstract
Fred Drakeaa54e2d1998-03-05 16:41:42 +0000103}
104
Fred Drake28f13911998-03-04 21:47:59 +0000105% 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.
109%
Fred Drake2a3ab4f1998-04-28 18:31:50 +0000110\let\py@OldTableofcontents=\tableofcontents
Fred Drake28f13911998-03-04 21:47:59 +0000111\renewcommand{\tableofcontents}{%
112 \setcounter{page}{1}%
113 \pagebreak%
114 \pagestyle{plain}%
115 {%
116 \parskip = 0mm%
Fred Drake2a3ab4f1998-04-28 18:31:50 +0000117 \py@OldTableofcontents%
Fred Drake28f13911998-03-04 21:47:59 +0000118 \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%
125 }%
126 \pagenumbering{arabic}%
127 \@ifundefined{fancyhf}{}{\pagestyle{normal}}%
Fred Drake2a3ab4f1998-04-28 18:31:50 +0000128 \py@doing@page@targetstrue%
Fred Drake28f13911998-03-04 21:47:59 +0000129}
Fred Drake255284b1998-04-20 16:55:14 +0000130% 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.
132%
133\renewcommand*\l@section{\@dottedtocline{1}{1.5em}{2.6em}}
134\renewcommand*\l@subsection{\@dottedtocline{2}{4.1em}{3.5em}}
Fred Drake889f53d1998-07-24 13:54:29 +0000135\setcounter{tocdepth}{1}
Fred Draked579ed81998-04-17 02:45:41 +0000136
137
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.
141%
Fred Drake2a3ab4f1998-04-28 18:31:50 +0000142\let\py@OldTheindex=\theindex
Fred Draked579ed81998-04-17 02:45:41 +0000143\renewcommand{\theindex}{
144 \cleardoublepage
Fred Drake2a3ab4f1998-04-28 18:31:50 +0000145 \py@OldTheindex
Fred Draked579ed81998-04-17 02:45:41 +0000146 \addcontentsline{toc}{chapter}{\indexname}
147}