Skip to content

Commit 85966c0

Browse files
authored
Fix #11756 (#11758)
1 parent 2d1e607 commit 85966c0

File tree

3 files changed

+31
-3
lines changed

3 files changed

+31
-3
lines changed

CHANGES.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,10 @@ Bugs fixed
4343
Patch by James Addison.
4444
* #11678: Fix a possible ``ZeroDivisionError`` in ``sphinx.ext.coverage``.
4545
Patch by Stephen Finucane.
46+
* #11756: LaTeX: build error with recent TeXLive due to missing ``substitutefont``
47+
package (triggered if using ``fontenc`` with ``T2A`` option and document
48+
language is not a Cyrillic one).
49+
Patch by Jean-François B.
4650

4751
Testing
4852
-------

sphinx/builders/latex/__init__.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -215,15 +215,18 @@ def init_multilingual(self) -> None:
215215
if self.context['latex_engine'] == 'pdflatex':
216216
if not self.babel.uses_cyrillic():
217217
if 'X2' in self.context['fontenc']:
218-
self.context['substitutefont'] = '\\usepackage{substitutefont}'
218+
self.context['substitutefont'] = ('\\usepackage'
219+
'{sphinxpackagesubstitutefont}')
219220
self.context['textcyrillic'] = ('\\usepackage[Xtwo]'
220221
'{sphinxpackagecyrillic}')
221222
elif 'T2A' in self.context['fontenc']:
222-
self.context['substitutefont'] = '\\usepackage{substitutefont}'
223+
self.context['substitutefont'] = ('\\usepackage'
224+
'{sphinxpackagesubstitutefont}')
223225
self.context['textcyrillic'] = ('\\usepackage[TtwoA]'
224226
'{sphinxpackagecyrillic}')
225227
if 'LGR' in self.context['fontenc']:
226-
self.context['substitutefont'] = '\\usepackage{substitutefont}'
228+
self.context['substitutefont'] = ('\\usepackage'
229+
'{sphinxpackagesubstitutefont}')
227230
else:
228231
self.context['textgreek'] = ''
229232
if self.context['substitutefont'] == '':
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
%% a stub for obsoleted LaTeX package substitutefont
2+
% The package substitutefont stopped being distributed with TeXLive
3+
% around August 2023 and was moved to "obsolete" section.
4+
% cf https://ctan.org/pkg/substitutefont
5+
% Trying to load it raises a LaTeX build error since.
6+
7+
% The \substitutefont has a LaTeX kernel replacement
8+
% \DeclareFontFamilySubstitution
9+
% which was added to LaTeX 2020-02-02
10+
% The aim of this stub is to do that replacement silently.
11+
12+
% change this info string if making any custom modification
13+
\ProvidesPackage{sphinxpackagesubstitutefont}[2023/15/11 v7.3.0 advanced colored boxes]
14+
15+
\ifdefined\DeclareFontFamilySubstitution
16+
\def\substitutefont{\DeclareFontFamilySubstitution}
17+
\else
18+
\usepackage{substitutefont}
19+
\fi
20+
21+
\endinput

0 commit comments

Comments
 (0)