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