[latex3-commits] [git/LaTeX3-latex3-latex3] master: Add engine_exec and engine_format strings (89c540db5)

Joseph Wright joseph.wright at morningstar2.co.uk
Thu Aug 20 19:09:56 CEST 2020


Repository : https://github.com/latex3/latex3
On branch  : master
Link       : https://github.com/latex3/latex3/commit/89c540db5daf45b7006b99ab52dfedf497da6804

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

commit 89c540db5daf45b7006b99ab52dfedf497da6804
Author: PhelypeOleinik <tex.phelype at gmail.com>
Date:   Fri Jul 31 22:29:06 2020 -0300

    Add engine_exec and engine_format strings


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

89c540db5daf45b7006b99ab52dfedf497da6804
 l3kernel/l3sys.dtx | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 56 insertions(+)

diff --git a/l3kernel/l3sys.dtx b/l3kernel/l3sys.dtx
index 9e9dd455e..6c6efb061 100644
--- a/l3kernel/l3sys.dtx
+++ b/l3kernel/l3sys.dtx
@@ -105,6 +105,18 @@
 %   |luatex|, |pdftex|, |ptex|, |uptex| or |xetex|.
 % \end{variable}
 %
+% \begin{variable}[added = 2020-07-31]{\c_sys_engine_exec_str}
+%   The name of the standard executable for the current TeX engine given
+%   as a lower case string: one of
+%   |luahbtex|, |pdftex|, |eptex|, |euptex| or |xetex|.
+% \end{variable}
+%
+% \begin{variable}[added = 2020-07-31]{\c_sys_engine_format_str}
+%   The name of the preloaded format for the current TeX run given
+%   as a lower case string: one of
+%   |lualatex|, |pdflatex| (or |latex|), |platex|, |uplatex| or |xelatex|.
+% \end{variable}
+%
 % \section{Output format}
 %
 % \begin{function}[added = 2015-09-19, EXP, pTF]
@@ -361,6 +373,50 @@
 % \end{variable}
 % \end{macro}
 %
+% \begin{variable}{\c_sys_engine_exec_str,\c_sys_engine_format_str}
+%   Take the functions defined above, and set up the engine and format
+%   names.  \cs{c_sys_engine_exec_str} differs from \cs{c_sys_engine_str}
+%   as it is the \emph{actual} engine name, not a \enquote{filtered}
+%   version.  It differs for |ptex| and |uptex|, which have a leading
+%   |e|, and for |luatex|, because \LaTeX{} uses the \Lua HB\TeX{}
+%   engine.
+%
+%   \cs{c_sys_engine_format_str} is quite similar to
+%   \cs{c_sys_engine_str}, except that it differentiates |pdflatex| from
+%   |latex| (which is \pdfTeX{} in DVI mode).  This differentiation,
+%   however, is reliable only if the user doesn't change
+%   \cs{tex_pdfoutput:D} before loading this code.
+%    \begin{macrocode}
+\str_const:Nx \c_sys_engine_exec_str
+  {
+    \sys_if_engine_pdftex:T { pdf }
+    \sys_if_engine_xetex:T  { xe  }
+    \sys_if_engine_ptex:T   { ep  }
+    \sys_if_engine_uptex:T  { eup }
+    \sys_if_engine_luatex:T
+      {
+        lua \lua_now:e
+          {
+            if (pcall(require, 'luaharfbuzz')) then ~
+              tex.print("hb") ~
+            end
+          }
+      }
+    tex
+  }
+\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 { lua }
+    latex
+  }
+%    \end{macrocode}
+% \end{variable}
+%
 % \subsubsection{Randomness}
 %
 % This candidate function is placed there because





More information about the latex3-commits mailing list.