1 |
jgs |
82 |
% $Id$ |
2 |
|
|
|
3 |
|
|
% |
4 |
|
|
% manual.cls for the Python documentation |
5 |
|
|
% |
6 |
|
|
|
7 |
|
|
\NeedsTeXFormat{LaTeX2e}[1995/12/01] |
8 |
|
|
\ProvidesClass{manual} |
9 |
|
|
[1998/03/03 Document class (Python manual)] |
10 |
|
|
|
11 |
|
|
\RequirePackage{pypaper} |
12 |
|
|
|
13 |
|
|
% Change the options here to get a different set of basic options, but only |
14 |
|
|
% if you have to. Paper and font size should be adjusted in pypaper.sty. |
15 |
|
|
% |
16 |
|
|
\LoadClass[\py@paper,\py@ptsize,twoside,openright]{report} |
17 |
|
|
|
18 |
|
|
\setcounter{secnumdepth}{2} |
19 |
|
|
|
20 |
|
|
% Optional packages: |
21 |
|
|
% |
22 |
|
|
% If processing of these documents fails at your TeX installation, |
23 |
|
|
% these may be commented out (independently) to make things work. |
24 |
|
|
% These are both supplied with the current version of the teTeX |
25 |
|
|
% distribution. |
26 |
|
|
% |
27 |
|
|
% The "fancyhdr" package makes nicer page footers reasonable to |
28 |
|
|
% implement, and is used to put the chapter and section information in |
29 |
|
|
% the footers. |
30 |
|
|
% |
31 |
|
|
\RequirePackage{fancyhdr}\typeout{Using fancier footers than usual.} |
32 |
|
|
|
33 |
|
|
|
34 |
|
|
% Required packages: |
35 |
|
|
% |
36 |
|
|
% The "fncychap" package is used to get the nice chapter headers. The |
37 |
|
|
% .sty file is distributed with Python, so you should not need to disable |
38 |
|
|
% it. You'd also end up with a mixed page style; uglier than stock LaTeX! |
39 |
|
|
% |
40 |
|
|
\RequirePackage[Bjarne]{fncychap}\typeout{Using fancy chapter headings.} |
41 |
|
|
% Do horizontal rules it this way to match: |
42 |
|
|
\newcommand{\py@doHorizontalRule}{\mghrulefill{\RW}} |
43 |
|
|
% |
44 |
|
|
% |
45 |
|
|
% This gives us all the Python-specific markup that we really want. |
46 |
|
|
% This should come last. Do not change this. |
47 |
|
|
% |
48 |
|
|
\RequirePackage{python} |
49 |
|
|
|
50 |
|
|
% support for module synopsis sections: |
51 |
|
|
\newcommand{\py@ModSynopsisFilename}{\jobname\thechapter.syn} |
52 |
|
|
\let\py@OldChapter=\chapter |
53 |
|
|
\renewcommand{\chapter}{ |
54 |
|
|
\py@ProcessModSynopsis |
55 |
|
|
\py@closeModSynopsisFile |
56 |
|
|
\py@OldChapter |
57 |
|
|
} |
58 |
|
|
|
59 |
|
|
|
60 |
|
|
% Change the title page to look a bit better, and fit in with the |
61 |
|
|
% fncychap ``Bjarne'' style a bit better. |
62 |
|
|
% |
63 |
|
|
\renewcommand{\maketitle}{% |
64 |
|
|
\begin{titlepage}% |
65 |
|
|
\let\footnotesize\small |
66 |
|
|
\let\footnoterule\relax |
67 |
|
|
\py@doHorizontalRule% |
68 |
|
|
\@ifundefined{pdfinfo}{}{{ |
69 |
|
|
% 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\\{, } |
73 |
|
|
\pdfinfo{ |
74 |
|
|
/Author (\@author) |
75 |
|
|
/Title (\@title) |
76 |
|
|
} |
77 |
|
|
}} |
78 |
|
|
\begin{flushright}% |
79 |
|
|
{\rm\Huge\py@HeaderFamily \@title \par}% |
80 |
|
|
{\em\LARGE\py@HeaderFamily \py@release\releaseinfo \par} |
81 |
|
|
\vfill |
82 |
|
|
{\LARGE\py@HeaderFamily \@author \par} |
83 |
|
|
\vfill\vfill |
84 |
|
|
{\large |
85 |
|
|
\@date \par |
86 |
|
|
\vfill |
87 |
|
|
\py@authoraddress \par |
88 |
|
|
}% |
89 |
|
|
\end{flushright}%\par |
90 |
|
|
\@thanks |
91 |
|
|
\end{titlepage}% |
92 |
|
|
\setcounter{footnote}{0}% |
93 |
|
|
\let\thanks\relax\let\maketitle\relax |
94 |
|
|
\gdef\@thanks{}\gdef\@author{}\gdef\@title{} |
95 |
|
|
} |
96 |
|
|
|
97 |
|
|
|
98 |
|
|
% Catch the end of the {abstract} environment, but here make sure the |
99 |
|
|
% abstract is followed by a blank page if the 'openright' option is used. |
100 |
|
|
% |
101 |
|
|
\let\py@OldEndAbstract=\endabstract |
102 |
|
|
\renewcommand{\endabstract}{ |
103 |
|
|
\if@openright |
104 |
|
|
\ifodd\value{page} |
105 |
|
|
\typeout{Adding blank page after the abstract.} |
106 |
|
|
\vfil\pagebreak |
107 |
|
|
\fi |
108 |
|
|
\fi |
109 |
|
|
\py@OldEndAbstract |
110 |
|
|
} |
111 |
|
|
|
112 |
|
|
% This wraps the \tableofcontents macro with all the magic to get the |
113 |
|
|
% spacing right and have the right number of pages if the 'openright' |
114 |
|
|
% option has been used. This eliminates a fair amount of crud in the |
115 |
|
|
% individual document files. |
116 |
|
|
% |
117 |
|
|
\let\py@OldTableofcontents=\tableofcontents |
118 |
|
|
\renewcommand{\tableofcontents}{% |
119 |
|
|
\setcounter{page}{1}% |
120 |
|
|
\pagebreak% |
121 |
|
|
\pagestyle{plain}% |
122 |
|
|
{% |
123 |
|
|
\parskip = 0mm% |
124 |
|
|
\py@OldTableofcontents% |
125 |
|
|
\if@openright% |
126 |
|
|
\ifodd\value{page}% |
127 |
|
|
\typeout{Adding blank page after the table of contents.}% |
128 |
|
|
\pagebreak\hspace{0pt}% |
129 |
|
|
\fi% |
130 |
|
|
\fi% |
131 |
|
|
\cleardoublepage% |
132 |
|
|
}% |
133 |
|
|
\pagenumbering{arabic}% |
134 |
|
|
\@ifundefined{fancyhf}{}{\pagestyle{normal}}% |
135 |
|
|
\py@doing@page@targetstrue% |
136 |
|
|
} |
137 |
|
|
% This is needed to get the width of the section # area wide enough in the |
138 |
|
|
% library reference. Doing it here keeps it the same for all the manuals. |
139 |
|
|
% |
140 |
|
|
\renewcommand*\l@section{\@dottedtocline{1}{1.5em}{2.6em}} |
141 |
|
|
\renewcommand*\l@subsection{\@dottedtocline{2}{4.1em}{3.5em}} |
142 |
|
|
\setcounter{tocdepth}{1} |
143 |
|
|
|
144 |
|
|
|
145 |
|
|
% Fix the theindex environment to add an entry to the Table of |
146 |
|
|
% Contents; this is much nicer than just having to jump to the end of |
147 |
|
|
% the book and flip around, especially with multiple indexes. |
148 |
|
|
% |
149 |
|
|
\let\py@OldTheindex=\theindex |
150 |
|
|
\renewcommand{\theindex}{ |
151 |
|
|
\cleardoublepage |
152 |
|
|
\py@OldTheindex |
153 |
|
|
\addcontentsline{toc}{chapter}{\indexname} |
154 |
|
|
} |