diff --git a/README.md b/README.md index 2801d25..3ed5783 100644 --- a/README.md +++ b/README.md @@ -88,6 +88,8 @@ Command-line Options * `--package-support=PKG1[,PKG2,...,PKGn]` Enable special support for shell-escaping packages. Currently supported packages are `minted` and `epstopdf`. +* `--engine-executable=COMMAND` + The actual TeX command to use. Options to run auxiliary programs: diff --git a/bin/cluttex b/bin/cluttex index 3fb0a31..1ca2b33 100755 --- a/bin/cluttex +++ b/bin/cluttex @@ -745,7 +745,8 @@ local engine_meta = {} engine_meta.__index = engine_meta engine_meta.dvi_extension = "dvi" function engine_meta:build_command(inputline, options) - local command = {self.executable, "-recorder"} + local executable = options.engine_executable or self.executable + local command = {executable, "-recorder"} if options.fmt then table.insert(command, "-fmt=" .. options.fmt) end @@ -1399,6 +1400,9 @@ Options: xelatex, xetex, latex, etex, tex, platex, eptex, ptex, uplatex, euptex, uptex, + --engine-executable=COMMAND+OPTIONs + The actual TeX command to use. + [default: ENGINE] -o, --output=FILE The name of output file. [default: JOBNAME.pdf or JOBNAME.dvi] --fresh Clean intermediate files before running TeX. @@ -1452,6 +1456,10 @@ local option_spec = { long = "engine", param = true, }, + { + long = "engine-executable", + param = true, + }, { short = "o", long = "output", @@ -1632,6 +1640,10 @@ local function handle_cluttex_options(arg) assert(options.engine == nil, "multiple --engine options") options.engine = param + elseif name == "engine-executable" then + assert(options.engine_executable == nil, "multiple --engine-executable options") + options.engine_executable = param + elseif name == "output" then assert(options.output == nil, "multiple --output options") options.output = param @@ -2731,7 +2743,7 @@ end -- Prepare output directory if options.output_directory == nil then local inputfile_abs = pathutil.abspath(inputfile) - options.output_directory = genOutputDirectory(inputfile_abs, jobname, options.engine) + options.output_directory = genOutputDirectory(inputfile_abs, jobname, options.engine_executable or options.engine) if not fsutil.isdir(options.output_directory) then assert(fsutil.mkdir_rec(options.output_directory)) @@ -2795,6 +2807,7 @@ local recorderfile = path_in_output_directory("fls") local recorderfile2 = path_in_output_directory("cluttex-fls") local tex_options = { + engine_executable = options.engine_executable, interaction = options.interaction, file_line_error = options.file_line_error, halt_on_error = options.halt_on_error, diff --git a/bin/cluttex.bat b/bin/cluttex.bat index 6caf85e..210ba79 100644 --- a/bin/cluttex.bat +++ b/bin/cluttex.bat @@ -748,7 +748,8 @@ local engine_meta = {} engine_meta.__index = engine_meta engine_meta.dvi_extension = "dvi" function engine_meta:build_command(inputline, options) - local command = {self.executable, "-recorder"} + local executable = options.engine_executable or self.executable + local command = {executable, "-recorder"} if options.fmt then table.insert(command, "-fmt=" .. options.fmt) end @@ -1402,6 +1403,9 @@ Options: xelatex, xetex, latex, etex, tex, platex, eptex, ptex, uplatex, euptex, uptex, + --engine-executable=COMMAND+OPTIONs + The actual TeX command to use. + [default: ENGINE] -o, --output=FILE The name of output file. [default: JOBNAME.pdf or JOBNAME.dvi] --fresh Clean intermediate files before running TeX. @@ -1455,6 +1459,10 @@ local option_spec = { long = "engine", param = true, }, + { + long = "engine-executable", + param = true, + }, { short = "o", long = "output", @@ -1635,6 +1643,10 @@ local function handle_cluttex_options(arg) assert(options.engine == nil, "multiple --engine options") options.engine = param + elseif name == "engine-executable" then + assert(options.engine_executable == nil, "multiple --engine-executable options") + options.engine_executable = param + elseif name == "output" then assert(options.output == nil, "multiple --output options") options.output = param @@ -2734,7 +2746,7 @@ end -- Prepare output directory if options.output_directory == nil then local inputfile_abs = pathutil.abspath(inputfile) - options.output_directory = genOutputDirectory(inputfile_abs, jobname, options.engine) + options.output_directory = genOutputDirectory(inputfile_abs, jobname, options.engine_executable or options.engine) if not fsutil.isdir(options.output_directory) then assert(fsutil.mkdir_rec(options.output_directory)) @@ -2798,6 +2810,7 @@ local recorderfile = path_in_output_directory("fls") local recorderfile2 = path_in_output_directory("cluttex-fls") local tex_options = { + engine_executable = options.engine_executable, interaction = options.interaction, file_line_error = options.file_line_error, halt_on_error = options.halt_on_error, diff --git a/src/cluttex.lua b/src/cluttex.lua index e0f0c69..a5654cc 100644 --- a/src/cluttex.lua +++ b/src/cluttex.lua @@ -91,7 +91,7 @@ end -- Prepare output directory if options.output_directory == nil then local inputfile_abs = pathutil.abspath(inputfile) - options.output_directory = genOutputDirectory(inputfile_abs, jobname, options.engine) + options.output_directory = genOutputDirectory(inputfile_abs, jobname, options.engine_executable or options.engine) if not fsutil.isdir(options.output_directory) then assert(fsutil.mkdir_rec(options.output_directory)) @@ -155,6 +155,7 @@ local recorderfile = path_in_output_directory("fls") local recorderfile2 = path_in_output_directory("cluttex-fls") local tex_options = { + engine_executable = options.engine_executable, interaction = options.interaction, file_line_error = options.file_line_error, halt_on_error = options.halt_on_error, diff --git a/src/texrunner/handleoption.lua b/src/texrunner/handleoption.lua index 01c2bc3..f3caaa2 100644 --- a/src/texrunner/handleoption.lua +++ b/src/texrunner/handleoption.lua @@ -36,6 +36,9 @@ Options: xelatex, xetex, latex, etex, tex, platex, eptex, ptex, uplatex, euptex, uptex, + --engine-executable=COMMAND+OPTIONs + The actual TeX command to use. + [default: ENGINE] -o, --output=FILE The name of output file. [default: JOBNAME.pdf or JOBNAME.dvi] --fresh Clean intermediate files before running TeX. @@ -89,6 +92,10 @@ local option_spec = { long = "engine", param = true, }, + { + long = "engine-executable", + param = true, + }, { short = "o", long = "output", @@ -269,6 +276,10 @@ local function handle_cluttex_options(arg) assert(options.engine == nil, "multiple --engine options") options.engine = param + elseif name == "engine-executable" then + assert(options.engine_executable == nil, "multiple --engine-executable options") + options.engine_executable = param + elseif name == "output" then assert(options.output == nil, "multiple --output options") options.output = param diff --git a/src/texrunner/tex_engine.lua b/src/texrunner/tex_engine.lua index 8811562..c0f64ea 100644 --- a/src/texrunner/tex_engine.lua +++ b/src/texrunner/tex_engine.lua @@ -52,7 +52,8 @@ local engine_meta = {} engine_meta.__index = engine_meta engine_meta.dvi_extension = "dvi" function engine_meta:build_command(inputline, options) - local command = {self.executable, "-recorder"} + local executable = options.engine_executable or self.executable + local command = {executable, "-recorder"} if options.fmt then table.insert(command, "-fmt=" .. options.fmt) end