source: ntrip/branches/BNC_2.12/docs/sphinx/source/bncmanual.cls@ 8040

Last change on this file since 8040 was 8040, checked in by wiese, 8 years ago

ADD: Sphinx docu

File size: 4.0 KB
Line 
1%
2% sphinxmanual.cls for Sphinx (http://sphinx-doc.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% \pagenumbering{roman}%
101 \setcounter{page}{1}%
102 \pagebreak%
103 \pagestyle{plain}%
104 {%
105 \parskip = 0mm%
106 \py@OldTableofcontents%
107 \if@openright%
108 \ifodd\value{page}%
109 \typeout{Adding blank page after the table of contents.}%
110 \pagebreak\hspace{0pt}%
111 \fi%
112 \fi%
113% \cleardoublepage%
114 }%
115% \pagenumbering{arabic}%
116 \@ifundefined{fancyhf}{}{\pagestyle{normal}}%
117}
118\pagenumbering{alph}
119
120% This is needed to get the width of the section # area wide enough in the
121% library reference. Doing it here keeps it the same for all the manuals.
122%
123\renewcommand*\l@section{\@dottedtocline{1}{1.5em}{2.6em}}
124\renewcommand*\l@subsection{\@dottedtocline{2}{4.1em}{3.5em}}
125
126% Fix the bibliography environment to add an entry to the Table of
127% Contents.
128% For a report document class this environment is a chapter.
129\let\py@OldThebibliography=\thebibliography
130\renewcommand{\thebibliography}[1]{
131 \cleardoublepage
132 \phantomsection
133 \py@OldThebibliography{1}
134 \addcontentsline{toc}{chapter}{\bibname}
135}
136
137% Same for the indices.
138% The memoir class already does this, so we don't duplicate it in that case.
139%
140\@ifclassloaded{memoir}{}{
141 \let\py@OldTheindex=\theindex
142 \renewcommand{\theindex}{
143 \cleardoublepage
144 \phantomsection
145 \py@OldTheindex
146 \addcontentsline{toc}{chapter}{\indexname}
147 }
148}
Note: See TracBrowser for help on using the repository browser.