From 8c55793902f1a28771ac677c16c51df735e4d2b0 Mon Sep 17 00:00:00 2001 From: jfbu Date: Wed, 28 Mar 2018 23:15:03 +0200 Subject: [PATCH 1/3] Let LaTeX with XeTeX/LuaTeX not use small typeface in code-blocks closes: #4791 --- doc/config.rst | 9 +++++++++ doc/latex.rst | 7 ------- sphinx/templates/latex/latex.tex_t | 1 + sphinx/texinputs/sphinx.sty | 3 +-- sphinx/writers/latex.py | 3 +++ 5 files changed, 14 insertions(+), 9 deletions(-) diff --git a/doc/config.rst b/doc/config.rst index 7bcae99f5..5ce5a47ac 100644 --- a/doc/config.rst +++ b/doc/config.rst @@ -1998,7 +1998,16 @@ These options influence LaTeX output. See further :doc:`latex`. differently or append some content after the index. For example ``'\\footnotesize\\raggedright\\printindex'`` is advisable when the index is full of long entries. + ``'fvset'`` + Customization of ``fancyvrb`` LaTeX package. Defaults to + ``'\\fvset{fontsize=\\small}'``, because default font (Courier) used in + code-blocks is wider and taller than default text font (Times). + For ``'xelatex'`` and ``'lualatex'``, defaults to + ``'\\fvset{fontsize=auto}'``, because the default fonts are part of + one unified typeface family (Latin Modern OpenType). + + .. versionadded:: 1.7.3 * Keys that are set by other options and therefore should not be overridden are: diff --git a/doc/latex.rst b/doc/latex.rst index 87117c164..f8e275020 100644 --- a/doc/latex.rst +++ b/doc/latex.rst @@ -385,13 +385,6 @@ Macros multiple paragraphs in header cells of tables. .. versionadded:: 1.6.3 ``\sphinxstylecodecontinued`` and ``\sphinxstylecodecontinues``. -- by default the Sphinx style file ``sphinx.sty`` executes the command - ``\fvset{fontsize=\small}`` as part of its configuration of - ``fancyvrb.sty``. This may be overriden for example via - ``\fvset{fontsize=auto}`` which will let code listings use the ambient font - size. Refer to ``fancyvrb.sty``'s documentation for further keys. - - .. versionadded:: 1.5 - the table of contents is typeset via ``\sphinxtableofcontents`` which is a wrapper (whose definition can be found in :file:`sphinxhowto.cls` or in :file:`sphinxmanual.cls`) of standard ``\tableofcontents``. diff --git a/sphinx/templates/latex/latex.tex_t b/sphinx/templates/latex/latex.tex_t index 34086b1cb..0ea75557f 100644 --- a/sphinx/templates/latex/latex.tex_t +++ b/sphinx/templates/latex/latex.tex_t @@ -25,6 +25,7 @@ <%= fncychap %> \usepackage<%= sphinxpkgoptions %>{sphinx} <%= sphinxsetup %> +<%= fvset %> <%= geometry %> <%= usepackages %> <%= hyperref %> diff --git a/sphinx/texinputs/sphinx.sty b/sphinx/texinputs/sphinx.sty index e323b2a5d..e9716cdba 100644 --- a/sphinx/texinputs/sphinx.sty +++ b/sphinx/texinputs/sphinx.sty @@ -6,7 +6,7 @@ % \NeedsTeXFormat{LaTeX2e}[1995/12/01] -\ProvidesPackage{sphinx}[2018/03/11 v1.7.2 LaTeX package (Sphinx markup)] +\ProvidesPackage{sphinx}[2018/03/28 v1.7.3 LaTeX package (Sphinx markup)] % provides \ltx@ifundefined % (many packages load ltxcmds: graphicx does for pdftex and lualatex but @@ -164,7 +164,6 @@ } % For highlighted code. \RequirePackage{fancyvrb} -\fvset{fontsize=\small} \define@key{FV}{hllines}{\def\sphinx@verbatim@checkifhl##1{\in@{, ##1,}{#1}}} % For hyperlinked footnotes in tables; also for gathering footnotes from % topic and warning blocks. Also to allow code-blocks in footnotes. diff --git a/sphinx/writers/latex.py b/sphinx/writers/latex.py index caaba92e2..c98411f42 100644 --- a/sphinx/writers/latex.py +++ b/sphinx/writers/latex.py @@ -61,6 +61,7 @@ DEFAULT_SETTINGS = { 'maxlistdepth': '', 'sphinxpkgoptions': '', 'sphinxsetup': '', + 'fvset': '\\fvset{fontsize=\\small}', 'passoptionstopackages': '', 'geometry': '\\usepackage{geometry}', 'inputenc': '', @@ -132,6 +133,7 @@ ADDITIONAL_SETTINGS = { 'fontpkg': '', 'utf8extra': ('\\catcode`^^^^00a0\\active\\protected\\def^^^^00a0' '{\\leavevmode\\nobreak\\ }'), + 'fvset': '\\fvset{fontsize=auto}', }, 'lualatex': { 'latex_engine': 'lualatex', @@ -141,6 +143,7 @@ ADDITIONAL_SETTINGS = { 'fontpkg': '', 'utf8extra': ('\\catcode`^^^^00a0\\active\\protected\\def^^^^00a0' '{\\leavevmode\\nobreak\\ }'), + 'fvset': '\\fvset{fontsize=auto}', }, 'platex': { 'latex_engine': 'platex', From 3839d74aa8ef492d8f61edc72a6502ebb5c158a6 Mon Sep 17 00:00:00 2001 From: jfbu Date: Thu, 29 Mar 2018 15:22:34 +0200 Subject: [PATCH 2/3] Typo (Sphinx version number wrong in documentation of ``'fvset'`` key) --- doc/config.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/config.rst b/doc/config.rst index 5ce5a47ac..2fcd86899 100644 --- a/doc/config.rst +++ b/doc/config.rst @@ -2007,7 +2007,7 @@ These options influence LaTeX output. See further :doc:`latex`. ``'\\fvset{fontsize=auto}'``, because the default fonts are part of one unified typeface family (Latin Modern OpenType). - .. versionadded:: 1.7.3 + .. versionadded:: 1.8 * Keys that are set by other options and therefore should not be overridden are: From 415126d42fba62029098359bdbd1beac6d7b86d3 Mon Sep 17 00:00:00 2001 From: jfbu Date: Thu, 29 Mar 2018 15:28:26 +0200 Subject: [PATCH 3/3] Fix LaTeX style file version number (I should perhaps have left it standing, as this may cause merge conflicts if merged after long delay) --- 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 e9716cdba..17aa6644d 100644 --- a/sphinx/texinputs/sphinx.sty +++ b/sphinx/texinputs/sphinx.sty @@ -6,7 +6,7 @@ % \NeedsTeXFormat{LaTeX2e}[1995/12/01] -\ProvidesPackage{sphinx}[2018/03/28 v1.7.3 LaTeX package (Sphinx markup)] +\ProvidesPackage{sphinx}[2018/03/28 v1.8 LaTeX package (Sphinx markup)] % provides \ltx@ifundefined % (many packages load ltxcmds: graphicx does for pdftex and lualatex but