LaTeX: \titleformat
last argument in sphinx.sty should be bracketed, not braced (and is anyhow not needed)
#8788
Labels
Milestone
Describe the bug
This is a prehistoric bug which gets back as far as I can tell to bd50766
The
\titleformat
from titlesec has only 5 mandatory arguments, the last one is optional and should be bracketed. But our style file uses:sphinx/sphinx/texinputs/sphinx.sty
Lines 716 to 729 in be20f17
As a result the macro
\py@NormalColor
is executed during the PDF build already during loading of package sphinx.sty. As its definition is\color{black}
this causes no harm and got undetected.I hit against the error while refactoring the LaTeX style files, and accidentally moved definition of
\py@NormalColor
to after it is used in\titleformat
.I was surprised by an
undefined control sequence
error on pdf build. Indeed TeX is a macro expansion language so at first I did not understand why\py@NormalColor
was expanded (at a time it is undefined). Turns out it should have beenAs it is braced,
\titleformat
leaves it in the token input stream and it gets executed. Which causes no harm when it has a definition such as\color{black}
as done in sphinx.sty on an earlier line.To Reproduce
Well, this does not cause a build error, and as all is internal to
sphinx.sty
loading one can not force one, but it is wrong nevertheless.Expected behavior
Use
\titleformat
according to documentationWe see that we don't need that
\py@NormalColor
anyhow as it got executed at the wrong time...The text was updated successfully, but these errors were encountered: