Skip to content

Commit

Permalink
Merge pull request #5768 from jfbu/latex_xelatex_fvset_small
Browse files Browse the repository at this point in the history
LaTeX: use ``\small`` fontsize in code-blocks with xelatex and lualatex
  • Loading branch information
jfbu committed Dec 14, 2018
2 parents f8a2e7a + 022fc9d commit ca2ce49
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 14 deletions.
20 changes: 8 additions & 12 deletions doc/usage/configuration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2301,20 +2301,16 @@ information.
index is full of long entries.

``'fvset'``
Customization of ``fancyvrb`` LaTeX package. Currently, Sphinx uses
this key to set the fontsize in code-blocks according to the
:confval:`latex_engine`.

- ``'pdflatex'`` uses ``'fvset': '\\fvset{fontsize=\\small}'``,
to mitigate the size difference between the default monospaced font
(Courier) and the default text font (Times). You may need to modify
this if you use custom fonts.

- ``'xelatex'`` and ``'lualatex'`` use ``'\\fvset{fontsize=auto}'``,
as there is no size difference between the regular and the
monospaced fonts used by default by Sphinx with these engines.
Customization of ``fancyvrb`` LaTeX package. Sphinx does by default
``'fvset': '\\fvset{fontsize=\\small}'``, to adjust for the large
character width of the monospace font, used in code-blocks.
You may need to modify this if you use custom fonts.

.. versionadded:: 1.8
.. versionchanged:: 2.0
Due to new default font choice for ``'xelatex'`` and ``'lualatex'``
(FreeFont), Sphinx does ``\\fvset{fontsize=\\small}`` also with these
engines (and not ``\\fvset{fontsize=auto}``).

* Keys that are set by other options and therefore should not be overridden
are:
Expand Down
2 changes: 0 additions & 2 deletions sphinx/writers/latex.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,6 @@
'textgreek': '',
'utf8extra': ('\\catcode`^^^^00a0\\active\\protected\\def^^^^00a0'
'{\\leavevmode\\nobreak\\ }'),
'fvset': '\\fvset{fontsize=auto}',
},
'lualatex': {
'latex_engine': 'lualatex',
Expand All @@ -213,7 +212,6 @@
'textgreek': '',
'utf8extra': ('\\catcode`^^^^00a0\\active\\protected\\def^^^^00a0'
'{\\leavevmode\\nobreak\\ }'),
'fvset': '\\fvset{fontsize=auto}',
},
'platex': {
'latex_engine': 'platex',
Expand Down

0 comments on commit ca2ce49

Please sign in to comment.