|
1 % |
|
2 % manual.cls for Sphinx |
|
3 % |
|
4 |
|
5 \NeedsTeXFormat{LaTeX2e}[1995/12/01] |
|
6 \ProvidesClass{manual}[2008/10/18 Document class (Sphinx manual)] |
|
7 |
|
8 % Pass all given class options to the parent class. |
|
9 \DeclareOption*{\PassOptionsToClass{\CurrentOption}{report}} |
|
10 \ProcessOptions\relax |
|
11 \LoadClass[twoside,openright]{report} |
|
12 |
|
13 % Set some sane defaults for section numbering depth and TOC depth. You can |
|
14 % reset these counters in your preamble. |
|
15 % |
|
16 \setcounter{secnumdepth}{2} |
|
17 \setcounter{tocdepth}{1} |
|
18 |
|
19 % Change the title page to look a bit better, and fit in with the fncychap |
|
20 % ``Bjarne'' style a bit better. |
|
21 % |
|
22 \renewcommand{\maketitle}{% |
|
23 \begin{titlepage}% |
|
24 \let\footnotesize\small |
|
25 \let\footnoterule\relax |
|
26 \rule{\textwidth}{1pt}% |
|
27 \ifsphinxpdfoutput |
|
28 \begingroup |
|
29 % This \def is required to deal with multi-line authors; it |
|
30 % changes \\ to ', ' (comma-space), making it pass muster for |
|
31 % generating document info in the PDF file. |
|
32 \def\\{, } |
|
33 \pdfinfo{ |
|
34 /Author (\@author) |
|
35 /Title (\@title) |
|
36 } |
|
37 \endgroup |
|
38 \fi |
|
39 \begin{flushright}% |
|
40 \sphinxlogo% |
|
41 {\rm\Huge\py@HeaderFamily \@title \par}% |
|
42 {\em\LARGE\py@HeaderFamily \py@release\releaseinfo \par} |
|
43 \vfill |
|
44 {\LARGE\py@HeaderFamily \@author \par} |
|
45 \vfill\vfill |
|
46 {\large |
|
47 \@date \par |
|
48 \vfill |
|
49 \py@authoraddress \par |
|
50 }% |
|
51 \end{flushright}%\par |
|
52 \@thanks |
|
53 \end{titlepage}% |
|
54 \cleardoublepage% |
|
55 \setcounter{footnote}{0}% |
|
56 \let\thanks\relax\let\maketitle\relax |
|
57 %\gdef\@thanks{}\gdef\@author{}\gdef\@title{} |
|
58 } |
|
59 |
|
60 |
|
61 % Catch the end of the {abstract} environment, but here make sure the abstract |
|
62 % is followed by a blank page if the 'openright' option is used. |
|
63 % |
|
64 \let\py@OldEndAbstract=\endabstract |
|
65 \renewcommand{\endabstract}{ |
|
66 \if@openright |
|
67 \ifodd\value{page} |
|
68 \typeout{Adding blank page after the abstract.} |
|
69 \vfil\pagebreak |
|
70 \fi |
|
71 \fi |
|
72 \py@OldEndAbstract |
|
73 } |
|
74 |
|
75 % This wraps the \tableofcontents macro with all the magic to get the spacing |
|
76 % right and have the right number of pages if the 'openright' option has been |
|
77 % used. This eliminates a fair amount of crud in the individual document files. |
|
78 % |
|
79 \let\py@OldTableofcontents=\tableofcontents |
|
80 \renewcommand{\tableofcontents}{% |
|
81 \setcounter{page}{1}% |
|
82 \pagebreak% |
|
83 \pagestyle{plain}% |
|
84 {% |
|
85 \parskip = 0mm% |
|
86 \py@OldTableofcontents% |
|
87 \if@openright% |
|
88 \ifodd\value{page}% |
|
89 \typeout{Adding blank page after the table of contents.}% |
|
90 \pagebreak\hspace{0pt}% |
|
91 \fi% |
|
92 \fi% |
|
93 \cleardoublepage% |
|
94 }% |
|
95 \pagenumbering{arabic}% |
|
96 \@ifundefined{fancyhf}{}{\pagestyle{normal}}% |
|
97 } |
|
98 |
|
99 % This is needed to get the width of the section # area wide enough in the |
|
100 % library reference. Doing it here keeps it the same for all the manuals. |
|
101 % |
|
102 \renewcommand*\l@section{\@dottedtocline{1}{1.5em}{2.6em}} |
|
103 \renewcommand*\l@subsection{\@dottedtocline{2}{4.1em}{3.5em}} |