Skip to content

Commit

Permalink
LaTeX: Improve resiliency when fontawesome is not not installed (#…
Browse files Browse the repository at this point in the history
…13009)

Co-authored-by: Adam Turner <9087854+aa-turner@users.noreply.github.com>
  • Loading branch information
jfbu and AA-Turner authored Oct 11, 2024
1 parent c23697a commit 61d6e40
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 16 deletions.
4 changes: 4 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ Bugs fixed

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


Release 8.1.0 (released Oct 10, 2024)
=====================================
Expand Down
21 changes: 9 additions & 12 deletions sphinx/texinputs/sphinx.sty
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
% by the Sphinx LaTeX writer.

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

% provides \ltx@ifundefined
% (many packages load ltxcmds: graphicx does for pdftex and lualatex but
Expand Down Expand Up @@ -885,15 +885,12 @@
{\DeclareStringOption[fontawesome]{iconpackage}}
{\DeclareStringOption[none]{iconpackage}}%
}%
\newcommand\spx@faIcon[3][]{}%
% The hacky definition of \spx@faIcon above is to let it by default swallow
% the icon macro and the \sphinxtitlerowaftericonspacecmd (see
% \sphinxdotitlerowwithicon in sphinxlatexadmonitions.sty) which inserts
% a space between it and title. See how \spx@faIcon is used below.
%
% If user sets a title-icon key to some LaTeX code of their own, of course
% \spx@faIcon is not executed and the inserted space will thus be there, as
% expected.
\newcommand\spx@faIcon[2][]{}%
% The above \spx@faIcon which gobbles one mandatory and one optional
% argument is put into use only if both fontawesome5 and fontawesome
% LaTeX packages are not available, as part of the defaults for the
% div.*_title-icon keys (these keys can be redefined via the sphinxsetup
% interface).
%
\def\spxstring@fontawesome{fontawesome}
\def\spxstring@fontawesomev{fontawesome5}
Expand All @@ -920,8 +917,8 @@
\let\faicon@pen\faPencil
\fi
% if neither has been required, \spx@faIcon will simply swallow
% its argument (and follwing space macro) and it is up to user
% to set the keys appropriately.
% its argument and it is up to user
% to set the various div.*_title-icon keys appropriately.
\fi\fi %
}%
{%
Expand Down
10 changes: 6 additions & 4 deletions sphinx/texinputs/sphinxlatexadmonitions.sty
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
%% NOTICES AND ADMONITIONS
%
% change this info string if making any custom modification
\ProvidesPackage{sphinxlatexadmonitions}[2024/07/28 v8.1.0 admonitions]
\ProvidesPackage{sphinxlatexadmonitions}[2024/10/11 v8.1.1 admonitions]

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

0 comments on commit 61d6e40

Please sign in to comment.