mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
LaTeX: move some hard-coded re-definitions to user hook for TOC
This commit is contained in:
parent
da90d63e32
commit
8e14532b08
5
CHANGES
5
CHANGES
@ -45,6 +45,11 @@ Incompatible changes
|
|||||||
block. As a result, they are highlighted as python3 by default.
|
block. As a result, they are highlighted as python3 by default.
|
||||||
* The order of argument for ``HTMLTranslator``, ``HTML5Translator`` and
|
* The order of argument for ``HTMLTranslator``, ``HTML5Translator`` and
|
||||||
``ManualPageTranslator`` are changed
|
``ManualPageTranslator`` are changed
|
||||||
|
* LaTeX: hard-coded redefinitions of ``\l@section`` and ``\l@subsection``
|
||||||
|
formerly done during loading of ``'manual'`` docclass get executed later, at
|
||||||
|
time of ``\sphinxtableofcontents``. This means that custom user definitions
|
||||||
|
from LaTeX preamble now get overwritten. Use ``\sphinxtableofcontentshook``
|
||||||
|
to insert custom user definitions. See :ref:`latex-macros`.
|
||||||
|
|
||||||
Deprecated
|
Deprecated
|
||||||
----------
|
----------
|
||||||
|
@ -365,6 +365,8 @@ Here are some macros from the package file :file:`sphinx.sty` and class files
|
|||||||
:file:`sphinxhowto.cls`, :file:`sphinxmanual.cls`, which have public names
|
:file:`sphinxhowto.cls`, :file:`sphinxmanual.cls`, which have public names
|
||||||
thus allowing redefinitions. Check the respective files for the defaults.
|
thus allowing redefinitions. Check the respective files for the defaults.
|
||||||
|
|
||||||
|
.. _latex-macros:
|
||||||
|
|
||||||
Macros
|
Macros
|
||||||
~~~~~~
|
~~~~~~
|
||||||
|
|
||||||
@ -390,11 +392,18 @@ Macros
|
|||||||
.. versionadded:: 1.6.3
|
.. versionadded:: 1.6.3
|
||||||
``\sphinxstylecodecontinued`` and ``\sphinxstylecodecontinues``.
|
``\sphinxstylecodecontinued`` and ``\sphinxstylecodecontinues``.
|
||||||
- the table of contents is typeset via ``\sphinxtableofcontents`` which is a
|
- the table of contents is typeset via ``\sphinxtableofcontents`` which is a
|
||||||
wrapper (whose definition can be found in :file:`sphinxhowto.cls` or in
|
wrapper (defined differently in :file:`sphinxhowto.cls` and in
|
||||||
:file:`sphinxmanual.cls`) of standard ``\tableofcontents``.
|
:file:`sphinxmanual.cls`) of standard ``\tableofcontents``. The macro
|
||||||
|
``\sphinxtableofcontentshook`` is executed during its expansion right before
|
||||||
|
``\tableofcontents`` itself.
|
||||||
|
|
||||||
.. versionchanged:: 1.5
|
.. versionchanged:: 1.5
|
||||||
formerly, the meaning of ``\tableofcontents`` was modified by Sphinx.
|
formerly, the meaning of ``\tableofcontents`` was modified by Sphinx.
|
||||||
|
.. versionchanged:: 2.0
|
||||||
|
hard-coded redefinitions of ``\l@section`` and ``\l@subsection`` formerly
|
||||||
|
done during loading of ``'manual'`` docclass are now executed later via
|
||||||
|
``\sphinxtableofcontentshook``. This macro is also executed by the
|
||||||
|
``'howto'`` docclass, but defaults to empty with it.
|
||||||
- the ``\maketitle`` command is redefined by the class files
|
- the ``\maketitle`` command is redefined by the class files
|
||||||
:file:`sphinxmanual.cls` and :file:`sphinxhowto.cls`.
|
:file:`sphinxmanual.cls` and :file:`sphinxhowto.cls`.
|
||||||
- the citation reference is typeset via ``\sphinxcite`` which is a wrapper
|
- the citation reference is typeset via ``\sphinxcite`` which is a wrapper
|
||||||
|
@ -57,15 +57,16 @@
|
|||||||
%\gdef\@thanks{}\gdef\@author{}\gdef\@title{}
|
%\gdef\@thanks{}\gdef\@author{}\gdef\@title{}
|
||||||
}
|
}
|
||||||
|
|
||||||
\newcommand{\sphinxtableofcontents}{
|
\newcommand{\sphinxtableofcontents}{%
|
||||||
\begingroup
|
\begingroup
|
||||||
\parskip = 0mm
|
\parskip \z@skip
|
||||||
|
\sphinxtableofcontentshook
|
||||||
\tableofcontents
|
\tableofcontents
|
||||||
\endgroup
|
\endgroup
|
||||||
\rule{\textwidth}{1pt}
|
\noindent\rule{\textwidth}{1pt}\par
|
||||||
\vspace{12pt}
|
\vspace{12pt}%
|
||||||
}
|
}
|
||||||
|
\newcommand\sphinxtableofcontentshook{}
|
||||||
\pagenumbering{arabic}
|
\pagenumbering{arabic}
|
||||||
|
|
||||||
% Fix the bibliography environment to add an entry to the Table of
|
% Fix the bibliography environment to add an entry to the Table of
|
||||||
|
@ -77,6 +77,7 @@
|
|||||||
\pagenumbering{roman}%
|
\pagenumbering{roman}%
|
||||||
\begingroup
|
\begingroup
|
||||||
\parskip \z@skip
|
\parskip \z@skip
|
||||||
|
\sphinxtableofcontentshook
|
||||||
\tableofcontents
|
\tableofcontents
|
||||||
\endgroup
|
\endgroup
|
||||||
% before resetting page counter, let's do the right thing.
|
% before resetting page counter, let's do the right thing.
|
||||||
@ -87,8 +88,10 @@
|
|||||||
% This is needed to get the width of the section # area wide enough in the
|
% This is needed to get the width of the section # area wide enough in the
|
||||||
% library reference. Doing it here keeps it the same for all the manuals.
|
% library reference. Doing it here keeps it the same for all the manuals.
|
||||||
%
|
%
|
||||||
\renewcommand*\l@section{\@dottedtocline{1}{1.5em}{2.6em}}
|
\newcommand{\sphinxtableofcontentshook}{%
|
||||||
\renewcommand*\l@subsection{\@dottedtocline{2}{4.1em}{3.5em}}
|
\renewcommand*\l@section{\@dottedtocline{1}{1.5em}{2.6em}}%
|
||||||
|
\renewcommand*\l@subsection{\@dottedtocline{2}{4.1em}{3.5em}}%
|
||||||
|
}
|
||||||
|
|
||||||
% Fix the bibliography environment to add an entry to the Table of
|
% Fix the bibliography environment to add an entry to the Table of
|
||||||
% Contents.
|
% Contents.
|
||||||
|
Loading…
Reference in New Issue
Block a user