@@ -133,57 +133,33 @@ Keys that you may want to override include:
133133 ``babel ``, not ``polyglossia ``.
134134
135135``'fontpkg' ``
136- Font package inclusion. The default of ``'\\usepackage{times}' `` uses Times
137- for text, Helvetica for sans serif and Courier for monospace.
138-
139- In order to support occasional Cyrillic (физика частиц) or Greek
140- letters (Σωματιδιακή φυσική) in a document whose language is
141- English or a Latin European one, the default set-up is enhanced (only for
142- ``'pdflatex' `` engine) to do:
143-
144- .. code-block :: latex
145-
146- \substitutefont {LGR}{\r mdefault}{cmr}
147- \substitutefont {LGR}{\s fdefault}{cmss}
148- \substitutefont {LGR}{\t tdefault}{cmtt}
149- \substitutefont {X2}{\r mdefault}{cmr}
150- \substitutefont {X2}{\s fdefault}{cmss}
151- \substitutefont {X2}{\t tdefault}{cmtt}
152-
153- This is activated only under the condition that the ``'fontenc' `` key is
154- configured to load the ``LGR `` (Greek) and/or ``X2 `` (Cyrillic)
155- pdflatex-font encodings (if the :confval: `language ` is set to a Cyrillic
156- language, this ``'fontpkg' `` key must be used as "times" package has no
157- direct support for it; then keep only ``LGR `` lines from the above, if
158- support is needed for Greek in the text).
159-
160- The ``\substitutefont `` command is from the eponymous LaTeX package, which
161- is loaded by Sphinx if needed (on Ubuntu Xenial it is part of
162- ``texlive-latex-extra `` which is a Sphinx requirement).
163-
164- Only if the document actually does contain Unicode Greek letters (in text)
165- or Cyrillic letters, will the above default set-up cause additional
166- requirements for the PDF build. On Ubuntu Xenial, these are the
167- ``texlive-lang-greek ``, ``texlive-lang-cyrillic ``, and (with the above
168- choice of fonts) the ``cm-super `` (or ``cm-super-minimal ``) packages.
169-
170- For ``'xelatex' `` and ``'lualatex' ``, the default is to use the FreeFont
171- family: this OpenType font family supports both Cyrillic and Greek scripts
172- and is available as separate Ubuntu Xenial package ``fonts-freefont-otf ``.
173- It is not necessary to install the much larger ``texlive-fonts-extra ``
174- package.
175-
176- ``'platex' `` (Japanese documents) engine supports individual Cyrillic and
177- Greek letters with no need of extra user set-up.
178-
179- Default: ``'\\usepackage{times}' `` (or ``'' `` when using a Cyrillic script)
136+ Font package inclusion. The default is::
137+
138+ r"""\usepackage{tgtermes}
139+ \usepackage{tgheros}
140+ \renewcommand\ttdefault{txtt}
141+ """
142+
143+ For ``'xelatex' `` and ``'lualatex' `` however the default is to use
144+ the GNU FreeFont.
180145
181146 .. versionchanged :: 1.2
182147 Defaults to ``'' `` when the :confval: `language ` uses the Cyrillic
183148 script.
184149
185150 .. versionchanged :: 2.0
186- Added support for individual Greek and Cyrillic letters:
151+ Incorporates some font substitution commands to help support occasional
152+ Greek or Cyrillic in a document using ``'pdflatex' `` engine.
153+
154+ .. versionchanged :: 4.0.0
155+ - The font substitution commands added at ``2.0 `` have been moved
156+ to the ``'fontsubstitution' `` key, as their presence here made
157+ it complicated for user to customize the value of ``'fontpkg' ``.
158+ - The default font setting has changed: it still uses Times and
159+ Helvetica clones for serif and sans serif, but via better, more
160+ complete TeX fonts and associated LaTeX packages. The
161+ monospace font has been changed to better match the Times clone.
162+
187163
188164``'fncychap' ``
189165 Inclusion of the "fncychap" package (which makes fancy chapter titles),
@@ -314,37 +290,28 @@ Keys that don't need to be overridden unless in special cases are:
314290 .. versionadded :: 1.2
315291
316292``'fontenc' ``
317- "fontenc" package inclusion.
293+ Customize this from its default `` '\\usepackage[T1]{fontenc}' `` to:
318294
319- If ``'pdflatex' `` is the :confval: `latex_engine `, one can add ``LGR ``
320- for support of Greek letters in the document, and also ``X2 `` (or
321- ``T2A ``) for Cyrillic letters, like this:
295+ - ``'\\usepackage[X2,T1]{fontenc}' `` if you need occasional
296+ Cyrillic letters (физика частиц),
322297
323- .. code-block :: latex
298+ - ``'\\usepackage[LGR,T1]{fontenc}' `` if you need occasional
299+ Greek letters (Σωματιδιακή φυσική).
324300
325- r' \usepackage [LGR,X2,T1 ]{ fontenc }'
301+ Use `` [LGR,X2,T1] `` rather if both are needed.
326302
327303 .. attention ::
328304
329- If Greek is main language, do not use this key. Since Sphinx 2.2.1,
330- ``xelatex `` will be used automatically as :confval: `latex_engine `.
331- Formerly, Sphinx did not support producing PDF via LaTeX with Greek as
332- main language.
333-
334- Prior to 2.0, Unicode Greek letters were escaped to use LaTeX math
335- mark-up. This is not the case anymore, and the above must be used
336- (only in case of ``'pdflatex' `` engine) if the source contains such
337- Unicode Greek.
305+ - Do not use this key for a :confval: `latex_engine ` other than
306+ ``'pdflatex' ``.
338307
339- On Ubuntu xenial, packages ``texlive-lang-greek `` and ``cm-super ``
340- (for the latter, only if the ``'fontpkg' `` setting is left to its
341- default) are needed for ``LGR `` to work. In place of ``cm-super ``
342- one can install smaller ``cm-super-minimal ``, but it requires the
343- LaTeX document to execute ``\usepackage[10pt]{type1ec} `` before
344- loading ``fontenc ``. Thus, use this key with this extra at its
345- start if needed.
308+ - If Greek is main language, do not use this key. Since Sphinx 2.2.1,
309+ ``xelatex `` will be used automatically as :confval: `latex_engine `.
346310
347- Default: ``'\\usepackage[T1]{fontenc}' ``
311+ - The TeX installation may need some extra packages. For example,
312+ on Ubuntu xenial, packages ``texlive-lang-greek `` and ``cm-super ``
313+ are needed for ``LGR `` to work. And ``texlive-lang-cyrillic `` and
314+ ``cm-super `` are needed for support of Cyrillic.
348315
349316 .. versionchanged :: 1.5
350317 Defaults to ``'\\usepackage{fontspec}' `` when
@@ -361,35 +328,40 @@ Keys that don't need to be overridden unless in special cases are:
361328
362329 .. versionchanged :: 2.0
363330 Detection of ``LGR ``, ``T2A ``, ``X2 `` to trigger support of
364- occasional Greek or Cyrillic (``'pdflatex' `` only, as this support
365- is provided natively by ``'platex' `` and only requires suitable
366- font with ``'xelatex'/'lualatex' ``).
331+ occasional Greek or Cyrillic letters (``'pdflatex' ``).
367332
368333 .. versionchanged :: 2.3.0
369- ``'xelatex' `` also executes
334+ ``'xelatex' `` executes
370335 ``\defaultfontfeatures[\rmfamily,\sffamily]{} `` in order to avoid
371336 contractions of ``-- `` into en-dash or transforms of straight quotes
372337 into curly ones in PDF (in non-literal text paragraphs) despite
373338 :confval: `smartquotes ` being set to ``False ``.
374339
375- ``'textgreek' ``
376- This is needed for ``pdflatex `` to support Unicode input of Greek
377- letters such as φύσις. Expert users may want to load the ``textalpha ``
378- package with its option ``normalize-symbols ``.
340+ ``'fontsubstitution' ``
341+ Ignored if ``'fontenc' `` was not configured to use ``LGR `` or ``X2 `` (or
342+ ``T2A ``). In case ``'fontpkg' `` key is configured for usage with some
343+ TeX fonts known to be available in the ``LGR `` or ``X2 `` encodings, set
344+ this one to be the empty string. Else leave to its default.
379345
380- .. hint ::
346+ Ignored with :confval: ` latex_engine ` other than `` 'pdflatex' ``.
381347
382- Unicode Greek (but no further Unicode symbols) in :rst:dir: `math `
383- can be supported by ``'pdflatex' `` from setting this key to
384- ``r'\usepackage{textalpha,alphabeta}' ``. Then ``:math:`α` `` (U+03B1)
385- will render as :math: `\alpha `. For wider Unicode support in math
386- input, see the discussion of :confval: `latex_engine `.
348+ .. versionadded :: 4.0.0
387349
388- With ``'platex' `` (Japanese), ``'xelatex' `` or ``'lualatex' ``, this
389- key is ignored.
350+ ``'textgreek' ``
351+ For the support of occasional Greek letters.
352+
353+ It is ignored with ``'platex' ``, ``'xelatex' `` or ``'lualatex' `` as
354+ :confval: `latex_engine ` and defaults to either the empty string or
355+ to ``'\\usepackage{textalpha}' `` for ``'pdflatex' `` depending on
356+ whether the ``'fontenc' `` key was used with ``LGR `` or not. Only
357+ expert LaTeX users may want to customize this key.
358+
359+ It can also be used as ``r'\usepackage{textalpha,alphabeta}' `` to let
360+ ``'pdflatex' `` support Greek Unicode input in :rst:dir: `math ` context.
361+ For example ``:math:`α` `` (U+03B1) will render as :math: `\alpha `.
390362
391- Default: `` '\\usepackage{textalpha}' `` or `` '' `` if `` fontenc `` does not
392- include the `` LGR `` option .
363+ For wider Unicode support in math input, see the discussion of
364+ :confval: ` latex_engine ` .
393365
394366 .. versionadded :: 2.0
395367
@@ -500,19 +472,25 @@ Keys that don't need to be overridden unless in special cases are:
500472 Default: ``'\\printindex' ``
501473
502474``'fvset' ``
503- Customization of ``fancyvrb `` LaTeX package. The default value of
504- ``'\\fvset{fontsize=\\small}' `` is used to adjust for the large character
505- width of the monospace font, used in code-blocks. You may need to modify
506- this if you use custom fonts.
475+ Customization of ``fancyvrb `` LaTeX package.
507476
508- Default: ``'\\fvset{fontsize=\\small}' ``
477+ The default value is ``'\\fvset{fontsize=auto}' `` which means that the
478+ font size will adjust correctly if a code-block ends up in a footnote.
479+ You may need to modify this if you use custom fonts:
480+ ``'\\fvset{fontsize=\\small}' `` if the monospace font is Courier-like.
481+
482+ Default: ``'\\fvset{fontsize=auto}' ``
509483
510484 .. versionadded :: 1.8
511485
512486 .. versionchanged :: 2.0
513- Due to new default font choice for ``'xelatex' `` and ``'lualatex' ``
514- (FreeFont), Sphinx does ``\\fvset{fontsize=\\small} `` also with these
515- engines (and not ``\\fvset{fontsize=auto} ``).
487+ For ``'xelatex' `` and ``'lualatex' `` defaults to
488+ ``'\\fvset{fontsize=\\small}' `` as this
489+ is adapted to the relative widths of the FreeFont family.
490+
491+ .. versionchanged :: 4.0.0
492+ Changed default for ``'pdflatex' ``. Previously it was using
493+ ``'\\fvset{fontsize=\\small}' ``.
516494
517495Keys that are set by other options and therefore should not be overridden are:
518496
0 commit comments