[latex3-commits] [git/LaTeX3-latex3-l3build] master: New specialtypesetting table (c6f549a)

Joseph Wright joseph.wright at morningstar2.co.uk
Mon Feb 17 15:18:01 CET 2020


Repository : https://github.com/latex3/l3build
On branch  : master
Link       : https://github.com/latex3/l3build/commit/c6f549a4aa4ee6250aa2ff22686b8df388e563c8

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

commit c6f549a4aa4ee6250aa2ff22686b8df388e563c8
Author: Joseph Wright <joseph.wright at morningstar2.co.uk>
Date:   Mon Feb 17 14:18:01 2020 +0000

    New specialtypesetting table


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

c6f549a4aa4ee6250aa2ff22686b8df388e563c8
 CHANGELOG.md            |  1 +
 l3build-typesetting.lua | 19 +++++++++++++------
 l3build-variables.lua   |  1 +
 l3build.dtx             | 22 ++++++++++++++++++++--
 4 files changed, 35 insertions(+), 8 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index a2f3341..c303cba 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -9,6 +9,7 @@ this project uses date-based 'snapshot' version identifiers.
 
 ### Added
 - Variable `textfiledir`
+- Table `specialtypesetting` and support data
 
 ### Changed
 - Documentation improvements
diff --git a/l3build-typesetting.lua b/l3build-typesetting.lua
index fe6a6a5..2120194 100644
--- a/l3build-typesetting.lua
+++ b/l3build-typesetting.lua
@@ -127,9 +127,10 @@ function makeindex(name,dir,inext,outext,logext,style)
   return 0
 end
 
-function tex(file,dir)
+function tex(file,dir,cmd)
   local dir = dir or "."
-  return runcmd(typesetexe .. " " .. typesetopts .. " \"" .. typesetcmds
+  local cmd = cmd or typesetexe .. typesetopts
+  return runcmd(cmd .. " \"" .. typesetcmds
     .. "\\input " .. file .. "\"",
     dir,{"TEXINPUTS","LUAINPUTS"})
 end
@@ -138,7 +139,13 @@ local function typesetpdf(file,dir)
   local dir = dir or "."
   local name = jobname(file)
   print("Typesetting " .. name)
-  local errorlevel = typeset(file,dir)
+  local fn = typeset
+  local cmd = typesetexe .. typesetopts
+  if specialtypesetting and specialtypesetting[file] then
+    fn = specialtypesetting[file].function or fn
+    cmd = specialtypesetting[file].cmd or cmd
+  end
+  local errorlevel = fn(file,dir,cmd)
   if errorlevel ~= 0 then
     print(" ! Compilation failed")
     return errorlevel
@@ -148,9 +155,9 @@ local function typesetpdf(file,dir)
   return cp(pdfname,dir,docfiledir)
 end
 
-typeset = typeset or function(file,dir)
+typeset = typeset or function(file,dir,exe)
   dir = dir or "."
-  local errorlevel = tex(file,dir)
+  local errorlevel = tex(file,dir,exe)
   if errorlevel ~= 0 then
     return errorlevel
   end
@@ -163,7 +170,7 @@ typeset = typeset or function(file,dir)
     errorlevel =
       makeindex(name,dir,".glo",".gls",".glg",glossarystyle) +
       makeindex(name,dir,".idx",".ind",".ilg",indexstyle)    +
-      tex(file,dir)
+      tex(file,dir,exe)
     if errorlevel ~= 0 then break end
   end
   return errorlevel
diff --git a/l3build-variables.lua b/l3build-variables.lua
index d716e8e..e69eb5a 100644
--- a/l3build-variables.lua
+++ b/l3build-variables.lua
@@ -152,6 +152,7 @@ end
 -- Additional settings to fine-tune typesetting
 glossarystyle = glossarystyle or "gglo.ist"
 indexstyle    = indexstyle    or "gind.ist"
+specialtypesetting = specialtypesetting or { }
 
 -- Supporting binaries and options
 biberexe      = biberexe      or "biber"
diff --git a/l3build.dtx b/l3build.dtx
index 52f96c9..f54423f 100644
--- a/l3build.dtx
+++ b/l3build.dtx
@@ -138,6 +138,7 @@
 \luavarseparator
 \luavarset{glossarystyle}{"gglo.ist"}{MakeIndex style file for glossary/changes creation}
 \luavarset{indexstyle}   {"gind.ist"}{MakeIndex style for index creation}
+\luavarset{specialtypesetting}{\meta{table}} {Non-standard typesetting combinations}
 \luavarseparator
 \luavarset{forcecheckepoch}{"true"}    {Force epoch when running tests}
 \luavarset{forcedocepoch}  {"false"}   {Force epoch when typesetting}
@@ -1400,6 +1401,22 @@
 % to be executed once all standard set up is complete but before any typesetting
 % is run.
 %
+% \subsection{Non-standard typesetting}
+%
+% To allow non-standard typesetting combinations, for example per-file
+% choice of engines, the table \var{specialtypesetting} may be used.
+% This is a table with one entry per file. Each entry is itself a table,
+% and these contain a list of engines and settings for |cmd| and |function|.
+% For example, to choose to use \LuaTeX{} for one file when \var{typesetexe}
+% is |pdftex|
+% \begin{verbatim}
+% specialtypesetting.foo = {cmd = "luatex -interaction=nonstopmode"}
+% \end{verbatim}
+% or to select an entirely different typesetting function
+% \begin{verbatim}
+% specialtypesetting.foo = {function = typeset_foo}
+% \end{verbatim}
+%
 % \subsection{Automated upload to CTAN}
 % \label{sec:upload}
 %
@@ -1822,9 +1839,10 @@
 %
 % \begin{function}{tex()}
 %   \begin{syntax}
-%     |tex(|\meta{file},\meta{dir}|)|
+%     |tex(|\meta{file},\meta{dir},\meta{cmd}|)|
 %   \end{syntax}
-%   Runs \luavar{typesetexe} on the \meta{name} inside the \meta{dir}.
+%   Runs \meta{cmd} (by default \luavar{typestexe} \luavar{typesetopts}) on the
+%   \meta{name} inside the \meta{dir}.
 % \end{function}
 %
 % \begin{function}{runcmd()}





More information about the latex3-commits mailing list.