Skip to content

Commit

Permalink
Add --engine-executable option
Browse files Browse the repository at this point in the history
  • Loading branch information
minoki committed Aug 21, 2019
1 parent 8a586a4 commit bded84e
Show file tree
Hide file tree
Showing 6 changed files with 47 additions and 6 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand Down
17 changes: 15 additions & 2 deletions bin/cluttex
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -1452,6 +1456,10 @@ local option_spec = {
long = "engine",
param = true,
},
{
long = "engine-executable",
param = true,
},
{
short = "o",
long = "output",
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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))
Expand Down Expand Up @@ -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,
Expand Down
17 changes: 15 additions & 2 deletions bin/cluttex.bat
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -1455,6 +1459,10 @@ local option_spec = {
long = "engine",
param = true,
},
{
long = "engine-executable",
param = true,
},
{
short = "o",
long = "output",
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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))
Expand Down Expand Up @@ -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,
Expand Down
3 changes: 2 additions & 1 deletion src/cluttex.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down Expand Up @@ -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,
Expand Down
11 changes: 11 additions & 0 deletions src/texrunner/handleoption.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -89,6 +92,10 @@ local option_spec = {
long = "engine",
param = true,
},
{
long = "engine-executable",
param = true,
},
{
short = "o",
long = "output",
Expand Down Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion src/texrunner/tex_engine.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit bded84e

Please sign in to comment.