1 | % |
---|
2 | % sphinxhowto.cls for Sphinx (http://sphinx-doc.org/) |
---|
3 | % |
---|
4 | |
---|
5 | \NeedsTeXFormat{LaTeX2e}[1995/12/01] |
---|
6 | \ProvidesClass{sphinxhowto}[2018/12/22 v1.8.3 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 | \setcounter{tocdepth}{2}% i.e. section and subsection |
---|
29 | |
---|
30 | % Change the title page to look a bit better, and fit in with the fncychap |
---|
31 | % ``Bjarne'' style a bit better. |
---|
32 | % |
---|
33 | \newcommand{\sphinxmaketitle}{% |
---|
34 | \noindent\rule{\textwidth}{1pt}\par |
---|
35 | \begingroup % for PDF information dictionary |
---|
36 | \def\endgraf{ }\def\and{\& }% |
---|
37 | \pdfstringdefDisableCommands{\def\\{, }}% overwrite hyperref setup |
---|
38 | \hypersetup{pdfauthor={\@author}, pdftitle={\@title}}% |
---|
39 | \endgroup |
---|
40 | \begin{flushright} |
---|
41 | \sphinxlogo |
---|
42 | \py@HeaderFamily |
---|
43 | {\Huge \@title }\par |
---|
44 | {\itshape\large \py@release \releaseinfo}\par |
---|
45 | \vspace{25pt} |
---|
46 | {\Large |
---|
47 | \begin{tabular}[t]{c} |
---|
48 | \@author |
---|
49 | \end{tabular}}\par |
---|
50 | \vspace{25pt} |
---|
51 | \@date \par |
---|
52 | \py@authoraddress \par |
---|
53 | \end{flushright} |
---|
54 | \@thanks |
---|
55 | \setcounter{footnote}{0} |
---|
56 | \let\thanks\relax\let\maketitle\relax |
---|
57 | %\gdef\@thanks{}\gdef\@author{}\gdef\@title{} |
---|
58 | } |
---|
59 | |
---|
60 | \newcommand{\sphinxtableofcontents}{ |
---|
61 | \begingroup |
---|
62 | \parskip = 0mm |
---|
63 | \tableofcontents |
---|
64 | \endgroup |
---|
65 | \rule{\textwidth}{1pt} |
---|
66 | \vspace{12pt} |
---|
67 | } |
---|
68 | |
---|
69 | \pagenumbering{arabic} |
---|
70 | |
---|
71 | % Fix the bibliography environment to add an entry to the Table of |
---|
72 | % Contents. |
---|
73 | % For an article document class this environment is a section, |
---|
74 | % so no page break before it. |
---|
75 | % |
---|
76 | \newenvironment{sphinxthebibliography}[1]{% |
---|
77 | % \phantomsection % not needed here since TeXLive 2010's hyperref |
---|
78 | \begin{thebibliography}{#1}% |
---|
79 | \addcontentsline{toc}{section}{\ifdefined\refname\refname\else\ifdefined\bibname\bibname\fi\fi}}{\end{thebibliography}} |
---|
80 | |
---|
81 | |
---|
82 | % Same for the indices. |
---|
83 | % The memoir class already does this, so we don't duplicate it in that case. |
---|
84 | % |
---|
85 | \@ifclassloaded{memoir} |
---|
86 | {\newenvironment{sphinxtheindex}{\begin{theindex}}{\end{theindex}}} |
---|
87 | {\newenvironment{sphinxtheindex}{% |
---|
88 | \phantomsection % needed because no chapter, section, ... is created by theindex |
---|
89 | \begin{theindex}% |
---|
90 | \addcontentsline{toc}{section}{\indexname}}{\end{theindex}}} |
---|