[latex3-commits] [git/LaTeX3-latex3-latex3] master: Extend \c_sys_engine_format_str (2e238f3d1)

Joseph Wright joseph.wright at morningstar2.co.uk
Thu Aug 20 21:39:47 CEST 2020


Repository : https://github.com/latex3/latex3
On branch  : master
Link       : https://github.com/latex3/latex3/commit/2e238f3d1a42e0663a0daa6a3062f584ec585a93

>---------------------------------------------------------------

commit 2e238f3d1a42e0663a0daa6a3062f584ec585a93
Author: Joseph Wright <joseph.wright at morningstar2.co.uk>
Date:   Thu Aug 20 20:39:47 2020 +0100

    Extend \c_sys_engine_format_str


>---------------------------------------------------------------

2e238f3d1a42e0663a0daa6a3062f584ec585a93
 l3kernel/l3sys.dtx | 41 +++++++++++++++++++++++++++++++----------
 1 file changed, 31 insertions(+), 10 deletions(-)

diff --git a/l3kernel/l3sys.dtx b/l3kernel/l3sys.dtx
index 40c5f5556..af9fd3926 100644
--- a/l3kernel/l3sys.dtx
+++ b/l3kernel/l3sys.dtx
@@ -115,7 +115,10 @@
 %   The name of the preloaded format for the current \TeX{} run given
 %   as a lower case string: one of
 %   |lualatex| (or |dvilualatex|),
-%   |pdflatex| (or |latex|), |platex|, |uplatex| or |xelatex|.
+%   |pdflatex| (or |latex|), |platex|, |uplatex| or |xelatex| for \LaTeX{},
+%   similar names for plain \TeX{} (except \pdfTeX{} in DVI mode yields
+%   |etex|), and |cont-en| for Con\TeX{}t (i.e.~the
+%   \tn{fmtname}).
 % \end{variable}
 %
 % \section{Output format}
@@ -407,17 +410,35 @@
   }
 \str_const:Nx \c_sys_engine_format_str
   {
-    \sys_if_engine_pdftex:T
-      { \int_compare:nNnT { \tex_pdfoutput:D } = { 1 } { pdf } }
-    \sys_if_engine_xetex:T  { xe  }
-    \sys_if_engine_ptex:T   { p   }
-    \sys_if_engine_uptex:T  { up  }
-    \sys_if_engine_luatex:T
+    \cs_if_exist:NTF \fmtname
       {
-        \int_compare:nNnT { \tex_pdfoutput:D } = { 0 } { dvi }
-        lua
+        \bool_lazy_or:nnTF
+          { \str_if_eq_p:Vn \fmtname { plain } }
+          { \str_if_eq_p:Vn \fmtname { LaTeX2e } }
+          {
+            \sys_if_engine_pdftex:T
+              { \int_compare:nNnT { \tex_pdfoutput:D } = { 1 } { pdf } }
+            \sys_if_engine_xetex:T  { xe }
+            \sys_if_engine_ptex:T   { p  }
+            \sys_if_engine_uptex:T  { up }
+            \sys_if_engine_luatex:T
+              {
+                \int_compare:nNnT { \tex_pdfoutput:D } = { 0 } { dvi }
+                lua
+              }
+            \str_if_eq:VNTF \fmtname { LaTeX2e }
+              { latex }
+              {
+                \bool_lazy_and:nnT
+                  { \sys_if_engine_pdftex_p: }
+                  { \int_compare_p:nNn { \tex_pdfoutput:D } = { 0 } }
+                    { e }
+                tex
+              }
+          }
+          { \fmtname }
       }
-    latex
+      { unknown }
   }
 %    \end{macrocode}
 % \end{variable}





More information about the latex3-commits mailing list.