From 73b8cf44cfbfafe29d2233e28e477a71858550bc Mon Sep 17 00:00:00 2001 From: jfbu Date: Sun, 12 Mar 2017 17:54:09 +0100 Subject: [PATCH 1/7] Revert "Amend merged PR#2736 to maintain strict stability of pdf title page" This reverts commit 7db8141238c5d9ce6c93d6f85c8820ed218fd158. As discussed at platex and xelatex engines led to a slightly different title page layout missing a blank line underneath the top rule (above the logo) compared to pdflatex and lualatex. This was probably accidental. --- sphinx/texinputs/sphinxhowto.cls | 2 +- sphinx/texinputs/sphinxmanual.cls | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/sphinx/texinputs/sphinxhowto.cls b/sphinx/texinputs/sphinxhowto.cls index 299777f4e..bcb648336 100644 --- a/sphinx/texinputs/sphinxhowto.cls +++ b/sphinx/texinputs/sphinxhowto.cls @@ -30,7 +30,7 @@ % ``Bjarne'' style a bit better. % \renewcommand{\maketitle}{% - \noindent\rule{\textwidth}{1pt}\ifsphinxpdfoutput\newline\null\fi\par + \noindent\rule{\textwidth}{1pt}\newline\null\par \ifsphinxpdfoutput \begingroup % These \defs are required to deal with multi-line authors; it diff --git a/sphinx/texinputs/sphinxmanual.cls b/sphinx/texinputs/sphinxmanual.cls index 76e7a394f..b2525b40f 100644 --- a/sphinx/texinputs/sphinxmanual.cls +++ b/sphinx/texinputs/sphinxmanual.cls @@ -40,7 +40,7 @@ \begin{titlepage}% \let\footnotesize\small \let\footnoterule\relax - \noindent\rule{\textwidth}{1pt}\ifsphinxpdfoutput\newline\null\fi\par + \noindent\rule{\textwidth}{1pt}\newline\null\par \ifsphinxpdfoutput \begingroup % These \defs are required to deal with multi-line authors; it From 4b2fff4e5ec66b50acb7a6384c95a6277c0d6641 Mon Sep 17 00:00:00 2001 From: jfbu Date: Sun, 12 Mar 2017 19:39:18 +0100 Subject: [PATCH 2/7] Streamline obsolete color set-up in LaTeX style file The file ``pdfcolor.tex`` included in tex distributions is for Plain pdfTeX, not for LaTeX use. Loading it complicates task of supporting multiple TeX engines. If needed all corresponding colour names are better available from passing to ``color`` or ``xcolor`` the ``dvipsnames`` option. It is better to leave responsability of using this option to Sphinx user, if needed. The macros for setting the color defined by ``pdfcolor.tex`` were never documented to Sphinx user, and they can not be used from reST apart from ``.. raw:: latex`` directive, they are for Plain TeX without use of ``color`` package. Thus, this commit drops loading this file and the complicated conditionals around it (``\ifsphinxpdfoutput``), which are also used in the class files ``sphinxmanual.cls``, ``sphinxhowto.cls``. Also, this fixes issue #2693. --- sphinx/texinputs/sphinx.sty | 36 ++++++++----------------------- sphinx/texinputs/sphinxhowto.cls | 3 ++- sphinx/texinputs/sphinxmanual.cls | 3 ++- 3 files changed, 13 insertions(+), 29 deletions(-) diff --git a/sphinx/texinputs/sphinx.sty b/sphinx/texinputs/sphinx.sty index 8e78e66fb..2f82678a7 100644 --- a/sphinx/texinputs/sphinx.sty +++ b/sphinx/texinputs/sphinx.sty @@ -402,33 +402,15 @@ %% COLOR (general) % -% FIXME: the reasons might be obsolete (better color drivers now?) -% use pdfoutput for pTeX and dvipdfmx -% when pTeX (\kanjiskip is defined), set pdfoutput to evade \include{pdfcolor} -\ifx\kanjiskip\undefined\else - \newcount\pdfoutput\pdfoutput=0 -\fi - -% for PDF output, use colors and maximal compression -\newif\ifsphinxpdfoutput % used in \maketitle -\ifx\pdfoutput\undefined\else - \ifnum\pdfoutput=\z@ - \let\py@NormalColor\relax - \let\py@TitleColor\relax - \else - \sphinxpdfoutputtrue - \input{pdfcolor} - \def\py@NormalColor{\color[rgb]{0.0,0.0,0.0}} - \def\py@TitleColor{\color{TitleColor}} - \pdfcompresslevel=9 - \fi -\fi - -% XeLaTeX can do colors, too -\ifx\XeTeXrevision\undefined\else - \def\py@NormalColor{\color[rgb]{0.0,0.0,0.0}} - \def\py@TitleColor{\color{TitleColor}} -\fi +% FIXME: \normalcolor should probably be used in place of \py@NormalColor +% elsewhere, and \py@NormalColor shoudl never be defined. \normalcolor +% switches to the colour from last \color call in preamble. +\def\py@NormalColor{\color{black}} +% FIXME: it is probably better to use \color{TitleColor}, as TitleColor +% can be customized from 'sphinxsetup', and drop usage of \py@TitleColor +\def\py@TitleColor{\color{TitleColor}} +% FIXME: this line should be dropped, as "9" is default anyhow. +\ifdefined\pdfcompresslevel\pdfcompresslevel = 9 \fi %% PAGE STYLING diff --git a/sphinx/texinputs/sphinxhowto.cls b/sphinx/texinputs/sphinxhowto.cls index bcb648336..ca71a625a 100644 --- a/sphinx/texinputs/sphinxhowto.cls +++ b/sphinx/texinputs/sphinxhowto.cls @@ -31,7 +31,8 @@ % \renewcommand{\maketitle}{% \noindent\rule{\textwidth}{1pt}\newline\null\par - \ifsphinxpdfoutput + % FIXME: use \hypersetup{pdfauthor={\@author}, pdftitle={\@title}} + \ifdefined\pdfinfo \begingroup % These \defs are required to deal with multi-line authors; it % changes \\ to ', ' (comma-space), making it pass muster for diff --git a/sphinx/texinputs/sphinxmanual.cls b/sphinx/texinputs/sphinxmanual.cls index b2525b40f..e181a74bc 100644 --- a/sphinx/texinputs/sphinxmanual.cls +++ b/sphinx/texinputs/sphinxmanual.cls @@ -41,7 +41,8 @@ \let\footnotesize\small \let\footnoterule\relax \noindent\rule{\textwidth}{1pt}\newline\null\par - \ifsphinxpdfoutput + % FIXME: use \hypersetup{pdfauthor={\@author}, pdftitle={\@title}} + \ifdefined\pdfinfo \begingroup % These \defs are required to deal with multi-line authors; it % changes \\ to ', ' (comma-space), making it pass muster for From 65f9be9311c4a9fc897d041d55dd28195d48165f Mon Sep 17 00:00:00 2001 From: jfbu Date: Mon, 13 Mar 2017 08:32:11 +0100 Subject: [PATCH 3/7] Remove legacy accidental blank line between top rule and logo in PDF Probably for accidental reasons, pdflatex and lualatex (but not platex and xelatex) were configured with a blank line above the logo on title page, below the top rule. This commit removes it. --- sphinx/texinputs/sphinxhowto.cls | 2 +- sphinx/texinputs/sphinxmanual.cls | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/sphinx/texinputs/sphinxhowto.cls b/sphinx/texinputs/sphinxhowto.cls index ca71a625a..cf776534a 100644 --- a/sphinx/texinputs/sphinxhowto.cls +++ b/sphinx/texinputs/sphinxhowto.cls @@ -30,7 +30,7 @@ % ``Bjarne'' style a bit better. % \renewcommand{\maketitle}{% - \noindent\rule{\textwidth}{1pt}\newline\null\par + \noindent\rule{\textwidth}{1pt}\par % FIXME: use \hypersetup{pdfauthor={\@author}, pdftitle={\@title}} \ifdefined\pdfinfo \begingroup diff --git a/sphinx/texinputs/sphinxmanual.cls b/sphinx/texinputs/sphinxmanual.cls index e181a74bc..b201d4a99 100644 --- a/sphinx/texinputs/sphinxmanual.cls +++ b/sphinx/texinputs/sphinxmanual.cls @@ -40,7 +40,7 @@ \begin{titlepage}% \let\footnotesize\small \let\footnoterule\relax - \noindent\rule{\textwidth}{1pt}\newline\null\par + \noindent\rule{\textwidth}{1pt}\par % FIXME: use \hypersetup{pdfauthor={\@author}, pdftitle={\@title}} \ifdefined\pdfinfo \begingroup From 4b8295d981a5fc2755dd6a5fadf82c7d96525072 Mon Sep 17 00:00:00 2001 From: jfbu Date: Mon, 13 Mar 2017 09:09:49 +0100 Subject: [PATCH 4/7] If no logo, do insert blank line between rule and title on PDF titlepage --- sphinx/writers/latex.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sphinx/writers/latex.py b/sphinx/writers/latex.py index 23474248f..36f2062d4 100644 --- a/sphinx/writers/latex.py +++ b/sphinx/writers/latex.py @@ -86,7 +86,7 @@ DEFAULT_SETTINGS = { 'date': '', 'release': '', 'author': '', - 'logo': '', + 'logo': '\\vbox{}', 'releasename': '', 'makeindex': '\\makeindex', 'shorthandoff': '', From 4712faf9072150ca68b0f9fef749a56913fe7c7d Mon Sep 17 00:00:00 2001 From: jfbu Date: Mon, 13 Mar 2017 09:40:51 +0100 Subject: [PATCH 5/7] Remove parskip space above logo image on PDF title page --- sphinx/writers/latex.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sphinx/writers/latex.py b/sphinx/writers/latex.py index 36f2062d4..162ce8315 100644 --- a/sphinx/writers/latex.py +++ b/sphinx/writers/latex.py @@ -563,8 +563,9 @@ class LaTeXTranslator(nodes.NodeVisitor): language=builder.config.language) if builder.config.latex_logo: # no need for \\noindent here, used in flushright - self.elements['logo'] = '\\sphinxincludegraphics{%s}\\par' % \ - path.basename(builder.config.latex_logo) + self.elements['logo'] = ('{\\parskip0pt \\nointerlineskip\n' + '\\sphinxincludegraphics{%s}\\par}' % + path.basename(builder.config.latex_logo)) if builder.config.language \ and 'fncychap' not in builder.config.latex_elements: From 00ac58ff1e110736f0671ed44d96f8d4e8cb68a4 Mon Sep 17 00:00:00 2001 From: jfbu Date: Sat, 18 Mar 2017 22:38:00 +0100 Subject: [PATCH 6/7] Revert "Remove parskip space above logo image on PDF title page" This reverts commit 4712faf9072150ca68b0f9fef749a56913fe7c7d. --- sphinx/writers/latex.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/sphinx/writers/latex.py b/sphinx/writers/latex.py index 162ce8315..36f2062d4 100644 --- a/sphinx/writers/latex.py +++ b/sphinx/writers/latex.py @@ -563,9 +563,8 @@ class LaTeXTranslator(nodes.NodeVisitor): language=builder.config.language) if builder.config.latex_logo: # no need for \\noindent here, used in flushright - self.elements['logo'] = ('{\\parskip0pt \\nointerlineskip\n' - '\\sphinxincludegraphics{%s}\\par}' % - path.basename(builder.config.latex_logo)) + self.elements['logo'] = '\\sphinxincludegraphics{%s}\\par' % \ + path.basename(builder.config.latex_logo) if builder.config.language \ and 'fncychap' not in builder.config.latex_elements: From daca6293a0fb4c7507c47164ad1504d7cfe3df1b Mon Sep 17 00:00:00 2001 From: jfbu Date: Sat, 18 Mar 2017 22:42:31 +0100 Subject: [PATCH 7/7] Typo in a comment --- sphinx/texinputs/sphinx.sty | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sphinx/texinputs/sphinx.sty b/sphinx/texinputs/sphinx.sty index 2f82678a7..cbc465c1e 100644 --- a/sphinx/texinputs/sphinx.sty +++ b/sphinx/texinputs/sphinx.sty @@ -403,7 +403,7 @@ %% COLOR (general) % % FIXME: \normalcolor should probably be used in place of \py@NormalColor -% elsewhere, and \py@NormalColor shoudl never be defined. \normalcolor +% elsewhere, and \py@NormalColor should never be defined. \normalcolor % switches to the colour from last \color call in preamble. \def\py@NormalColor{\color{black}} % FIXME: it is probably better to use \color{TitleColor}, as TitleColor