Skip to content

Commit faccc21

Browse files
committed
Fix #10695: old LaTeX does not allow \@ifpackageloaded usage in body
1 parent afac558 commit faccc21

File tree

5 files changed

+24
-19
lines changed

5 files changed

+24
-19
lines changed

sphinx/texinputs/sphinx.sty

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -685,6 +685,27 @@
685685
%% FRAMED ENVIRONMENTS
686686
%
687687
\RequirePackage{sphinxpackageboxes}
688+
% This macro is possibly executed at begin document if the check
689+
% whether radii setting options have been used turns out positive
690+
\def\spx@RequirePackage@PictIIe{%
691+
\IfFileExists{pict2e.sty}
692+
{\RequirePackage{pict2e}}
693+
{\PackageWarningNoLine{sphinx}{%
694+
The package pict2e is required for rounded boxes.\MessageBreak
695+
It does not seem to be available on your system.\MessageBreak
696+
Options for setting radii will thus be ignored}%
697+
\AtEndDocument{\PackageWarningNoLine{sphinx}{%
698+
I issued a warning which may have gotten lost in the\MessageBreak
699+
gigantic console output: pict2e.sty was not found,\MessageBreak
700+
and radii setting options have been ignored}}%
701+
\def\spx@boxes@fcolorbox@rounded{\spx@boxes@fcolorbox}%
702+
}%
703+
}%
704+
% This at begin document will be executed after \spx@RequirePackage@PictIIe
705+
\AtBeginDocument{%
706+
\@ifpackageloaded{pict2e}{\let\spx@ifpackageloaded@pictiie\@firstoftwo}%
707+
{\let\spx@ifpackageloaded@pictiie\@secondoftwo}%
708+
}%
688709
\input{sphinxlatexadmonitions.sty}
689710
\input{sphinxlatexliterals.sty}
690711
\input{sphinxlatexshadowbox.sty}

sphinx/texinputs/sphinxlatexadmonitions.sty

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@
162162
\ifdim\spx@boxes@radius@bottomleft >\z@0\fi
163163
1\spx@boxes@fcolorbox{##1}%
164164
\else
165-
\@ifpackageloaded{pict2e}%
165+
\spx@ifpackageloaded@pictiie
166166
{\ifspx@boxes@insetshadow
167167
\spx@boxes@fcolorbox{##1}%
168168
\else

sphinx/texinputs/sphinxlatexliterals.sty

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@
164164
\ifdim\spx@pre@radius@bottomleft >\z@0\fi
165165
1\spx@boxes@fcolorbox{\box\z@}%
166166
\else
167-
\@ifpackageloaded{pict2e}%
167+
\spx@ifpackageloaded@pictiie
168168
{\ifspx@pre@insetshadow
169169
\spx@boxes@fcolorbox{\box\z@}%
170170
\else

sphinx/texinputs/sphinxlatexshadowbox.sty

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@
7979
\ifdim\spx@topic@radius@bottomleft >\z@0\fi
8080
1\spx@boxes@fcolorbox{\box\z@}%
8181
\else
82-
\@ifpackageloaded{pict2e}%
82+
\spx@ifpackageloaded@pictiie
8383
{\ifspx@topic@insetshadow
8484
\spx@boxes@fcolorbox{\box\z@}%
8585
\else

sphinx/texinputs/sphinxpackageboxes.sty

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -72,22 +72,6 @@
7272
% if nothing else is changed (perhaps in future the title itself could be also
7373
% rendered in a rounded box?)
7474

75-
\def\spx@RequirePackage@PictIIe{%
76-
\IfFileExists{pict2e.sty}
77-
{\RequirePackage{pict2e}}
78-
{\PackageWarningNoLine{sphinx}{%
79-
The package pict2e is required for rounded boxes.\MessageBreak
80-
It does not seem to be available on your system.\MessageBreak
81-
Options for setting radii will thus be ignored}%
82-
\AtEndDocument{\PackageWarningNoLine{sphinx}{%
83-
I issued a warning which may have gotten lost in the\MessageBreak
84-
gigantic console output: pict2e.sty was not found,\MessageBreak
85-
and radii setting options have been ignored}}%
86-
\def\spx@boxes@fcolorbox@rounded{\spx@boxes@fcolorbox}%
87-
}%
88-
}%
89-
90-
9175
%//// \spx@boxes@fcolorbox
9276
% This box will have the same baseline as its argument (which is typeset in
9377
% horizontal mode). It takes into account four border widths parameters, four

0 commit comments

Comments
 (0)