Blame doc/pdf/sphinxmanual.cls

Packit fd8b60
%
Packit fd8b60
% sphinxmanual.cls for Sphinx (http://sphinx-doc.org/)
Packit fd8b60
%
Packit fd8b60
Packit fd8b60
\NeedsTeXFormat{LaTeX2e}[1995/12/01]
Packit fd8b60
\ProvidesClass{sphinxmanual}[2017/03/26 v1.6 Document class (Sphinx manual)]
Packit fd8b60
Packit fd8b60
% chapters starting at odd pages (overridden by 'openany' document option)
Packit fd8b60
\PassOptionsToClass{openright}{\sphinxdocclass}
Packit fd8b60
Packit fd8b60
% 'oneside' option overriding the 'twoside' default
Packit fd8b60
\newif\if@oneside
Packit fd8b60
\DeclareOption{oneside}{\@onesidetrue}
Packit fd8b60
% Pass remaining document options to the parent class.
Packit fd8b60
\DeclareOption*{\PassOptionsToClass{\CurrentOption}{\sphinxdocclass}}
Packit fd8b60
\ProcessOptions\relax
Packit fd8b60
Packit fd8b60
% Defaults two-side document
Packit fd8b60
\if@oneside
Packit fd8b60
% nothing to do (oneside is the default)
Packit fd8b60
\else
Packit fd8b60
\PassOptionsToClass{twoside}{\sphinxdocclass}
Packit fd8b60
\fi
Packit fd8b60
Packit fd8b60
\LoadClass{\sphinxdocclass}
Packit fd8b60
Packit fd8b60
% Set some sane defaults for section numbering depth and TOC depth.  You can
Packit fd8b60
% reset these counters in your preamble.
Packit fd8b60
%
Packit fd8b60
\setcounter{secnumdepth}{2}
Packit fd8b60
\setcounter{tocdepth}{1}
Packit fd8b60
Packit fd8b60
% Change the title page to look a bit better, and fit in with the fncychap
Packit fd8b60
% ``Bjarne'' style a bit better.
Packit fd8b60
%
Packit fd8b60
\renewcommand{\maketitle}{%
Packit fd8b60
  \let\spx@tempa\relax
Packit fd8b60
  \ifHy@pageanchor\def\spx@tempa{\Hy@pageanchortrue}\fi
Packit fd8b60
  \hypersetup{pageanchor=false}% avoid duplicate destination warnings
Packit fd8b60
  \begin{titlepage}%
Packit fd8b60
    \let\footnotesize\small
Packit fd8b60
    \let\footnoterule\relax
Packit fd8b60
    \noindent\rule{\textwidth}{1pt}\par
Packit fd8b60
      \begingroup % for PDF information dictionary
Packit fd8b60
       \def\endgraf{ }\def\and{\& }%
Packit fd8b60
       \pdfstringdefDisableCommands{\def\\{, }}% overwrite hyperref setup
Packit fd8b60
       \hypersetup{pdfauthor={\@author}, pdftitle={\@title}}%
Packit fd8b60
      \endgroup
Packit fd8b60
    \begin{flushright}%
Packit fd8b60
      \sphinxlogo
Packit fd8b60
      \py@HeaderFamily
Packit fd8b60
      {\Huge \@title \par}
Packit fd8b60
      {\itshape\LARGE \py@release\releaseinfo \par}
Packit fd8b60
      \vfill
Packit fd8b60
      {\LARGE
Packit fd8b60
        \begin{tabular}[t]{c}
Packit fd8b60
          \@author
Packit fd8b60
        \end{tabular}
Packit fd8b60
        \par}
Packit fd8b60
      \vfill\vfill
Packit fd8b60
      {\large
Packit fd8b60
       \@date \par
Packit fd8b60
       \vfill
Packit fd8b60
       \py@authoraddress \par
Packit fd8b60
      }%
Packit fd8b60
    \end{flushright}%\par
Packit fd8b60
    \@thanks
Packit fd8b60
  \end{titlepage}%
Packit fd8b60
  \setcounter{footnote}{0}%
Packit fd8b60
  \let\thanks\relax\let\maketitle\relax
Packit fd8b60
  %\gdef\@thanks{}\gdef\@author{}\gdef\@title{}
Packit fd8b60
  \if@openright\cleardoublepage\else\clearpage\fi
Packit fd8b60
  \spx@tempa
Packit fd8b60
}
Packit fd8b60
Packit fd8b60
\newcommand{\sphinxtableofcontents}{%
Packit fd8b60
  \pagenumbering{roman}%
Packit fd8b60
  \pagestyle{plain}%
Packit fd8b60
  \begingroup
Packit fd8b60
    \parskip \z@skip
Packit fd8b60
    \tableofcontents
Packit fd8b60
  \endgroup
Packit fd8b60
  % before resetting page counter, let's do the right thing.
Packit fd8b60
  \if@openright\cleardoublepage\else\clearpage\fi
Packit fd8b60
  \pagenumbering{arabic}%
Packit fd8b60
  \ifdefined\fancyhf\pagestyle{normal}\fi
Packit fd8b60
}
Packit fd8b60
Packit fd8b60
% This is needed to get the width of the section # area wide enough in the
Packit fd8b60
% library reference.  Doing it here keeps it the same for all the manuals.
Packit fd8b60
%
Packit fd8b60
\renewcommand*\l@section{\@dottedtocline{1}{1.5em}{2.6em}}
Packit fd8b60
\renewcommand*\l@subsection{\@dottedtocline{2}{4.1em}{3.5em}}
Packit fd8b60
Packit fd8b60
% Fix the bibliography environment to add an entry to the Table of
Packit fd8b60
% Contents.
Packit fd8b60
% For a report document class this environment is a chapter.
Packit fd8b60
%
Packit fd8b60
\newenvironment{sphinxthebibliography}[1]{%
Packit fd8b60
  \if@openright\cleardoublepage\else\clearpage\fi
Packit fd8b60
  % \phantomsection % not needed here since TeXLive 2010's hyperref
Packit fd8b60
  \begin{thebibliography}{1}%
Packit fd8b60
  \addcontentsline{toc}{chapter}{\bibname}}{\end{thebibliography}}
Packit fd8b60
Packit fd8b60
% Same for the indices.
Packit fd8b60
% The memoir class already does this, so we don't duplicate it in that case.
Packit fd8b60
%
Packit fd8b60
\@ifclassloaded{memoir}
Packit fd8b60
 {\newenvironment{sphinxtheindex}{\begin{theindex}}{\end{theindex}}}
Packit fd8b60
 {\newenvironment{sphinxtheindex}{%
Packit fd8b60
    \if@openright\cleardoublepage\else\clearpage\fi
Packit fd8b60
    \phantomsection % needed as no chapter, section, ... created
Packit fd8b60
    \begin{theindex}%
Packit fd8b60
    \addcontentsline{toc}{chapter}{\indexname}}{\end{theindex}}}