1%% TITLES
2%
3% change this info string if making any custom modification
4\ProvidesFile{sphinxlatexstyleheadings.sty}[2021/01/27 headings]
5
6\RequirePackage[nobottomtitles*]{titlesec}
7\@ifpackagelater{titlesec}{2016/03/15}%
8 {\@ifpackagelater{titlesec}{2016/03/21}%
9  {}%
10  {\newif\ifsphinx@ttlpatch@ok
11   \IfFileExists{etoolbox.sty}{%
12     \RequirePackage{etoolbox}%
13     \patchcmd{\ttlh@hang}{\parindent\z@}{\parindent\z@\leavevmode}%
14                                {\sphinx@ttlpatch@oktrue}{}%
15     \ifsphinx@ttlpatch@ok
16     \patchcmd{\ttlh@hang}{\noindent}{}{}{\sphinx@ttlpatch@okfalse}%
17     \fi
18   }{}%
19   \ifsphinx@ttlpatch@ok
20     \typeout{^^J Package Sphinx Info: ^^J
21              **** titlesec 2.10.1 successfully patched for bugfix ****^^J}%
22   \else
23     \AtEndDocument{\PackageWarningNoLine{sphinx}{^^J%
24******** titlesec 2.10.1 has a bug, (section numbers disappear) ......|^^J%
25******** and Sphinx could not patch it, perhaps because your local ...|^^J%
26******** copy is already fixed without a changed release date. .......|^^J%
27******** If not, you must update titlesec! ...........................|}}%
28   \fi
29  }%
30 }{}
31
32% Augment the sectioning commands used to get our own font family in place,
33% and reset some internal data items (\titleformat from titlesec package)
34\titleformat{\section}{\Large\py@HeaderFamily}%
35            {\py@TitleColor\thesection}{0.5em}{\py@TitleColor}
36\titleformat{\subsection}{\large\py@HeaderFamily}%
37            {\py@TitleColor\thesubsection}{0.5em}{\py@TitleColor}
38\titleformat{\subsubsection}{\py@HeaderFamily}%
39            {\py@TitleColor\thesubsubsection}{0.5em}{\py@TitleColor}
40% By default paragraphs (and subsubsections) will not be numbered because
41% sphinxmanual.cls and sphinxhowto.cls set secnumdepth to 2
42\titleformat{\paragraph}{\py@HeaderFamily}%
43            {\py@TitleColor\theparagraph}{0.5em}{\py@TitleColor}
44\titleformat{\subparagraph}{\py@HeaderFamily}%
45            {\py@TitleColor\thesubparagraph}{0.5em}{\py@TitleColor}
46
47
48% Since Sphinx 1.5, users should use HeaderFamily key to 'sphinxsetup' rather
49% than defining their own \py@HeaderFamily command (which is still possible).
50% Memo: \py@HeaderFamily is also used by \maketitle as defined in
51% sphinxmanual.cls/sphinxhowto.cls
52\newcommand{\py@HeaderFamily}{\spx@opt@HeaderFamily}
53
54% This sets up the fancy chapter headings that make the documents look
55% at least a little better than the usual LaTeX output.
56\@ifpackagewith{fncychap}{Bjarne}{
57  \ChNameVar {\raggedleft\normalsize \py@HeaderFamily}
58  \ChNumVar  {\raggedleft\Large      \py@HeaderFamily}
59  \ChTitleVar{\raggedleft\Large      \py@HeaderFamily}
60  % This creates (numbered) chapter heads without the leading \vspace*{}:
61  \def\@makechapterhead#1{%
62    {\parindent \z@ \raggedright \normalfont
63      \ifnum \c@secnumdepth >\m@ne
64        \if@mainmatter
65          \DOCH
66        \fi
67      \fi
68      \interlinepenalty\@M
69      \if@mainmatter
70        \DOTI{#1}%
71      \else%
72        \DOTIS{#1}%
73      \fi
74    }}
75}{}% <-- "false" clause of \@ifpackagewith
76
77% fix fncychap's bug which uses prematurely the \textwidth value
78\@ifpackagewith{fncychap}{Bjornstrup}
79 {\AtBeginDocument{\mylen\textwidth\advance\mylen-2\myhi}}%
80 {}% <-- "false" clause of \@ifpackagewith
81
82
83\endinput
84