Skip to content

Commit 61d6e40

Browse files
jfbuAA-Turner
andauthored
LaTeX: Improve resiliency when fontawesome is not not installed (#13009)
Co-authored-by: Adam Turner <[email protected]>
1 parent c23697a commit 61d6e40

File tree

3 files changed

+19
-16
lines changed

3 files changed

+19
-16
lines changed

CHANGES.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ Bugs fixed
66

77
* Use the preferred https://www.cve.org/ URL for the :rst:role:`cve` role.
88
Patch by Hugo van Kemenade.
9+
* #13007: LaTeX: Improve resiliency when the required
10+
``fontawesome`` or ``fontawesome5`` packages are not installed.
11+
Patch by Jean-François B.
12+
913

1014
Release 8.1.0 (released Oct 10, 2024)
1115
=====================================

sphinx/texinputs/sphinx.sty

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
% by the Sphinx LaTeX writer.
1010

1111
\NeedsTeXFormat{LaTeX2e}[1995/12/01]
12-
\ProvidesPackage{sphinx}[2024/07/28 v8.1.0 Sphinx LaTeX package (sphinx-doc)]
12+
\ProvidesPackage{sphinx}[2024/10/11 v8.1.1 Sphinx LaTeX package (sphinx-doc)]
1313

1414
% provides \ltx@ifundefined
1515
% (many packages load ltxcmds: graphicx does for pdftex and lualatex but
@@ -885,15 +885,12 @@
885885
{\DeclareStringOption[fontawesome]{iconpackage}}
886886
{\DeclareStringOption[none]{iconpackage}}%
887887
}%
888-
\newcommand\spx@faIcon[3][]{}%
889-
% The hacky definition of \spx@faIcon above is to let it by default swallow
890-
% the icon macro and the \sphinxtitlerowaftericonspacecmd (see
891-
% \sphinxdotitlerowwithicon in sphinxlatexadmonitions.sty) which inserts
892-
% a space between it and title. See how \spx@faIcon is used below.
893-
%
894-
% If user sets a title-icon key to some LaTeX code of their own, of course
895-
% \spx@faIcon is not executed and the inserted space will thus be there, as
896-
% expected.
888+
\newcommand\spx@faIcon[2][]{}%
889+
% The above \spx@faIcon which gobbles one mandatory and one optional
890+
% argument is put into use only if both fontawesome5 and fontawesome
891+
% LaTeX packages are not available, as part of the defaults for the
892+
% div.*_title-icon keys (these keys can be redefined via the sphinxsetup
893+
% interface).
897894
%
898895
\def\spxstring@fontawesome{fontawesome}
899896
\def\spxstring@fontawesomev{fontawesome5}
@@ -920,8 +917,8 @@
920917
\let\faicon@pen\faPencil
921918
\fi
922919
% if neither has been required, \spx@faIcon will simply swallow
923-
% its argument (and follwing space macro) and it is up to user
924-
% to set the keys appropriately.
920+
% its argument and it is up to user
921+
% to set the various div.*_title-icon keys appropriately.
925922
\fi\fi %
926923
}%
927924
{%

sphinx/texinputs/sphinxlatexadmonitions.sty

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
%% NOTICES AND ADMONITIONS
22
%
33
% change this info string if making any custom modification
4-
\ProvidesPackage{sphinxlatexadmonitions}[2024/07/28 v8.1.0 admonitions]
4+
\ProvidesPackage{sphinxlatexadmonitions}[2024/10/11 v8.1.1 admonitions]
55

66
% Provides support for this output mark-up from Sphinx latex writer:
77
%
@@ -341,9 +341,11 @@
341341
\ifdim\wd\z@>\z@
342342
\textcolor{sphinx#1TtlFgColor}{%
343343
\@nameuse{sphinx#1TtlIcon}%
344-
% This macro is located here and not after the closing brace
345-
% for reasons of fall-back \spx@faIcon definition in sphinx.sty
346-
% in case fontawesome5 package not found.
344+
% The next macro is located here for legacy reasons of earlier
345+
% functioning of \spx@faIcon. When fontawesome{5,}.sty both
346+
% are unavailable, it (formerly) gobbled this next macro.
347+
% We leave it here now although it could be moved to after
348+
% the closing brace.
347349
\sphinxtitlerowaftericonspacecmd
348350
}%
349351
\fi

0 commit comments

Comments
 (0)