1 |
jgs |
82 |
% |
2 |
|
|
% manual.cls for the Python documentation |
3 |
|
|
% |
4 |
|
|
|
5 |
|
|
\NeedsTeXFormat{LaTeX2e}[1995/12/01] |
6 |
|
|
\ProvidesClass{manual} |
7 |
|
|
[1998/03/03 Document class (Python manual)] |
8 |
|
|
|
9 |
|
|
\RequirePackage{pypaper} |
10 |
gross |
572 |
\RequirePackage{fancybox} |
11 |
jgs |
82 |
|
12 |
|
|
% 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. |
14 |
|
|
% |
15 |
|
|
\LoadClass[\py@paper,\py@ptsize,twoside,openright]{report} |
16 |
|
|
|
17 |
|
|
\setcounter{secnumdepth}{2} |
18 |
|
|
|
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 |
|
|
% |
30 |
|
|
\RequirePackage{fancyhdr}\typeout{Using fancier footers than usual.} |
31 |
|
|
|
32 |
|
|
|
33 |
|
|
% 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: |
41 |
|
|
\newcommand{\py@doHorizontalRule}{\mghrulefill{\RW}} |
42 |
|
|
% |
43 |
|
|
% |
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} |
48 |
|
|
|
49 |
|
|
% 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 |
|
|
|
58 |
|
|
|
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 |
66 |
|
|
\py@doHorizontalRule% |
67 |
gross |
572 |
\ifpdf |
68 |
|
|
\begingroup |
69 |
jgs |
82 |
% 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 |
gross |
572 |
\endgroup |
78 |
|
|
\fi |
79 |
jgs |
82 |
\begin{flushright}% |
80 |
|
|
{\rm\Huge\py@HeaderFamily \@title \par}% |
81 |
|
|
{\em\LARGE\py@HeaderFamily \py@release\releaseinfo \par} |
82 |
|
|
\vfill |
83 |
|
|
{\LARGE\py@HeaderFamily \@author \par} |
84 |
|
|
\vfill\vfill |
85 |
|
|
{\large |
86 |
|
|
\@date \par |
87 |
|
|
\vfill |
88 |
|
|
\py@authoraddress \par |
89 |
|
|
}% |
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 |
|
|
|
99 |
|
|
% 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 |
|
|
% |
102 |
|
|
\let\py@OldEndAbstract=\endabstract |
103 |
|
|
\renewcommand{\endabstract}{ |
104 |
|
|
\if@openright |
105 |
|
|
\ifodd\value{page} |
106 |
|
|
\typeout{Adding blank page after the abstract.} |
107 |
|
|
\vfil\pagebreak |
108 |
|
|
\fi |
109 |
|
|
\fi |
110 |
|
|
\py@OldEndAbstract |
111 |
|
|
} |
112 |
|
|
|
113 |
|
|
% 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 |
|
|
% |
118 |
|
|
\let\py@OldTableofcontents=\tableofcontents |
119 |
|
|
\renewcommand{\tableofcontents}{% |
120 |
|
|
\setcounter{page}{1}% |
121 |
|
|
\pagebreak% |
122 |
|
|
\pagestyle{plain}% |
123 |
|
|
{% |
124 |
|
|
\parskip = 0mm% |
125 |
|
|
\py@OldTableofcontents% |
126 |
|
|
\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}}% |
136 |
|
|
\py@doing@page@targetstrue% |
137 |
|
|
} |
138 |
|
|
% 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}} |
143 |
|
|
\setcounter{tocdepth}{1} |
144 |
|
|
|
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 |
|
|
% |
150 |
|
|
\let\py@OldTheindex=\theindex |
151 |
|
|
\renewcommand{\theindex}{ |
152 |
|
|
\cleardoublepage |
153 |
|
|
\py@OldTheindex |
154 |
|
|
\addcontentsline{toc}{chapter}{\indexname} |
155 |
|
|
} |