Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

129 строки
4.1KB

  1. %
  2. % sphinxmanual.cls for Sphinx (http://sphinx-doc.org/)
  3. %
  4. \NeedsTeXFormat{LaTeX2e}[1995/12/01]
  5. \ProvidesClass{sphinxmanual}[2019/12/01 v2.3.0 Document class (Sphinx manual)]
  6. % chapters starting at odd pages (overridden by 'openany' document option)
  7. \PassOptionsToClass{openright}{\sphinxdocclass}
  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. % Defaults two-side document
  15. \if@oneside
  16. % nothing to do (oneside is the default)
  17. \else
  18. \PassOptionsToClass{twoside}{\sphinxdocclass}
  19. \fi
  20. \LoadClass{\sphinxdocclass}
  21. % Set some sane defaults for section numbering depth and TOC depth. You can
  22. % reset these counters in your preamble.
  23. %
  24. \setcounter{secnumdepth}{2}
  25. \setcounter{tocdepth}{1}
  26. % Adapt \and command to the flushright context of \sphinxmaketitle, to
  27. % avoid ragged line endings if author names do not fit all on one single line
  28. \DeclareRobustCommand{\and}{%
  29. \end{tabular}\kern-\tabcolsep
  30. \allowbreak
  31. \hskip\dimexpr1em+\tabcolsep\@plus.17fil\begin{tabular}[t]{c}%
  32. }%
  33. % If it is desired that each author name be on its own line, use in preamble:
  34. %\DeclareRobustCommand{\and}{%
  35. % \end{tabular}\kern-\tabcolsep\\\begin{tabular}[t]{c}%
  36. %}%
  37. % Change the title page to look a bit better, and fit in with the fncychap
  38. % ``Bjarne'' style a bit better.
  39. %
  40. \newcommand{\sphinxmaketitle}{%
  41. \let\sphinxrestorepageanchorsetting\relax
  42. \ifHy@pageanchor\def\sphinxrestorepageanchorsetting{\Hy@pageanchortrue}\fi
  43. \hypersetup{pageanchor=false}% avoid duplicate destination warnings
  44. \begin{titlepage}%
  45. \let\footnotesize\small
  46. \let\footnoterule\relax
  47. \noindent\rule{\textwidth}{1pt}\par
  48. \begingroup % for PDF information dictionary
  49. \def\endgraf{ }\def\and{\& }%
  50. \pdfstringdefDisableCommands{\def\\{, }}% overwrite hyperref setup
  51. \hypersetup{pdfauthor={\@author}, pdftitle={\@title}}%
  52. \endgroup
  53. \begin{flushright}%
  54. \sphinxlogo
  55. \py@HeaderFamily
  56. {\Huge \@title \par}
  57. {\itshape\LARGE \py@release\releaseinfo \par}
  58. \vfill
  59. {\LARGE
  60. \begin{tabular}[t]{c}
  61. \@author
  62. \end{tabular}\kern-\tabcolsep
  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. \setcounter{footnote}{0}%
  74. \let\thanks\relax\let\maketitle\relax
  75. %\gdef\@thanks{}\gdef\@author{}\gdef\@title{}
  76. \clearpage
  77. \ifdefined\sphinxbackoftitlepage\sphinxbackoftitlepage\fi
  78. \if@openright\cleardoublepage\else\clearpage\fi
  79. \sphinxrestorepageanchorsetting
  80. }
  81. \newcommand{\sphinxtableofcontents}{%
  82. \pagenumbering{roman}%
  83. \begingroup
  84. \parskip \z@skip
  85. \sphinxtableofcontentshook
  86. \tableofcontents
  87. \endgroup
  88. % before resetting page counter, let's do the right thing.
  89. \if@openright\cleardoublepage\else\clearpage\fi
  90. \pagenumbering{arabic}%
  91. }
  92. % This is needed to get the width of the section # area wide enough in the
  93. % library reference. Doing it here keeps it the same for all the manuals.
  94. %
  95. \newcommand{\sphinxtableofcontentshook}{%
  96. \renewcommand*\l@section{\@dottedtocline{1}{1.5em}{2.6em}}%
  97. \renewcommand*\l@subsection{\@dottedtocline{2}{4.1em}{3.5em}}%
  98. }
  99. % Fix the bibliography environment to add an entry to the Table of
  100. % Contents.
  101. % For a report document class this environment is a chapter.
  102. %
  103. \newenvironment{sphinxthebibliography}[1]{%
  104. \if@openright\cleardoublepage\else\clearpage\fi
  105. % \phantomsection % not needed here since TeXLive 2010's hyperref
  106. \begin{thebibliography}{#1}%
  107. \addcontentsline{toc}{chapter}{\bibname}}{\end{thebibliography}}
  108. % Same for the indices.
  109. % The memoir class already does this, so we don't duplicate it in that case.
  110. %
  111. \@ifclassloaded{memoir}
  112. {\newenvironment{sphinxtheindex}{\begin{theindex}}{\end{theindex}}}
  113. {\newenvironment{sphinxtheindex}{%
  114. \if@openright\cleardoublepage\else\clearpage\fi
  115. \phantomsection % needed as no chapter, section, ... created
  116. \begin{theindex}%
  117. \addcontentsline{toc}{chapter}{\indexname}}{\end{theindex}}}