[latex3-commits] [git/LaTeX3-latex3-latex3] master: Reduce use of \AtBeginDocument in l3coffins (1d93fb5af)
Joseph Wright
joseph.wright at morningstar2.co.uk
Fri Dec 4 15:47:44 CET 2020
Repository : https://github.com/latex3/latex3
On branch : master
Link : https://github.com/latex3/latex3/commit/1d93fb5af99b0e58e0701d5ba411d548bb358c3e
>---------------------------------------------------------------
commit 1d93fb5af99b0e58e0701d5ba411d548bb358c3e
Author: Joseph Wright <joseph.wright at morningstar2.co.uk>
Date: Fri Dec 4 14:47:44 2020 +0000
Reduce use of \AtBeginDocument in l3coffins
>---------------------------------------------------------------
1d93fb5af99b0e58e0701d5ba411d548bb358c3e
l3kernel/l3coffins.dtx | 33 +++++++++++++++++----------------
1 file changed, 17 insertions(+), 16 deletions(-)
diff --git a/l3kernel/l3coffins.dtx b/l3kernel/l3coffins.dtx
index 38275278c..921f0c70a 100644
--- a/l3kernel/l3coffins.dtx
+++ b/l3kernel/l3coffins.dtx
@@ -2239,15 +2239,12 @@
% flexible.
% \begin{macrocode}
\tl_new:N \l_@@_display_font_tl
-\cs_if_exist:NTF \AtBeginDocument
- { \AtBeginDocument }
- { \use:n }
+\bool_lazy_and:nnT
+ { \cs_if_exist_p:N \fmtname }
+ { \str_if_eq_p:Vn \fmtname { LaTeX2e } }
{
- \__kernel_tl_set:Nx \l_@@_display_font_tl
- {
- \cs_if_exist:NT \sffamily { \exp_not:N \sffamily }
- \cs_if_exist:NT \tiny { \exp_not:N \tiny }
- }
+ \__kernel_tl_set:Nn \l_@@_display_font_tl
+ { \sffamily \tiny }
}
% \end{macrocode}
% \end{variable}
@@ -2255,17 +2252,21 @@
% \begin{macro}{\@@_color:n}
% Calls \tn{color}, and otherwise does nothing if \tn{color} is not defined.
% \begin{macrocode}
-\cs_if_exist:NTF \AtBeginDocument
- { \AtBeginDocument }
- { \use:n }
+\cs_new_protected:Npn \@@_color:n #1 {#1}
+\bool_lazy_and:nnT
+ { \cs_if_exist_p:N \fmtname }
+ { \str_if_eq_p:Vn \fmtname { LaTeX2e } }
{
- \cs_new_protected:Npx \@@_color:n #1
+ \AtBeginDocument
{
- \cs_if_exist:NTF \color_select:n
- { \color_select:n {#1} }
+ \cs_gset_protected:Npx \@@_color:n #1
{
- \cs_if_exist:NT \color
- { \exp_not:N \color {#1} }
+ \cs_if_exist:NTF \color_select:n
+ { \color_select:n {#1} }
+ {
+ \cs_if_exist:NT \color
+ { \exp_not:N \color {#1} }
+ }
}
}
}
More information about the latex3-commits
mailing list.