Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit f1b7969

Browse files
committed
Fix sphinx-doc#5453 and move LaTeX \pagestyle to template
1 parent f79caff commit f1b7969

4 files changed

Lines changed: 40 additions & 21 deletions

File tree

sphinx/templates/latex/latex.tex_t

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,11 @@
5151
<%= makeindex %>
5252
\begin{document}
5353
<%= shorthandoff %>
54+
\pagestyle{empty}
5455
<%= maketitle %>
56+
\pagestyle{plain}
5557
<%= tableofcontents %>
58+
\pagestyle{normal}
5659
<%= body %>
5760
<%= atendofbody %>
5861
<%= indices %>

sphinx/texinputs/sphinx.sty

Lines changed: 34 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
%
77

88
\NeedsTeXFormat{LaTeX2e}[1995/12/01]
9-
\ProvidesPackage{sphinx}[2018/07/18 v1.8 LaTeX package (Sphinx markup)]
9+
\ProvidesPackage{sphinx}[2018/09/18 v1.8.1 LaTeX package (Sphinx markup)]
1010

1111
% provides \ltx@ifundefined
1212
% (many packages load ltxcmds: graphicx does for pdftex and lualatex but
@@ -499,15 +499,31 @@
499499
\sloppy
500500
\hbadness = 5000 % don't print trivial gripes
501501

502-
\pagestyle{empty} % start this way
503-
502+
% Use \pagestyle{normal} as the primary pagestyle for text.
504503
% Redefine the 'normal' header/footer style when using "fancyhdr" package:
505-
% Note: this presupposes "twoside". If "oneside" class option, there will be warnings.
506-
\ltx@ifundefined{fancyhf}{}{
507-
% Use \pagestyle{normal} as the primary pagestyle for text.
508-
\fancypagestyle{normal}{
504+
\@ifpackageloaded{fancyhdr}{%
505+
\ltx@ifundefined{c@chapter}
506+
{% no \chapter, "howto" (non-Japanese) docclass
507+
\fancypagestyle{plain}{
508+
\fancyhf{}
509+
\fancyfoot[C]{{\py@HeaderFamily\thepage}}
510+
\renewcommand{\headrulewidth}{0pt}
511+
\renewcommand{\footrulewidth}{0pt}
512+
}
513+
% Same as 'plain', this way we can use it in template
514+
% FIXME: shouldn't this have a running header with Name and Release like 'manual'?
515+
\fancypagestyle{normal}{
516+
\fancyhf{}
517+
\fancyfoot[C]{{\py@HeaderFamily\thepage}}
518+
\renewcommand{\headrulewidth}{0pt}
519+
\renewcommand{\footrulewidth}{0pt}
520+
}
521+
}%
522+
{% classes with \chapter command
523+
\fancypagestyle{normal}{
509524
\fancyhf{}
510-
% (for \py@HeaderFamily cf "TITLES")
525+
% FIXME: this presupposes "twoside".
526+
% If "oneside" class option, there are warnings in LaTeX log.
511527
\fancyfoot[LE,RO]{{\py@HeaderFamily\thepage}}
512528
\fancyfoot[LO]{{\py@HeaderFamily\nouppercase{\rightmark}}}
513529
\fancyfoot[RE]{{\py@HeaderFamily\nouppercase{\leftmark}}}
@@ -517,17 +533,24 @@
517533
% define chaptermark with \@chappos when \@chappos is available for Japanese
518534
\ltx@ifundefined{@chappos}{}
519535
{\def\chaptermark##1{\markboth{\@chapapp\space\thechapter\space\@chappos\space ##1}{}}}
520-
}
536+
}
521537
% Update the plain style so we get the page number & footer line,
522538
% but not a chapter or section title. This is to keep the first
523539
% page of a chapter and the blank page between chapters `clean.'
524-
\fancypagestyle{plain}{
540+
\fancypagestyle{plain}{
525541
\fancyhf{}
526542
\fancyfoot[LE,RO]{{\py@HeaderFamily\thepage}}
527543
\renewcommand{\headrulewidth}{0pt}
528544
\renewcommand{\footrulewidth}{0.4pt}
545+
}
546+
}
547+
}
548+
{% no fancyhdr: memoir class
549+
% Provide default for 'normal' style simply as an alias of 'plain' style
550+
% This way we can use \pagestyle{normal} in LaTeX template
551+
\def\ps@normal{\ps@plain}
552+
% Users of memoir class are invited to redefine 'normal' style in preamble
529553
}
530-
}
531554

532555
% geometry
533556
\ifx\kanjiskip\@undefined

sphinx/texinputs/sphinxhowto.cls

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
%
44

55
\NeedsTeXFormat{LaTeX2e}[1995/12/01]
6-
\ProvidesClass{sphinxhowto}[2017/03/26 v1.6 Document class (Sphinx HOWTO)]
6+
\ProvidesClass{sphinxhowto}[2018/09/18 v1.8.1 Document class (Sphinx HOWTO)]
77

88
% 'oneside' option overriding the 'twoside' default
99
\newif\if@oneside
@@ -66,12 +66,7 @@
6666
\vspace{12pt}
6767
}
6868

69-
\@ifundefined{fancyhf}{
70-
\pagestyle{plain}}{
71-
\pagestyle{normal}} % start this way; change for
72-
\pagenumbering{arabic} % ToC & chapters
73-
74-
\thispagestyle{empty}
69+
\pagenumbering{arabic}
7570

7671
% Fix the bibliography environment to add an entry to the Table of
7772
% Contents.

sphinx/texinputs/sphinxmanual.cls

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
%
44

55
\NeedsTeXFormat{LaTeX2e}[1995/12/01]
6-
\ProvidesClass{sphinxmanual}[2017/03/26 v1.6 Document class (Sphinx manual)]
6+
\ProvidesClass{sphinxmanual}[2018/09/18 v1.8.1 Document class (Sphinx manual)]
77

88
% chapters starting at odd pages (overridden by 'openany' document option)
99
\PassOptionsToClass{openright}{\sphinxdocclass}
@@ -75,15 +75,13 @@
7575

7676
\newcommand{\sphinxtableofcontents}{%
7777
\pagenumbering{roman}%
78-
\pagestyle{plain}%
7978
\begingroup
8079
\parskip \z@skip
8180
\tableofcontents
8281
\endgroup
8382
% before resetting page counter, let's do the right thing.
8483
\if@openright\cleardoublepage\else\clearpage\fi
8584
\pagenumbering{arabic}%
86-
\ifdefined\fancyhf\pagestyle{normal}\fi
8785
}
8886

8987
% This is needed to get the width of the section # area wide enough in the

0 commit comments

Comments
 (0)