3
|
1 |
%
|
|
2 |
% sphinxhowto.cls for Sphinx (http://sphinx-doc.org/)
|
|
3 |
%
|
|
4 |
|
|
5 |
\NeedsTeXFormat{LaTeX2e}[1995/12/01]
|
|
6 |
\ProvidesClass{sphinxhowto}[2017/03/26 v1.6 Document class (Sphinx HOWTO)]
|
|
7 |
|
|
8 |
% 'oneside' option overriding the 'twoside' default
|
|
9 |
\newif\if@oneside
|
|
10 |
\DeclareOption{oneside}{\@onesidetrue}
|
|
11 |
% Pass remaining document options to the parent class.
|
|
12 |
\DeclareOption*{\PassOptionsToClass{\CurrentOption}{\sphinxdocclass}}
|
|
13 |
\ProcessOptions\relax
|
|
14 |
|
|
15 |
% Default to two-side document
|
|
16 |
\if@oneside
|
|
17 |
% nothing to do (oneside is the default)
|
|
18 |
\else
|
|
19 |
\PassOptionsToClass{twoside}{\sphinxdocclass}
|
|
20 |
\fi
|
|
21 |
|
|
22 |
\LoadClass{\sphinxdocclass}
|
|
23 |
|
|
24 |
% Set some sane defaults for section numbering depth and TOC depth. You can
|
|
25 |
% reset these counters in your preamble.
|
|
26 |
%
|
|
27 |
\setcounter{secnumdepth}{2}
|
|
28 |
|
|
29 |
% Change the title page to look a bit better, and fit in with the fncychap
|
|
30 |
% ``Bjarne'' style a bit better.
|
|
31 |
%
|
|
32 |
\renewcommand{\maketitle}{%
|
|
33 |
\noindent\rule{\textwidth}{1pt}\par
|
|
34 |
\begingroup % for PDF information dictionary
|
|
35 |
\def\endgraf{ }\def\and{\& }%
|
|
36 |
\pdfstringdefDisableCommands{\def\\{, }}% overwrite hyperref setup
|
|
37 |
\hypersetup{pdfauthor={\@author}, pdftitle={\@title}}%
|
|
38 |
\endgroup
|
|
39 |
\begin{flushright}
|
|
40 |
\sphinxlogo
|
|
41 |
\py@HeaderFamily
|
|
42 |
{\Huge \@title }\par
|
|
43 |
{\itshape\large \py@release \releaseinfo}\par
|
|
44 |
\vspace{25pt}
|
|
45 |
{\Large
|
|
46 |
\begin{tabular}[t]{c}
|
|
47 |
\@author
|
|
48 |
\end{tabular}}\par
|
|
49 |
\vspace{25pt}
|
|
50 |
\@date \par
|
|
51 |
\py@authoraddress \par
|
|
52 |
\end{flushright}
|
|
53 |
\@thanks
|
|
54 |
\setcounter{footnote}{0}
|
|
55 |
\let\thanks\relax\let\maketitle\relax
|
|
56 |
%\gdef\@thanks{}\gdef\@author{}\gdef\@title{}
|
|
57 |
}
|
|
58 |
|
|
59 |
\newcommand{\sphinxtableofcontents}{
|
|
60 |
\begingroup
|
|
61 |
\parskip = 0mm
|
|
62 |
\tableofcontents
|
|
63 |
\endgroup
|
|
64 |
\rule{\textwidth}{1pt}
|
|
65 |
\vspace{12pt}
|
|
66 |
}
|
|
67 |
|
|
68 |
\@ifundefined{fancyhf}{
|
|
69 |
\pagestyle{plain}}{
|
|
70 |
\pagestyle{normal}} % start this way; change for
|
|
71 |
\pagenumbering{arabic} % ToC & chapters
|
|
72 |
|
|
73 |
\thispagestyle{empty}
|
|
74 |
|
|
75 |
% Fix the bibliography environment to add an entry to the Table of
|
|
76 |
% Contents.
|
|
77 |
% For an article document class this environment is a section,
|
|
78 |
% so no page break before it.
|
|
79 |
%
|
|
80 |
\newenvironment{sphinxthebibliography}[1]{%
|
|
81 |
% \phantomsection % not needed here since TeXLive 2010's hyperref
|
|
82 |
\begin{thebibliography}{1}%
|
|
83 |
\addcontentsline{toc}{section}{\ifdefined\refname\refname\else\ifdefined\bibname\bibname\fi\fi}}{\end{thebibliography}}
|
|
84 |
|
|
85 |
|
|
86 |
% Same for the indices.
|
|
87 |
% The memoir class already does this, so we don't duplicate it in that case.
|
|
88 |
%
|
|
89 |
\@ifclassloaded{memoir}
|
|
90 |
{\newenvironment{sphinxtheindex}{\begin{theindex}}{\end{theindex}}}
|
|
91 |
{\newenvironment{sphinxtheindex}{%
|
|
92 |
\phantomsection % needed because no chapter, section, ... is created by theindex
|
|
93 |
\begin{theindex}%
|
|
94 |
\addcontentsline{toc}{section}{\indexname}}{\end{theindex}}}
|