Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ Bugs fixed
Patch by James Addison.
* #11678: Fix a possible ``ZeroDivisionError`` in ``sphinx.ext.coverage``.
Patch by Stephen Finucane.
* #11756: LaTeX: build error with recent TeXLive due to missing ``substitutefont``
package (triggered if using ``fontenc`` with ``T2A`` option and document
language is not a Cyrillic one).
Patch by Jean-François B.

Testing
-------
Expand Down
9 changes: 6 additions & 3 deletions sphinx/builders/latex/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,15 +215,18 @@ def init_multilingual(self) -> None:
if self.context['latex_engine'] == 'pdflatex':
if not self.babel.uses_cyrillic():
if 'X2' in self.context['fontenc']:
self.context['substitutefont'] = '\\usepackage{substitutefont}'
self.context['substitutefont'] = ('\\usepackage'
'{sphinxpackagesubstitutefont}')
self.context['textcyrillic'] = ('\\usepackage[Xtwo]'
'{sphinxpackagecyrillic}')
elif 'T2A' in self.context['fontenc']:
self.context['substitutefont'] = '\\usepackage{substitutefont}'
self.context['substitutefont'] = ('\\usepackage'
'{sphinxpackagesubstitutefont}')
self.context['textcyrillic'] = ('\\usepackage[TtwoA]'
'{sphinxpackagecyrillic}')
if 'LGR' in self.context['fontenc']:
self.context['substitutefont'] = '\\usepackage{substitutefont}'
self.context['substitutefont'] = ('\\usepackage'
'{sphinxpackagesubstitutefont}')
else:
self.context['textgreek'] = ''
if self.context['substitutefont'] == '':
Expand Down
21 changes: 21 additions & 0 deletions sphinx/texinputs/sphinxpackagesubstitutefont.sty
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
%% a stub for obsoleted LaTeX package substitutefont
% The package substitutefont stopped being distributed with TeXLive
% around August 2023 and was moved to "obsolete" section.
% cf https://ctan.org/pkg/substitutefont
% Trying to load it raises a LaTeX build error since.

% The \substitutefont has a LaTeX kernel replacement
% \DeclareFontFamilySubstitution
% which was added to LaTeX 2020-02-02
% The aim of this stub is to do that replacement silently.

% change this info string if making any custom modification
\ProvidesPackage{sphinxpackagesubstitutefont}[2023/15/11 v7.3.0 advanced colored boxes]

\ifdefined\DeclareFontFamilySubstitution
\def\substitutefont{\DeclareFontFamilySubstitution}
\else
\usepackage{substitutefont}
\fi

\endinput