summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGrant Likely <grant.likely@arm.com>2020-09-16 14:29:27 +0100
committerGrant Likely <grant.likely@arm.com>2020-09-16 14:48:53 +0100
commitadd70354f1a49a5a6d4f8c1d0dd1fdf21fcd24cc (patch)
treed564c53589dab35e7afc78f8ad8b68304039a51b
parent008d0201e1b3475a60daffd6211dab8b501e3964 (diff)
downloadsphinx-git-add70354f1a49a5a6d4f8c1d0dd1fdf21fcd24cc.tar.gz
Fix 'oneside' latex output
Sphinx.sty had an FIXME bug where documents with the 'oneside' option would output lots of the following warnings when building the document: Package Fancyhdr Warning: \fancyfoot's `E' option without twoside option is useless on input line 309. Fix the problem by using \if@twoside around the offending tex code that tries to set format for the even pages. 'Even' pages don't exist on oneside builds, which causes the warning to be emitted. Fixes: #8215
-rw-r--r--CHANGES1
-rw-r--r--sphinx/texinputs/sphinx.sty15
2 files changed, 10 insertions, 6 deletions
diff --git a/CHANGES b/CHANGES
index 37719297f..583975c8e 100644
--- a/CHANGES
+++ b/CHANGES
@@ -28,6 +28,7 @@ Bugs fixed
* #8192: napoleon: description is disappeared when it contains inline literals
* #8093: The highlight warning has wrong location in some builders (LaTeX,
singlehtml and so on)
+* #8215: Eliminate Fancyhdr build warnings for oneside documents
Testing
--------
diff --git a/sphinx/texinputs/sphinx.sty b/sphinx/texinputs/sphinx.sty
index a3e91ad34..e52ed5975 100644
--- a/sphinx/texinputs/sphinx.sty
+++ b/sphinx/texinputs/sphinx.sty
@@ -588,12 +588,14 @@
{% classes with \chapter command
\fancypagestyle{normal}{
\fancyhf{}
- % FIXME: this presupposes "twoside".
- % If "oneside" class option, there are warnings in LaTeX log.
- \fancyfoot[LE,RO]{{\py@HeaderFamily\thepage}}
+ \fancyfoot[RO]{{\py@HeaderFamily\thepage}}
\fancyfoot[LO]{{\py@HeaderFamily\nouppercase{\rightmark}}}
- \fancyfoot[RE]{{\py@HeaderFamily\nouppercase{\leftmark}}}
- \fancyhead[LE,RO]{{\py@HeaderFamily \@title\sphinxheadercomma\py@release}}
+ \fancyhead[RO]{{\py@HeaderFamily \@title\sphinxheadercomma\py@release}}
+ \if@twoside
+ \fancyfoot[LE]{{\py@HeaderFamily\thepage}}
+ \fancyfoot[RE]{{\py@HeaderFamily\nouppercase{\leftmark}}}
+ \fancyhead[LE]{{\py@HeaderFamily \@title\sphinxheadercomma\py@release}}
+ \fi
\renewcommand{\headrulewidth}{0.4pt}
\renewcommand{\footrulewidth}{0.4pt}
% define chaptermark with \@chappos when \@chappos is available for Japanese
@@ -605,7 +607,8 @@
% page of a chapter `clean.'
\fancypagestyle{plain}{
\fancyhf{}
- \fancyfoot[LE,RO]{{\py@HeaderFamily\thepage}}
+ \fancyfoot[RO]{{\py@HeaderFamily\thepage}}
+ \if@twoside\fancyfoot[LE]{{\py@HeaderFamily\thepage}}\fi
\renewcommand{\headrulewidth}{0pt}
\renewcommand{\footrulewidth}{0.4pt}
}