docs/_build/latex/sphinxmanual.cls

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

mercurial