summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xBuild/source/texk/texlive/linked_scripts/cluttex/cluttex.lua256
-rwxr-xr-xBuild/source/texk/texlive/linked_scripts/context/perl/mptopdf.pl6
-rw-r--r--Master/texmf-dist/doc/support/cluttex/CHANGELOG.md10
-rw-r--r--Master/texmf-dist/doc/support/cluttex/Makefile1
-rw-r--r--Master/texmf-dist/doc/support/cluttex/README.md4
-rwxr-xr-xMaster/texmf-dist/doc/support/cluttex/bin/cluttex.bat256
-rw-r--r--Master/texmf-dist/doc/support/cluttex/build.lua4
-rw-r--r--Master/texmf-dist/doc/support/cluttex/doc/Makefile20
-rw-r--r--Master/texmf-dist/doc/support/cluttex/doc/cluttex-ja.pdfbin0 -> 480358 bytes
-rw-r--r--Master/texmf-dist/doc/support/cluttex/doc/cluttex-ja.tex (renamed from Master/texmf-dist/doc/support/cluttex/doc/manual-ja.tex)17
-rw-r--r--Master/texmf-dist/doc/support/cluttex/doc/cluttex.pdfbin0 -> 174976 bytes
-rw-r--r--Master/texmf-dist/doc/support/cluttex/doc/cluttex.tex (renamed from Master/texmf-dist/doc/support/cluttex/doc/manual.tex)19
-rw-r--r--Master/texmf-dist/doc/support/cluttex/doc/manual-ja.pdfbin476078 -> 0 bytes
-rw-r--r--Master/texmf-dist/doc/support/cluttex/doc/manual.pdfbin173012 -> 0 bytes
-rw-r--r--Master/texmf-dist/doc/support/cluttex/src/cluttex.lua12
-rw-r--r--Master/texmf-dist/doc/support/cluttex/src/texrunner/auxfile.lua12
-rw-r--r--Master/texmf-dist/doc/support/cluttex/src/texrunner/checkdriver.lua184
-rw-r--r--Master/texmf-dist/doc/support/cluttex/src/texrunner/handleoption.lua38
-rw-r--r--Master/texmf-dist/doc/support/cluttex/src/texrunner/luatexinit.lua6
-rw-r--r--Master/texmf-dist/doc/support/cluttex/src/texrunner/message.lua2
-rwxr-xr-xMaster/texmf-dist/scripts/cluttex/cluttex.lua256
21 files changed, 1038 insertions, 65 deletions
diff --git a/Build/source/texk/texlive/linked_scripts/cluttex/cluttex.lua b/Build/source/texk/texlive/linked_scripts/cluttex/cluttex.lua
index a3021e48a02..d3859a69fa5 100755
--- a/Build/source/texk/texlive/linked_scripts/cluttex/cluttex.lua
+++ b/Build/source/texk/texlive/linked_scripts/cluttex/cluttex.lua
@@ -1133,8 +1133,9 @@ local function parse_aux_file(auxfile, outdir, report, seen)
for l in io.lines(auxfile) do
local subauxfile = string_match(l, "\\@input{(.+)}")
if subauxfile then
- if fsutil.isfile(subauxfile) then
- parse_aux_file(pathutil.join(outdir, subauxfile), outdir, report, seen)
+ local subauxfile_abs = pathutil.abspath(subauxfile, outdir)
+ if fsutil.isfile(subauxfile_abs) then
+ parse_aux_file(subauxfile_abs, outdir, report, seen)
else
local dir = pathutil.join(outdir, pathutil.dirname(subauxfile))
if not fsutil.isdir(dir) then
@@ -1159,8 +1160,11 @@ local function extract_bibtex_from_aux_file(auxfile, outdir, biblines)
end
elseif name == "@input" then
local subauxfile = string_match(l, "\\@input{(.+)}")
- if subauxfile and fsutil.isfile(subauxfile) then
- extract_bibtex_from_aux_file(pathutil.join(outdir, subauxfile), outdir, biblines)
+ if subauxfile then
+ local subauxfile_abs = pathutil.abspath(subauxfile, outdir)
+ if fsutil.isfile(subauxfile_abs) then
+ extract_bibtex_from_aux_file(subauxfile_abs, outdir, biblines)
+ end
end
end
end
@@ -1192,17 +1196,19 @@ local texio_write_nl = texio.write_nl
-- Packages coded in Lua doesn't follow -output-directory option and doesn't write command to the log file
initscript:write(string.format("local output_directory = %q\n", options.output_directory))
+ -- tex.jobname may not be available when io.open is called for the first time
+ initscript:write(string.format("local jobname = %q\n", options.jobname))
initscript:write([==[
local luawritelog
local function openluawritelog()
if not luawritelog then
- luawritelog = assert(io_open(output_directory .. "/" .. tex.jobname .. ".cluttex-fls", "w"))
+ luawritelog = assert(io_open(output_directory .. "/" .. jobname .. ".cluttex-fls", "w"))
end
return luawritelog
end
io.open = function(fname, mode)
-- luatexja-ruby
- if mode == "w" and fname == tex.jobname .. ".ltjruby" then
+ if mode == "w" and fname == jobname .. ".ltjruby" then
fname = output_directory .. "/" .. fname
end
if type(mode) == "string" and string.find(mode, "w") ~= nil then
@@ -1363,7 +1369,7 @@ return {
end
package.preload["texrunner.handleoption"] = function(...)
local COPYRIGHT_NOTICE = [[
-Copyright (C) 2016,2018-2019 ARATA Mizuki
+Copyright (C) 2016-2020 ARATA Mizuki
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -1436,6 +1442,8 @@ Options:
Enable special support for some shell-escaping
packages.
Currently supported: minted, epstopdf
+ --check-driver=DRIVER Check that the correct driver file is loaded.
+ DRIVER is one of `dvipdfmx', `dvips', `dvisvgm'.
--[no-]shell-escape
--shell-restricted
@@ -1518,6 +1526,10 @@ local option_spec = {
long = "package-support",
param = true
},
+ {
+ long = "check-driver",
+ param = true
+ },
-- Options for TeX
{
long = "synctex",
@@ -1621,6 +1633,10 @@ local function set_default_values(options)
if options.halt_on_error == nil then
options.halt_on_error = true
end
+
+ if options.output_format == nil then
+ options.output_format = "pdf"
+ end
end
-- inputfile, engine, options = handle_cluttex_options(arg)
@@ -1709,6 +1725,11 @@ local function handle_cluttex_options(arg)
end
end
+ elseif name == "check-driver" then
+ assert(options.check_driver == nil, "multiple --check-driver options")
+ assert(param == "dvipdfmx" or param == "dvips" or param == "dvisvgm", "wrong value for --check-driver option")
+ options.check_driver = param
+
-- Options for TeX
elseif name == "synctex" then
assert(options.synctex == nil, "multiple --synctex options")
@@ -1819,6 +1840,27 @@ local function handle_cluttex_options(arg)
set_default_values(options)
+ if options.output_format == "pdf" then
+ if options.check_driver ~= nil then
+ error("--check-driver can only be used when the output format is DVI.")
+ end
+ if engine.supports_pdf_generation then
+ if engine.is_luatex then
+ options.check_driver = "luatex"
+ elseif engine.name == "xetex" or engine.name == "xelatex" then
+ options.check_driver = "xetex"
+ elseif engine.name == "pdftex" or engine.name == "pdflatex" then
+ options.check_driver = "pdftex"
+ else
+ message.warning("Unknown engine: "..engine.name)
+ message.warning("Driver check will not work.")
+ end
+ else
+ -- ClutTeX uses dvipdfmx to generate PDF from DVI output.
+ options.check_driver = "dvipdfmx"
+ end
+ end
+
return inputfile, engine, options
end
@@ -2127,7 +2169,7 @@ local CMD = {
local function exec_msg(commandline)
if use_colors then
- io.stderr:write(CMD.fg_x_white, CMD.bg_red, "[EXEC]", CMD.reset, " ", CMD.fg_red, commandline, CMD.reset, "\n")
+ io.stderr:write(CMD.fg_x_white, CMD.bg_red, "[EXEC]", CMD.reset, " ", CMD.fg_cyan, commandline, CMD.reset, "\n")
else
io.stderr:write("[EXEC] ", commandline, "\n")
end
@@ -2659,8 +2701,194 @@ return {
safeinput = safeinput,
}
end
+package.preload["texrunner.checkdriver"] = function(...)
+--[[
+ Copyright 2020 ARATA Mizuki
+
+ This file is part of ClutTeX.
+
+ ClutTeX is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ ClutTeX is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with ClutTeX. If not, see <http://www.gnu.org/licenses/>.
+]]
+local assert = assert
+local ipairs = ipairs
+local error = error
+local string = string
+local pathutil = require "texrunner.pathutil"
+local message = require "texrunner.message"
+
+local right_values = {
+ dvips = {
+ graphics = "dvips",
+ expl3 = "dvips",
+ hyperref = "dvips",
+ xypic = "dvips",
+ },
+ dvipdfmx = {
+ graphics = "dvipdfmx",
+ expl3 = "dvipdfmx",
+ hyperref = "dvipdfmx",
+ xypic = "pdf",
+ },
+ dvisvgm = {
+ graphics = "dvisvgm",
+ expl3 = "dvisvgm",
+ },
+ xetex = {
+ graphics = "xetex",
+ expl3 = "xdvipdfmx",
+ hyperref = "xetex",
+ xypic = "pdf",
+ },
+ pdftex = {
+ graphics = "pdftex",
+ expl3 = "pdfmode",
+ hyperref = "pdftex",
+ xypic = "pdf",
+ },
+ luatex = {
+ graphics = "luatex",
+ expl3 = "pdfmode",
+ hyperref = "luatex",
+ xypic = "pdf",
+ },
+}
+
+-- expected_driver: one of "dvips", "dvipdfmx", "dvisvgm", "pdftex", "xetex", "luatex"
+local function checkdriver(expected_driver, filelist)
+ if CLUTTEX_VERBOSITY >= 1 then
+ message.info("checkdriver: expects ", expected_driver)
+ end
+
+ local loaded = {}
+ for i,t in ipairs(filelist) do
+ if t.kind == "input" then
+ local basename = pathutil.basename(t.path)
+ loaded[basename] = true
+ end
+ end
+
+ local graphics_driver = nil -- "dvipdfmx" | "dvips" | "dvisvgm" | "pdftex" | "luatex" | "xetex" | "unknown"
+ if loaded["graphics.sty"] or loaded["color.sty"] then
+ if loaded["dvipdfmx.def"] then
+ graphics_driver = "dvipdfmx"
+ elseif loaded["dvips.def"] then
+ graphics_driver = "dvips"
+ elseif loaded["dvisvgm.def"] then
+ graphics_driver = "dvisvgm"
+ elseif loaded["pdftex.def"] then
+ graphics_driver = "pdftex"
+ elseif loaded["luatex.def"] then
+ graphics_driver = "luatex"
+ elseif loaded["xetex.def"] then
+ graphics_driver = "xetex"
+ else
+ -- Not supported: dvipdf, dvipsone, emtex, textures, pctexps, pctexwin, pctexhp, pctex32, truetex, tcidvi, vtex
+ graphics_driver = "unknown"
+ end
+ end
+ local expl3_driver = nil -- "pdfmode" | "dvisvgm" | "xdvipdfmx" | "dvipdfmx" | "dvips" | "unknown"
+ if loaded["expl3-code.tex"] or loaded["expl3.sty"] or loaded["l3backend-dvips.def"] or loaded["l3backend-dvipdfmx.def"] or loaded["l3backend-xdvipdfmx.def"] or loaded["l3backend-pdfmode.def"] then
+ if loaded["l3backend-pdfmode.def"] then
+ expl3_driver = "pdfmode" -- pdftex, luatex
+ elseif loaded["l3backend-dvisvgm.def"] then
+ expl3_driver = "dvisvgm"
+ elseif loaded["l3backend-xdvipdfmx.def"] then
+ expl3_driver = "xdvipdfmx"
+ elseif loaded["l3backend-dvipdfmx.def"] then
+ expl3_driver = "dvipdfmx"
+ elseif loaded["l3backend-dvips.def"] then
+ expl3_driver = "dvips"
+ else
+ -- TODO: driver=latex2e?
+ expl3_driver = "unknown"
+ end
+ end
+ local hyperref_driver = nil -- "luatex" | "pdftex" | "xetex" | "dvipdfmx" | "dvips" | "unknown"
+ if loaded["hyperref.sty"] then
+ if loaded["hluatex.def"] then
+ hyperref_driver = "luatex"
+ elseif loaded["hpdftex.def"] then
+ hyperref_driver = "pdftex"
+ elseif loaded["hxetex.def"] then
+ hyperref_driver = "xetex"
+ elseif loaded["hdvipdfm.def"] then
+ hyperref_driver = "dvipdfmx"
+ elseif loaded["hdvips.def"] then
+ hyperref_driver = "dvips"
+ else
+ -- Not supported: dvipson, dviwind, tex4ht, texture, vtex, vtexhtm, xtexmrk, hypertex
+ hyperref_driver = "unknown"
+ end
+ -- TODO: dvisvgm?
+ end
+ local xypic_driver = nil -- "pdf" | "dvips" | "unknown"
+ if loaded["xy.tex"] then
+ if loaded["xypdf.tex"] then
+ xypic_driver = "pdf" -- pdftex, luatex, xetex, dvipdfmx
+ elseif loaded["xydvips.tex"] then
+ xypic_driver = "dvips"
+ else
+ -- Not supported: dvidrv, dvitops, oztex, 17oztex, textures, 16textures, xdvi
+ xypic_driver = "unknown"
+ end
+ -- TODO: dvisvgm?
+ end
+
+ if CLUTTEX_VERBOSITY >= 1 then
+ message.info("checkdriver: graphics=", tostring(graphics_driver))
+ message.info("checkdriver: expl3=", tostring(expl3_driver))
+ message.info("checkdriver: hyperref=", tostring(hyperref_driver))
+ message.info("checkdriver: xypic=", tostring(xypic_driver))
+ end
+
+ local expected = assert(right_values[expected_driver], "invalid value for expected_driver")
+ if graphics_driver ~= nil and expected.graphics ~= nil and graphics_driver ~= expected.graphics then
+ message.diag("The driver option for graphics(x)/color is missing or wrong.")
+ message.diag("Consider setting '", expected.graphics, "' option.")
+ end
+ if expl3_driver ~= nil and expected.expl3 ~= nil and expl3_driver ~= expected.expl3 then
+ message.diag("The driver option for expl3 is missing or wrong.")
+ message.diag("Consider setting 'driver=", expected.expl3, "' option when loading expl3.")
+ end
+ if hyperref_driver ~= nil and expected.hyperref ~= nil and hyperref_driver ~= expected.hyperref then
+ message.diag("The driver option for hyperref is missing or wrong.")
+ message.diag("Consider setting '", expected.hyperref, "' option.")
+ end
+ if xypic_driver ~= nil and expected.xypic ~= nil and xypic_driver ~= expected.xypic then
+ message.diag("The driver option for Xy-pic is missing or wrong.")
+ if expected_driver == "dvipdfmx" then
+ message.diag("Consider setting 'dvipdfmx' option or running \\xyoption{pdf}.")
+ elseif expected_driver == "pdftex" then
+ message.diag("Consider setting 'pdftex' option or running \\xyoption{pdf}.")
+ elseif expected.xypic == "pdf" then
+ message.diag("Consider setting 'pdf' package option or running \\xyoption{pdf}.")
+ elseif expected.xypic == "dvips" then
+ message.diag("Consider setting 'dvips' option.")
+ end
+ end
+end
+
+--[[
+filelist[i] = {path = ""}
+]]
+
+return {
+ checkdriver = checkdriver,
+}
+end
--[[
- Copyright 2016,2018-2019 ARATA Mizuki
+ Copyright 2016-2020 ARATA Mizuki
This file is part of ClutTeX.
@@ -2678,7 +2906,7 @@ end
along with ClutTeX. If not, see <http://www.gnu.org/licenses/>.
]]
-CLUTTEX_VERSION = "v0.4"
+CLUTTEX_VERSION = "v0.5"
-- Standard libraries
local coroutine = coroutine
@@ -2700,6 +2928,7 @@ local message = require "texrunner.message"
local safename = require "texrunner.safename"
local extract_bibtex_from_aux_file = require "texrunner.auxfile".extract_bibtex_from_aux_file
local handle_cluttex_options = require "texrunner.handleoption".handle_cluttex_options
+local checkdriver = require "texrunner.checkdriver".checkdriver
os.setlocale("", "ctype") -- Workaround for recent Universal CRT
@@ -2729,9 +2958,6 @@ end
local jobname = options.jobname
assert(jobname ~= "", "jobname cannot be empty")
-if options.output_format == nil then
- options.output_format = "pdf"
-end
local output_extension
if options.output_format == "dvi" then
output_extension = engine.dvi_extension or "dvi"
@@ -2955,6 +3181,10 @@ local function single_run(auxstatus, iteration)
logfile:close()
end
+ if options.check_driver ~= nil then
+ checkdriver(options.check_driver, filelist)
+ end
+
if options.makeindex then
-- Look for .idx files and run MakeIndex
for _,file in ipairs(filelist) do
diff --git a/Build/source/texk/texlive/linked_scripts/context/perl/mptopdf.pl b/Build/source/texk/texlive/linked_scripts/context/perl/mptopdf.pl
index 42db9001ec4..5fe53c98f4c 100755
--- a/Build/source/texk/texlive/linked_scripts/context/perl/mptopdf.pl
+++ b/Build/source/texk/texlive/linked_scripts/context/perl/mptopdf.pl
@@ -3,6 +3,12 @@ eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' && eval 'exec perl -S $0 $
# MikTeX users can set environment variable TEXSYSTEM to "miktex".
+# There have been suggestions to patch this script for dealing with different
+# output templates (a relative new metapost feature) but these have given
+# unwanted side effects. One can always wrap this script in another script
+# to deal with whatever patterns needed. We won't touch what has worked for
+# ages. (December 2019)
+
#D \module
#D [ file=mptopdf.pl,
#D version=2010.05.28, % 2000.05.29
diff --git a/Master/texmf-dist/doc/support/cluttex/CHANGELOG.md b/Master/texmf-dist/doc/support/cluttex/CHANGELOG.md
index b07933de056..2aa1b99bf14 100644
--- a/Master/texmf-dist/doc/support/cluttex/CHANGELOG.md
+++ b/Master/texmf-dist/doc/support/cluttex/CHANGELOG.md
@@ -1,3 +1,13 @@
+Version 0.5 (2020-02-06)
+-----
+
+Changes:
+
+* New option: `--check-driver`
+* Driver options for some packages are always checked when the output format is PDF.
+* The color for EXEC messages are now cyan ([Issue #2](https://github.com/minoki/cluttex/issues/2)).
+* Some bug-fixes.
+
Version 0.4 (2019-08-21)
-----
diff --git a/Master/texmf-dist/doc/support/cluttex/Makefile b/Master/texmf-dist/doc/support/cluttex/Makefile
index ef12dd5131c..ae764ad2ab5 100644
--- a/Master/texmf-dist/doc/support/cluttex/Makefile
+++ b/Master/texmf-dist/doc/support/cluttex/Makefile
@@ -21,6 +21,7 @@ sources= \
src/texrunner/message.lua \
src/texrunner/fswatcher_windows.lua \
src/texrunner/safename.lua \
+ src/texrunner/checkdriver.lua \
src/cluttex.lua
bin/cluttex: $(sources) build.lua
diff --git a/Master/texmf-dist/doc/support/cluttex/README.md b/Master/texmf-dist/doc/support/cluttex/README.md
index 3ed578337ec..80acb125ab2 100644
--- a/Master/texmf-dist/doc/support/cluttex/README.md
+++ b/Master/texmf-dist/doc/support/cluttex/README.md
@@ -90,6 +90,10 @@ Command-line Options
Currently supported packages are `minted` and `epstopdf`.
* `--engine-executable=COMMAND`
The actual TeX command to use.
+* `--check-driver=DRIVER`
+ Check that the correct driver file is loaded.
+ `DRIVER` is one of `dvipdfmx`, `dvips`, `dvisvgm`.
+ Can only be used with `--output-format=dvi`.
Options to run auxiliary programs:
diff --git a/Master/texmf-dist/doc/support/cluttex/bin/cluttex.bat b/Master/texmf-dist/doc/support/cluttex/bin/cluttex.bat
index 5779e698db5..df0dfd395c0 100755
--- a/Master/texmf-dist/doc/support/cluttex/bin/cluttex.bat
+++ b/Master/texmf-dist/doc/support/cluttex/bin/cluttex.bat
@@ -1136,8 +1136,9 @@ local function parse_aux_file(auxfile, outdir, report, seen)
for l in io.lines(auxfile) do
local subauxfile = string_match(l, "\\@input{(.+)}")
if subauxfile then
- if fsutil.isfile(subauxfile) then
- parse_aux_file(pathutil.join(outdir, subauxfile), outdir, report, seen)
+ local subauxfile_abs = pathutil.abspath(subauxfile, outdir)
+ if fsutil.isfile(subauxfile_abs) then
+ parse_aux_file(subauxfile_abs, outdir, report, seen)
else
local dir = pathutil.join(outdir, pathutil.dirname(subauxfile))
if not fsutil.isdir(dir) then
@@ -1162,8 +1163,11 @@ local function extract_bibtex_from_aux_file(auxfile, outdir, biblines)
end
elseif name == "@input" then
local subauxfile = string_match(l, "\\@input{(.+)}")
- if subauxfile and fsutil.isfile(subauxfile) then
- extract_bibtex_from_aux_file(pathutil.join(outdir, subauxfile), outdir, biblines)
+ if subauxfile then
+ local subauxfile_abs = pathutil.abspath(subauxfile, outdir)
+ if fsutil.isfile(subauxfile_abs) then
+ extract_bibtex_from_aux_file(subauxfile_abs, outdir, biblines)
+ end
end
end
end
@@ -1195,17 +1199,19 @@ local texio_write_nl = texio.write_nl
-- Packages coded in Lua doesn't follow -output-directory option and doesn't write command to the log file
initscript:write(string.format("local output_directory = %q\n", options.output_directory))
+ -- tex.jobname may not be available when io.open is called for the first time
+ initscript:write(string.format("local jobname = %q\n", options.jobname))
initscript:write([==[
local luawritelog
local function openluawritelog()
if not luawritelog then
- luawritelog = assert(io_open(output_directory .. "/" .. tex.jobname .. ".cluttex-fls", "w"))
+ luawritelog = assert(io_open(output_directory .. "/" .. jobname .. ".cluttex-fls", "w"))
end
return luawritelog
end
io.open = function(fname, mode)
-- luatexja-ruby
- if mode == "w" and fname == tex.jobname .. ".ltjruby" then
+ if mode == "w" and fname == jobname .. ".ltjruby" then
fname = output_directory .. "/" .. fname
end
if type(mode) == "string" and string.find(mode, "w") ~= nil then
@@ -1366,7 +1372,7 @@ return {
end
package.preload["texrunner.handleoption"] = function(...)
local COPYRIGHT_NOTICE = [[
-Copyright (C) 2016,2018-2019 ARATA Mizuki
+Copyright (C) 2016-2020 ARATA Mizuki
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -1439,6 +1445,8 @@ Options:
Enable special support for some shell-escaping
packages.
Currently supported: minted, epstopdf
+ --check-driver=DRIVER Check that the correct driver file is loaded.
+ DRIVER is one of `dvipdfmx', `dvips', `dvisvgm'.
--[no-]shell-escape
--shell-restricted
@@ -1521,6 +1529,10 @@ local option_spec = {
long = "package-support",
param = true
},
+ {
+ long = "check-driver",
+ param = true
+ },
-- Options for TeX
{
long = "synctex",
@@ -1624,6 +1636,10 @@ local function set_default_values(options)
if options.halt_on_error == nil then
options.halt_on_error = true
end
+
+ if options.output_format == nil then
+ options.output_format = "pdf"
+ end
end
-- inputfile, engine, options = handle_cluttex_options(arg)
@@ -1712,6 +1728,11 @@ local function handle_cluttex_options(arg)
end
end
+ elseif name == "check-driver" then
+ assert(options.check_driver == nil, "multiple --check-driver options")
+ assert(param == "dvipdfmx" or param == "dvips" or param == "dvisvgm", "wrong value for --check-driver option")
+ options.check_driver = param
+
-- Options for TeX
elseif name == "synctex" then
assert(options.synctex == nil, "multiple --synctex options")
@@ -1822,6 +1843,27 @@ local function handle_cluttex_options(arg)
set_default_values(options)
+ if options.output_format == "pdf" then
+ if options.check_driver ~= nil then
+ error("--check-driver can only be used when the output format is DVI.")
+ end
+ if engine.supports_pdf_generation then
+ if engine.is_luatex then
+ options.check_driver = "luatex"
+ elseif engine.name == "xetex" or engine.name == "xelatex" then
+ options.check_driver = "xetex"
+ elseif engine.name == "pdftex" or engine.name == "pdflatex" then
+ options.check_driver = "pdftex"
+ else
+ message.warning("Unknown engine: "..engine.name)
+ message.warning("Driver check will not work.")
+ end
+ else
+ -- ClutTeX uses dvipdfmx to generate PDF from DVI output.
+ options.check_driver = "dvipdfmx"
+ end
+ end
+
return inputfile, engine, options
end
@@ -2130,7 +2172,7 @@ local CMD = {
local function exec_msg(commandline)
if use_colors then
- io.stderr:write(CMD.fg_x_white, CMD.bg_red, "[EXEC]", CMD.reset, " ", CMD.fg_red, commandline, CMD.reset, "\n")
+ io.stderr:write(CMD.fg_x_white, CMD.bg_red, "[EXEC]", CMD.reset, " ", CMD.fg_cyan, commandline, CMD.reset, "\n")
else
io.stderr:write("[EXEC] ", commandline, "\n")
end
@@ -2662,8 +2704,194 @@ return {
safeinput = safeinput,
}
end
+package.preload["texrunner.checkdriver"] = function(...)
+--[[
+ Copyright 2020 ARATA Mizuki
+
+ This file is part of ClutTeX.
+
+ ClutTeX is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ ClutTeX is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with ClutTeX. If not, see <http://www.gnu.org/licenses/>.
+]]
+local assert = assert
+local ipairs = ipairs
+local error = error
+local string = string
+local pathutil = require "texrunner.pathutil"
+local message = require "texrunner.message"
+
+local right_values = {
+ dvips = {
+ graphics = "dvips",
+ expl3 = "dvips",
+ hyperref = "dvips",
+ xypic = "dvips",
+ },
+ dvipdfmx = {
+ graphics = "dvipdfmx",
+ expl3 = "dvipdfmx",
+ hyperref = "dvipdfmx",
+ xypic = "pdf",
+ },
+ dvisvgm = {
+ graphics = "dvisvgm",
+ expl3 = "dvisvgm",
+ },
+ xetex = {
+ graphics = "xetex",
+ expl3 = "xdvipdfmx",
+ hyperref = "xetex",
+ xypic = "pdf",
+ },
+ pdftex = {
+ graphics = "pdftex",
+ expl3 = "pdfmode",
+ hyperref = "pdftex",
+ xypic = "pdf",
+ },
+ luatex = {
+ graphics = "luatex",
+ expl3 = "pdfmode",
+ hyperref = "luatex",
+ xypic = "pdf",
+ },
+}
+
+-- expected_driver: one of "dvips", "dvipdfmx", "dvisvgm", "pdftex", "xetex", "luatex"
+local function checkdriver(expected_driver, filelist)
+ if CLUTTEX_VERBOSITY >= 1 then
+ message.info("checkdriver: expects ", expected_driver)
+ end
+
+ local loaded = {}
+ for i,t in ipairs(filelist) do
+ if t.kind == "input" then
+ local basename = pathutil.basename(t.path)
+ loaded[basename] = true
+ end
+ end
+
+ local graphics_driver = nil -- "dvipdfmx" | "dvips" | "dvisvgm" | "pdftex" | "luatex" | "xetex" | "unknown"
+ if loaded["graphics.sty"] or loaded["color.sty"] then
+ if loaded["dvipdfmx.def"] then
+ graphics_driver = "dvipdfmx"
+ elseif loaded["dvips.def"] then
+ graphics_driver = "dvips"
+ elseif loaded["dvisvgm.def"] then
+ graphics_driver = "dvisvgm"
+ elseif loaded["pdftex.def"] then
+ graphics_driver = "pdftex"
+ elseif loaded["luatex.def"] then
+ graphics_driver = "luatex"
+ elseif loaded["xetex.def"] then
+ graphics_driver = "xetex"
+ else
+ -- Not supported: dvipdf, dvipsone, emtex, textures, pctexps, pctexwin, pctexhp, pctex32, truetex, tcidvi, vtex
+ graphics_driver = "unknown"
+ end
+ end
+ local expl3_driver = nil -- "pdfmode" | "dvisvgm" | "xdvipdfmx" | "dvipdfmx" | "dvips" | "unknown"
+ if loaded["expl3-code.tex"] or loaded["expl3.sty"] or loaded["l3backend-dvips.def"] or loaded["l3backend-dvipdfmx.def"] or loaded["l3backend-xdvipdfmx.def"] or loaded["l3backend-pdfmode.def"] then
+ if loaded["l3backend-pdfmode.def"] then
+ expl3_driver = "pdfmode" -- pdftex, luatex
+ elseif loaded["l3backend-dvisvgm.def"] then
+ expl3_driver = "dvisvgm"
+ elseif loaded["l3backend-xdvipdfmx.def"] then
+ expl3_driver = "xdvipdfmx"
+ elseif loaded["l3backend-dvipdfmx.def"] then
+ expl3_driver = "dvipdfmx"
+ elseif loaded["l3backend-dvips.def"] then
+ expl3_driver = "dvips"
+ else
+ -- TODO: driver=latex2e?
+ expl3_driver = "unknown"
+ end
+ end
+ local hyperref_driver = nil -- "luatex" | "pdftex" | "xetex" | "dvipdfmx" | "dvips" | "unknown"
+ if loaded["hyperref.sty"] then
+ if loaded["hluatex.def"] then
+ hyperref_driver = "luatex"
+ elseif loaded["hpdftex.def"] then
+ hyperref_driver = "pdftex"
+ elseif loaded["hxetex.def"] then
+ hyperref_driver = "xetex"
+ elseif loaded["hdvipdfm.def"] then
+ hyperref_driver = "dvipdfmx"
+ elseif loaded["hdvips.def"] then
+ hyperref_driver = "dvips"
+ else
+ -- Not supported: dvipson, dviwind, tex4ht, texture, vtex, vtexhtm, xtexmrk, hypertex
+ hyperref_driver = "unknown"
+ end
+ -- TODO: dvisvgm?
+ end
+ local xypic_driver = nil -- "pdf" | "dvips" | "unknown"
+ if loaded["xy.tex"] then
+ if loaded["xypdf.tex"] then
+ xypic_driver = "pdf" -- pdftex, luatex, xetex, dvipdfmx
+ elseif loaded["xydvips.tex"] then
+ xypic_driver = "dvips"
+ else
+ -- Not supported: dvidrv, dvitops, oztex, 17oztex, textures, 16textures, xdvi
+ xypic_driver = "unknown"
+ end
+ -- TODO: dvisvgm?
+ end
+
+ if CLUTTEX_VERBOSITY >= 1 then
+ message.info("checkdriver: graphics=", tostring(graphics_driver))
+ message.info("checkdriver: expl3=", tostring(expl3_driver))
+ message.info("checkdriver: hyperref=", tostring(hyperref_driver))
+ message.info("checkdriver: xypic=", tostring(xypic_driver))
+ end
+
+ local expected = assert(right_values[expected_driver], "invalid value for expected_driver")
+ if graphics_driver ~= nil and expected.graphics ~= nil and graphics_driver ~= expected.graphics then
+ message.diag("The driver option for graphics(x)/color is missing or wrong.")
+ message.diag("Consider setting '", expected.graphics, "' option.")
+ end
+ if expl3_driver ~= nil and expected.expl3 ~= nil and expl3_driver ~= expected.expl3 then
+ message.diag("The driver option for expl3 is missing or wrong.")
+ message.diag("Consider setting 'driver=", expected.expl3, "' option when loading expl3.")
+ end
+ if hyperref_driver ~= nil and expected.hyperref ~= nil and hyperref_driver ~= expected.hyperref then
+ message.diag("The driver option for hyperref is missing or wrong.")
+ message.diag("Consider setting '", expected.hyperref, "' option.")
+ end
+ if xypic_driver ~= nil and expected.xypic ~= nil and xypic_driver ~= expected.xypic then
+ message.diag("The driver option for Xy-pic is missing or wrong.")
+ if expected_driver == "dvipdfmx" then
+ message.diag("Consider setting 'dvipdfmx' option or running \\xyoption{pdf}.")
+ elseif expected_driver == "pdftex" then
+ message.diag("Consider setting 'pdftex' option or running \\xyoption{pdf}.")
+ elseif expected.xypic == "pdf" then
+ message.diag("Consider setting 'pdf' package option or running \\xyoption{pdf}.")
+ elseif expected.xypic == "dvips" then
+ message.diag("Consider setting 'dvips' option.")
+ end
+ end
+end
+
+--[[
+filelist[i] = {path = ""}
+]]
+
+return {
+ checkdriver = checkdriver,
+}
+end
--[[
- Copyright 2016,2018-2019 ARATA Mizuki
+ Copyright 2016-2020 ARATA Mizuki
This file is part of ClutTeX.
@@ -2681,7 +2909,7 @@ end
along with ClutTeX. If not, see <http://www.gnu.org/licenses/>.
]]
-CLUTTEX_VERSION = "v0.4"
+CLUTTEX_VERSION = "v0.5"
-- Standard libraries
local coroutine = coroutine
@@ -2703,6 +2931,7 @@ local message = require "texrunner.message"
local safename = require "texrunner.safename"
local extract_bibtex_from_aux_file = require "texrunner.auxfile".extract_bibtex_from_aux_file
local handle_cluttex_options = require "texrunner.handleoption".handle_cluttex_options
+local checkdriver = require "texrunner.checkdriver".checkdriver
os.setlocale("", "ctype") -- Workaround for recent Universal CRT
@@ -2732,9 +2961,6 @@ end
local jobname = options.jobname
assert(jobname ~= "", "jobname cannot be empty")
-if options.output_format == nil then
- options.output_format = "pdf"
-end
local output_extension
if options.output_format == "dvi" then
output_extension = engine.dvi_extension or "dvi"
@@ -2958,6 +3184,10 @@ local function single_run(auxstatus, iteration)
logfile:close()
end
+ if options.check_driver ~= nil then
+ checkdriver(options.check_driver, filelist)
+ end
+
if options.makeindex then
-- Look for .idx files and run MakeIndex
for _,file in ipairs(filelist) do
diff --git a/Master/texmf-dist/doc/support/cluttex/build.lua b/Master/texmf-dist/doc/support/cluttex/build.lua
index 20c58eaebd7..55d900ff025 100644
--- a/Master/texmf-dist/doc/support/cluttex/build.lua
+++ b/Master/texmf-dist/doc/support/cluttex/build.lua
@@ -91,6 +91,10 @@ local modules = {
name = "texrunner.safename",
path = "texrunner/safename.lua",
},
+ {
+ name = "texrunner.checkdriver",
+ path = "texrunner/checkdriver.lua",
+ },
}
local imported_globals = {"io", "os", "string", "table", "package", "require", "assert", "error", "ipairs", "type", "select", "arg"}
diff --git a/Master/texmf-dist/doc/support/cluttex/doc/Makefile b/Master/texmf-dist/doc/support/cluttex/doc/Makefile
index ca870488028..0685cc8c582 100644
--- a/Master/texmf-dist/doc/support/cluttex/doc/Makefile
+++ b/Master/texmf-dist/doc/support/cluttex/doc/Makefile
@@ -1,12 +1,16 @@
-all: manual.pdf manual-ja.pdf
+all: cluttex.pdf cluttex-ja.pdf
-manual.pdf: manual.tex
- cluttex -e pdflatex -o $@ --make-depends=manual.pdf.dep $<
+cluttex.pdf: cluttex.tex
+ cluttex -e pdflatex -o $@ --make-depends=cluttex.pdf.dep $<
-manual-ja.pdf: manual-ja.tex
- cluttex -e lualatex -o $@ --make-depends=manual-ja.pdf.dep $<
+cluttex-ja.pdf: cluttex-ja.tex
+ cluttex -e lualatex -o $@ --make-depends=cluttex-ja.pdf.dep $<
-.PHONY: all
+clean-outdir:
+ -rm -rf $(shell cluttex -e pdflatex --print-output-directory cluttex.tex)
+ -rm -rf $(shell cluttex -e lualatex --print-output-directory cluttex-ja.tex)
--include manual.pdf.dep
--include manual-ja.pdf.dep
+.PHONY: all clean-outdir
+
+-include cluttex.pdf.dep
+-include cluttex-ja.pdf.dep
diff --git a/Master/texmf-dist/doc/support/cluttex/doc/cluttex-ja.pdf b/Master/texmf-dist/doc/support/cluttex/doc/cluttex-ja.pdf
new file mode 100644
index 00000000000..fb5509749ce
--- /dev/null
+++ b/Master/texmf-dist/doc/support/cluttex/doc/cluttex-ja.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/support/cluttex/doc/manual-ja.tex b/Master/texmf-dist/doc/support/cluttex/doc/cluttex-ja.tex
index b89675888f4..b48cbe8f8ba 100644
--- a/Master/texmf-dist/doc/support/cluttex/doc/manual-ja.tex
+++ b/Master/texmf-dist/doc/support/cluttex/doc/cluttex-ja.tex
@@ -10,9 +10,9 @@
\renewcommand\sectionautorefname{セクション}
\renewcommand\subsectionautorefname{サブセクション}
-\title{\ClutTeX{}マニュアル\\(バージョン0.4)}
+\title{\ClutTeX{}マニュアル\\(バージョン0.5)}
\author{ARATA Mizuki}
-\date{2019年8月21日}
+\date{2020年2月6日}
\begin{document}
\maketitle
@@ -27,6 +27,7 @@
\item 入力ファイルを監視し、変更があった場合に自動で再処理する(\texttt{--watch}オプション\footnote{Unix系OSでは、別途プログラムが必要。})
\item MakeIndex, \BibTeX, Biber等のコマンドを自動で実行する(\texttt{--makeindex}オプション, \texttt{--bibtex}オプション, \texttt{--biber}オプション)
\item p\TeX 系列の処理系でPDFを生成する場合、別途\texttt{dvipdfmx}を実行する必要がない(自動で\texttt{dvipdfmx}を実行する)
+ もしもDVIファイルが欲しいのであれば、\texttt{--output-format=dvi}を指定すれば良い。
\end{itemize}
などがある。
@@ -99,6 +100,10 @@
\item[\texttt{--package-support=PKG1[,PKG2,...,PKGn]}]
外部コマンドを実行するパッケージ用の個別の対策を有効にする。
現在のところ、\texttt{minted}と\texttt{epstopdf}に対応している。
+\item[\texttt{--check-driver=DRIVER}]
+ いくつかのパッケージについて、正しいドライバーファイルが読み込まれていることを検査する。
+ \metavar{DRIVER}は\texttt{dvipdfmx}, \texttt{dvips}, or \texttt{dvisvgm}のいずれかである。
+ このオプションは\texttt{--output-format=dvi}が指定された場合にのみ指定できる。
\end{description}
補助コマンド実行用のオプション:
@@ -265,4 +270,12 @@ Unix用コマンドの中には、自身の名前によって挙動を変える
cluttex -e pdflatex --shell-escape --package-support=minted document.tex
\end{verbatim}
+\section{ドライバーファイルの検査}
+
+\ClutTeX{}は、いくつかのパッケージについて正しいドライバーファイルが読み込まれていることを検査することができる。
+現在のバージョンで対応しているパッケージは\texpkg{graphics(x)}, \texpkg{color}, \texpkg{expl3}, \texpkg{hyperref}, \texpkg{xy}である。
+
+PDFモードの場合、ドライバーの検査は常に行われる。
+DVIモードで検査を有効にするには、\texttt{--check-driver}オプションを使用する。
+
\end{document}
diff --git a/Master/texmf-dist/doc/support/cluttex/doc/cluttex.pdf b/Master/texmf-dist/doc/support/cluttex/doc/cluttex.pdf
new file mode 100644
index 00000000000..d9e3f7df04c
--- /dev/null
+++ b/Master/texmf-dist/doc/support/cluttex/doc/cluttex.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/support/cluttex/doc/manual.tex b/Master/texmf-dist/doc/support/cluttex/doc/cluttex.tex
index caf99053eb0..4666668d082 100644
--- a/Master/texmf-dist/doc/support/cluttex/doc/manual.tex
+++ b/Master/texmf-dist/doc/support/cluttex/doc/cluttex.tex
@@ -8,9 +8,9 @@
\newcommand\texpkg[1]{\texttt{#1}}
\newcommand\metavar[1]{\textnormal{\textsf{#1}}}
-\title{\ClutTeX\ manual\\(Version 0.4)}
+\title{\ClutTeX\ manual\\(Version 0.5)}
\author{ARATA Mizuki}
-\date{2019-08-21}
+\date{2020-02-06}
\begin{document}
\maketitle
@@ -25,6 +25,7 @@ Basic features are,
\item Watch input files, and re-process documents if changes are detected\footnote{needs an external program if you are on a Unix system}.
\item Run MakeIndex, \BibTeX, Biber, if requested.
\item Produces a PDF, even if the engine (e.g.\ p\TeX) does not suport direct PDF generation.
+ If you want a DVI file, use \texttt{--output-format=dvi} option.
\end{itemize}
The unique feature of this program is that, auxiliary files such as \texttt{.aux} or \texttt{.toc} are created in an isolated location, so you will not be annoyed with these extra files.
@@ -94,7 +95,11 @@ Basic options:
Print the output directory and exit.
\item[\texttt{--package-support=PKG1[,PKG2,...,PKGn]}]
Enable special support for shell-escaping packages.
- Currently supported packages are `minted` and `epstopdf`.
+ Currently supported packages are `\texttt{minted}` and `\texttt{epstopdf}`.
+\item[\texttt{--check-driver=DRIVER}]
+ Check that the correct driver file is loaded for certain packages.
+ \metavar{DRIVER} is one of \texttt{dvipdfmx}, \texttt{dvips}, or \texttt{dvisvgm}.
+ Can only be used with \texttt{--output-format=dvi}.
\end{description}
Options for running auxiliary programs:
@@ -257,4 +262,12 @@ For example, if you want to typeset a document that uses \texpkg{minted}, run th
cluttex -e pdflatex --shell-escape --package-support=minted document.tex
\end{verbatim}
+\section{Check for driver file}
+
+\ClutTeX\ can check that the correct driver file is loaded when certain packages are loaded.
+Currently, the list of supported packages are \texpkg{graphics}, \texpkg{color}, \texpkg{expl3}, \texpkg{hyperref}, and \texpkg{xy}.
+
+The check is always done with PDF mode.
+To check the driver with DVI mode, use \texttt{--check-driver} option.
+
\end{document}
diff --git a/Master/texmf-dist/doc/support/cluttex/doc/manual-ja.pdf b/Master/texmf-dist/doc/support/cluttex/doc/manual-ja.pdf
deleted file mode 100644
index 72689f7f3e9..00000000000
--- a/Master/texmf-dist/doc/support/cluttex/doc/manual-ja.pdf
+++ /dev/null
Binary files differ
diff --git a/Master/texmf-dist/doc/support/cluttex/doc/manual.pdf b/Master/texmf-dist/doc/support/cluttex/doc/manual.pdf
deleted file mode 100644
index 089181455ec..00000000000
--- a/Master/texmf-dist/doc/support/cluttex/doc/manual.pdf
+++ /dev/null
Binary files differ
diff --git a/Master/texmf-dist/doc/support/cluttex/src/cluttex.lua b/Master/texmf-dist/doc/support/cluttex/src/cluttex.lua
index 0ac50f90f77..380deefebe4 100644
--- a/Master/texmf-dist/doc/support/cluttex/src/cluttex.lua
+++ b/Master/texmf-dist/doc/support/cluttex/src/cluttex.lua
@@ -1,6 +1,6 @@
#!/usr/bin/env texlua
--[[
- Copyright 2016,2018-2019 ARATA Mizuki
+ Copyright 2016-2020 ARATA Mizuki
This file is part of ClutTeX.
@@ -18,7 +18,7 @@
along with ClutTeX. If not, see <http://www.gnu.org/licenses/>.
]]
-CLUTTEX_VERSION = "v0.4"
+CLUTTEX_VERSION = "v0.5"
-- Standard libraries
local table = table
@@ -45,6 +45,7 @@ local message = require "texrunner.message"
local safename = require "texrunner.safename"
local extract_bibtex_from_aux_file = require "texrunner.auxfile".extract_bibtex_from_aux_file
local handle_cluttex_options = require "texrunner.handleoption".handle_cluttex_options
+local checkdriver = require "texrunner.checkdriver".checkdriver
os.setlocale("", "ctype") -- Workaround for recent Universal CRT
@@ -74,9 +75,6 @@ end
local jobname = options.jobname
assert(jobname ~= "", "jobname cannot be empty")
-if options.output_format == nil then
- options.output_format = "pdf"
-end
local output_extension
if options.output_format == "dvi" then
output_extension = engine.dvi_extension or "dvi"
@@ -300,6 +298,10 @@ local function single_run(auxstatus, iteration)
logfile:close()
end
+ if options.check_driver ~= nil then
+ checkdriver(options.check_driver, filelist)
+ end
+
if options.makeindex then
-- Look for .idx files and run MakeIndex
for _,file in ipairs(filelist) do
diff --git a/Master/texmf-dist/doc/support/cluttex/src/texrunner/auxfile.lua b/Master/texmf-dist/doc/support/cluttex/src/texrunner/auxfile.lua
index 0c69eefd136..d983e2a47ea 100644
--- a/Master/texmf-dist/doc/support/cluttex/src/texrunner/auxfile.lua
+++ b/Master/texmf-dist/doc/support/cluttex/src/texrunner/auxfile.lua
@@ -31,8 +31,9 @@ local function parse_aux_file(auxfile, outdir, report, seen)
for l in io.lines(auxfile) do
local subauxfile = string_match(l, "\\@input{(.+)}")
if subauxfile then
- if fsutil.isfile(subauxfile) then
- parse_aux_file(pathutil.join(outdir, subauxfile), outdir, report, seen)
+ local subauxfile_abs = pathutil.abspath(subauxfile, outdir)
+ if fsutil.isfile(subauxfile_abs) then
+ parse_aux_file(subauxfile_abs, outdir, report, seen)
else
local dir = pathutil.join(outdir, pathutil.dirname(subauxfile))
if not fsutil.isdir(dir) then
@@ -57,8 +58,11 @@ local function extract_bibtex_from_aux_file(auxfile, outdir, biblines)
end
elseif name == "@input" then
local subauxfile = string_match(l, "\\@input{(.+)}")
- if subauxfile and fsutil.isfile(subauxfile) then
- extract_bibtex_from_aux_file(pathutil.join(outdir, subauxfile), outdir, biblines)
+ if subauxfile then
+ local subauxfile_abs = pathutil.abspath(subauxfile, outdir)
+ if fsutil.isfile(subauxfile_abs) then
+ extract_bibtex_from_aux_file(subauxfile_abs, outdir, biblines)
+ end
end
end
end
diff --git a/Master/texmf-dist/doc/support/cluttex/src/texrunner/checkdriver.lua b/Master/texmf-dist/doc/support/cluttex/src/texrunner/checkdriver.lua
new file mode 100644
index 00000000000..65e33b9d214
--- /dev/null
+++ b/Master/texmf-dist/doc/support/cluttex/src/texrunner/checkdriver.lua
@@ -0,0 +1,184 @@
+--[[
+ Copyright 2020 ARATA Mizuki
+
+ This file is part of ClutTeX.
+
+ ClutTeX is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ ClutTeX is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with ClutTeX. If not, see <http://www.gnu.org/licenses/>.
+]]
+local assert = assert
+local ipairs = ipairs
+local error = error
+local string = string
+local pathutil = require "texrunner.pathutil"
+local message = require "texrunner.message"
+
+local right_values = {
+ dvips = {
+ graphics = "dvips",
+ expl3 = "dvips",
+ hyperref = "dvips",
+ xypic = "dvips",
+ },
+ dvipdfmx = {
+ graphics = "dvipdfmx",
+ expl3 = "dvipdfmx",
+ hyperref = "dvipdfmx",
+ xypic = "pdf",
+ },
+ dvisvgm = {
+ graphics = "dvisvgm",
+ expl3 = "dvisvgm",
+ },
+ xetex = {
+ graphics = "xetex",
+ expl3 = "xdvipdfmx",
+ hyperref = "xetex",
+ xypic = "pdf",
+ },
+ pdftex = {
+ graphics = "pdftex",
+ expl3 = "pdfmode",
+ hyperref = "pdftex",
+ xypic = "pdf",
+ },
+ luatex = {
+ graphics = "luatex",
+ expl3 = "pdfmode",
+ hyperref = "luatex",
+ xypic = "pdf",
+ },
+}
+
+-- expected_driver: one of "dvips", "dvipdfmx", "dvisvgm", "pdftex", "xetex", "luatex"
+local function checkdriver(expected_driver, filelist)
+ if CLUTTEX_VERBOSITY >= 1 then
+ message.info("checkdriver: expects ", expected_driver)
+ end
+
+ local loaded = {}
+ for i,t in ipairs(filelist) do
+ if t.kind == "input" then
+ local basename = pathutil.basename(t.path)
+ loaded[basename] = true
+ end
+ end
+
+ local graphics_driver = nil -- "dvipdfmx" | "dvips" | "dvisvgm" | "pdftex" | "luatex" | "xetex" | "unknown"
+ if loaded["graphics.sty"] or loaded["color.sty"] then
+ if loaded["dvipdfmx.def"] then
+ graphics_driver = "dvipdfmx"
+ elseif loaded["dvips.def"] then
+ graphics_driver = "dvips"
+ elseif loaded["dvisvgm.def"] then
+ graphics_driver = "dvisvgm"
+ elseif loaded["pdftex.def"] then
+ graphics_driver = "pdftex"
+ elseif loaded["luatex.def"] then
+ graphics_driver = "luatex"
+ elseif loaded["xetex.def"] then
+ graphics_driver = "xetex"
+ else
+ -- Not supported: dvipdf, dvipsone, emtex, textures, pctexps, pctexwin, pctexhp, pctex32, truetex, tcidvi, vtex
+ graphics_driver = "unknown"
+ end
+ end
+ local expl3_driver = nil -- "pdfmode" | "dvisvgm" | "xdvipdfmx" | "dvipdfmx" | "dvips" | "unknown"
+ if loaded["expl3-code.tex"] or loaded["expl3.sty"] or loaded["l3backend-dvips.def"] or loaded["l3backend-dvipdfmx.def"] or loaded["l3backend-xdvipdfmx.def"] or loaded["l3backend-pdfmode.def"] then
+ if loaded["l3backend-pdfmode.def"] then
+ expl3_driver = "pdfmode" -- pdftex, luatex
+ elseif loaded["l3backend-dvisvgm.def"] then
+ expl3_driver = "dvisvgm"
+ elseif loaded["l3backend-xdvipdfmx.def"] then
+ expl3_driver = "xdvipdfmx"
+ elseif loaded["l3backend-dvipdfmx.def"] then
+ expl3_driver = "dvipdfmx"
+ elseif loaded["l3backend-dvips.def"] then
+ expl3_driver = "dvips"
+ else
+ -- TODO: driver=latex2e?
+ expl3_driver = "unknown"
+ end
+ end
+ local hyperref_driver = nil -- "luatex" | "pdftex" | "xetex" | "dvipdfmx" | "dvips" | "unknown"
+ if loaded["hyperref.sty"] then
+ if loaded["hluatex.def"] then
+ hyperref_driver = "luatex"
+ elseif loaded["hpdftex.def"] then
+ hyperref_driver = "pdftex"
+ elseif loaded["hxetex.def"] then
+ hyperref_driver = "xetex"
+ elseif loaded["hdvipdfm.def"] then
+ hyperref_driver = "dvipdfmx"
+ elseif loaded["hdvips.def"] then
+ hyperref_driver = "dvips"
+ else
+ -- Not supported: dvipson, dviwind, tex4ht, texture, vtex, vtexhtm, xtexmrk, hypertex
+ hyperref_driver = "unknown"
+ end
+ -- TODO: dvisvgm?
+ end
+ local xypic_driver = nil -- "pdf" | "dvips" | "unknown"
+ if loaded["xy.tex"] then
+ if loaded["xypdf.tex"] then
+ xypic_driver = "pdf" -- pdftex, luatex, xetex, dvipdfmx
+ elseif loaded["xydvips.tex"] then
+ xypic_driver = "dvips"
+ else
+ -- Not supported: dvidrv, dvitops, oztex, 17oztex, textures, 16textures, xdvi
+ xypic_driver = "unknown"
+ end
+ -- TODO: dvisvgm?
+ end
+
+ if CLUTTEX_VERBOSITY >= 1 then
+ message.info("checkdriver: graphics=", tostring(graphics_driver))
+ message.info("checkdriver: expl3=", tostring(expl3_driver))
+ message.info("checkdriver: hyperref=", tostring(hyperref_driver))
+ message.info("checkdriver: xypic=", tostring(xypic_driver))
+ end
+
+ local expected = assert(right_values[expected_driver], "invalid value for expected_driver")
+ if graphics_driver ~= nil and expected.graphics ~= nil and graphics_driver ~= expected.graphics then
+ message.diag("The driver option for graphics(x)/color is missing or wrong.")
+ message.diag("Consider setting '", expected.graphics, "' option.")
+ end
+ if expl3_driver ~= nil and expected.expl3 ~= nil and expl3_driver ~= expected.expl3 then
+ message.diag("The driver option for expl3 is missing or wrong.")
+ message.diag("Consider setting 'driver=", expected.expl3, "' option when loading expl3.")
+ end
+ if hyperref_driver ~= nil and expected.hyperref ~= nil and hyperref_driver ~= expected.hyperref then
+ message.diag("The driver option for hyperref is missing or wrong.")
+ message.diag("Consider setting '", expected.hyperref, "' option.")
+ end
+ if xypic_driver ~= nil and expected.xypic ~= nil and xypic_driver ~= expected.xypic then
+ message.diag("The driver option for Xy-pic is missing or wrong.")
+ if expected_driver == "dvipdfmx" then
+ message.diag("Consider setting 'dvipdfmx' option or running \\xyoption{pdf}.")
+ elseif expected_driver == "pdftex" then
+ message.diag("Consider setting 'pdftex' option or running \\xyoption{pdf}.")
+ elseif expected.xypic == "pdf" then
+ message.diag("Consider setting 'pdf' package option or running \\xyoption{pdf}.")
+ elseif expected.xypic == "dvips" then
+ message.diag("Consider setting 'dvips' option.")
+ end
+ end
+end
+
+--[[
+filelist[i] = {path = ""}
+]]
+
+return {
+ checkdriver = checkdriver,
+}
diff --git a/Master/texmf-dist/doc/support/cluttex/src/texrunner/handleoption.lua b/Master/texmf-dist/doc/support/cluttex/src/texrunner/handleoption.lua
index d23ee1aefd9..a542070038b 100644
--- a/Master/texmf-dist/doc/support/cluttex/src/texrunner/handleoption.lua
+++ b/Master/texmf-dist/doc/support/cluttex/src/texrunner/handleoption.lua
@@ -1,5 +1,5 @@
local COPYRIGHT_NOTICE = [[
-Copyright (C) 2016,2018-2019 ARATA Mizuki
+Copyright (C) 2016-2020 ARATA Mizuki
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -72,6 +72,8 @@ Options:
Enable special support for some shell-escaping
packages.
Currently supported: minted, epstopdf
+ --check-driver=DRIVER Check that the correct driver file is loaded.
+ DRIVER is one of `dvipdfmx', `dvips', `dvisvgm'.
--[no-]shell-escape
--shell-restricted
@@ -154,6 +156,10 @@ local option_spec = {
long = "package-support",
param = true
},
+ {
+ long = "check-driver",
+ param = true
+ },
-- Options for TeX
{
long = "synctex",
@@ -257,6 +263,10 @@ local function set_default_values(options)
if options.halt_on_error == nil then
options.halt_on_error = true
end
+
+ if options.output_format == nil then
+ options.output_format = "pdf"
+ end
end
-- inputfile, engine, options = handle_cluttex_options(arg)
@@ -345,6 +355,11 @@ local function handle_cluttex_options(arg)
end
end
+ elseif name == "check-driver" then
+ assert(options.check_driver == nil, "multiple --check-driver options")
+ assert(param == "dvipdfmx" or param == "dvips" or param == "dvisvgm", "wrong value for --check-driver option")
+ options.check_driver = param
+
-- Options for TeX
elseif name == "synctex" then
assert(options.synctex == nil, "multiple --synctex options")
@@ -455,6 +470,27 @@ local function handle_cluttex_options(arg)
set_default_values(options)
+ if options.output_format == "pdf" then
+ if options.check_driver ~= nil then
+ error("--check-driver can only be used when the output format is DVI.")
+ end
+ if engine.supports_pdf_generation then
+ if engine.is_luatex then
+ options.check_driver = "luatex"
+ elseif engine.name == "xetex" or engine.name == "xelatex" then
+ options.check_driver = "xetex"
+ elseif engine.name == "pdftex" or engine.name == "pdflatex" then
+ options.check_driver = "pdftex"
+ else
+ message.warning("Unknown engine: "..engine.name)
+ message.warning("Driver check will not work.")
+ end
+ else
+ -- ClutTeX uses dvipdfmx to generate PDF from DVI output.
+ options.check_driver = "dvipdfmx"
+ end
+ end
+
return inputfile, engine, options
end
diff --git a/Master/texmf-dist/doc/support/cluttex/src/texrunner/luatexinit.lua b/Master/texmf-dist/doc/support/cluttex/src/texrunner/luatexinit.lua
index 2e2ad971efb..01356737876 100644
--- a/Master/texmf-dist/doc/support/cluttex/src/texrunner/luatexinit.lua
+++ b/Master/texmf-dist/doc/support/cluttex/src/texrunner/luatexinit.lua
@@ -17,17 +17,19 @@ local texio_write_nl = texio.write_nl
-- Packages coded in Lua doesn't follow -output-directory option and doesn't write command to the log file
initscript:write(string.format("local output_directory = %q\n", options.output_directory))
+ -- tex.jobname may not be available when io.open is called for the first time
+ initscript:write(string.format("local jobname = %q\n", options.jobname))
initscript:write([==[
local luawritelog
local function openluawritelog()
if not luawritelog then
- luawritelog = assert(io_open(output_directory .. "/" .. tex.jobname .. ".cluttex-fls", "w"))
+ luawritelog = assert(io_open(output_directory .. "/" .. jobname .. ".cluttex-fls", "w"))
end
return luawritelog
end
io.open = function(fname, mode)
-- luatexja-ruby
- if mode == "w" and fname == tex.jobname .. ".ltjruby" then
+ if mode == "w" and fname == jobname .. ".ltjruby" then
fname = output_directory .. "/" .. fname
end
if type(mode) == "string" and string.find(mode, "w") ~= nil then
diff --git a/Master/texmf-dist/doc/support/cluttex/src/texrunner/message.lua b/Master/texmf-dist/doc/support/cluttex/src/texrunner/message.lua
index c7acd43f66f..46a9cf77bd1 100644
--- a/Master/texmf-dist/doc/support/cluttex/src/texrunner/message.lua
+++ b/Master/texmf-dist/doc/support/cluttex/src/texrunner/message.lua
@@ -89,7 +89,7 @@ local CMD = {
local function exec_msg(commandline)
if use_colors then
- io.stderr:write(CMD.fg_x_white, CMD.bg_red, "[EXEC]", CMD.reset, " ", CMD.fg_red, commandline, CMD.reset, "\n")
+ io.stderr:write(CMD.fg_x_white, CMD.bg_red, "[EXEC]", CMD.reset, " ", CMD.fg_cyan, commandline, CMD.reset, "\n")
else
io.stderr:write("[EXEC] ", commandline, "\n")
end
diff --git a/Master/texmf-dist/scripts/cluttex/cluttex.lua b/Master/texmf-dist/scripts/cluttex/cluttex.lua
index a3021e48a02..d3859a69fa5 100755
--- a/Master/texmf-dist/scripts/cluttex/cluttex.lua
+++ b/Master/texmf-dist/scripts/cluttex/cluttex.lua
@@ -1133,8 +1133,9 @@ local function parse_aux_file(auxfile, outdir, report, seen)
for l in io.lines(auxfile) do
local subauxfile = string_match(l, "\\@input{(.+)}")
if subauxfile then
- if fsutil.isfile(subauxfile) then
- parse_aux_file(pathutil.join(outdir, subauxfile), outdir, report, seen)
+ local subauxfile_abs = pathutil.abspath(subauxfile, outdir)
+ if fsutil.isfile(subauxfile_abs) then
+ parse_aux_file(subauxfile_abs, outdir, report, seen)
else
local dir = pathutil.join(outdir, pathutil.dirname(subauxfile))
if not fsutil.isdir(dir) then
@@ -1159,8 +1160,11 @@ local function extract_bibtex_from_aux_file(auxfile, outdir, biblines)
end
elseif name == "@input" then
local subauxfile = string_match(l, "\\@input{(.+)}")
- if subauxfile and fsutil.isfile(subauxfile) then
- extract_bibtex_from_aux_file(pathutil.join(outdir, subauxfile), outdir, biblines)
+ if subauxfile then
+ local subauxfile_abs = pathutil.abspath(subauxfile, outdir)
+ if fsutil.isfile(subauxfile_abs) then
+ extract_bibtex_from_aux_file(subauxfile_abs, outdir, biblines)
+ end
end
end
end
@@ -1192,17 +1196,19 @@ local texio_write_nl = texio.write_nl
-- Packages coded in Lua doesn't follow -output-directory option and doesn't write command to the log file
initscript:write(string.format("local output_directory = %q\n", options.output_directory))
+ -- tex.jobname may not be available when io.open is called for the first time
+ initscript:write(string.format("local jobname = %q\n", options.jobname))
initscript:write([==[
local luawritelog
local function openluawritelog()
if not luawritelog then
- luawritelog = assert(io_open(output_directory .. "/" .. tex.jobname .. ".cluttex-fls", "w"))
+ luawritelog = assert(io_open(output_directory .. "/" .. jobname .. ".cluttex-fls", "w"))
end
return luawritelog
end
io.open = function(fname, mode)
-- luatexja-ruby
- if mode == "w" and fname == tex.jobname .. ".ltjruby" then
+ if mode == "w" and fname == jobname .. ".ltjruby" then
fname = output_directory .. "/" .. fname
end
if type(mode) == "string" and string.find(mode, "w") ~= nil then
@@ -1363,7 +1369,7 @@ return {
end
package.preload["texrunner.handleoption"] = function(...)
local COPYRIGHT_NOTICE = [[
-Copyright (C) 2016,2018-2019 ARATA Mizuki
+Copyright (C) 2016-2020 ARATA Mizuki
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -1436,6 +1442,8 @@ Options:
Enable special support for some shell-escaping
packages.
Currently supported: minted, epstopdf
+ --check-driver=DRIVER Check that the correct driver file is loaded.
+ DRIVER is one of `dvipdfmx', `dvips', `dvisvgm'.
--[no-]shell-escape
--shell-restricted
@@ -1518,6 +1526,10 @@ local option_spec = {
long = "package-support",
param = true
},
+ {
+ long = "check-driver",
+ param = true
+ },
-- Options for TeX
{
long = "synctex",
@@ -1621,6 +1633,10 @@ local function set_default_values(options)
if options.halt_on_error == nil then
options.halt_on_error = true
end
+
+ if options.output_format == nil then
+ options.output_format = "pdf"
+ end
end
-- inputfile, engine, options = handle_cluttex_options(arg)
@@ -1709,6 +1725,11 @@ local function handle_cluttex_options(arg)
end
end
+ elseif name == "check-driver" then
+ assert(options.check_driver == nil, "multiple --check-driver options")
+ assert(param == "dvipdfmx" or param == "dvips" or param == "dvisvgm", "wrong value for --check-driver option")
+ options.check_driver = param
+
-- Options for TeX
elseif name == "synctex" then
assert(options.synctex == nil, "multiple --synctex options")
@@ -1819,6 +1840,27 @@ local function handle_cluttex_options(arg)
set_default_values(options)
+ if options.output_format == "pdf" then
+ if options.check_driver ~= nil then
+ error("--check-driver can only be used when the output format is DVI.")
+ end
+ if engine.supports_pdf_generation then
+ if engine.is_luatex then
+ options.check_driver = "luatex"
+ elseif engine.name == "xetex" or engine.name == "xelatex" then
+ options.check_driver = "xetex"
+ elseif engine.name == "pdftex" or engine.name == "pdflatex" then
+ options.check_driver = "pdftex"
+ else
+ message.warning("Unknown engine: "..engine.name)
+ message.warning("Driver check will not work.")
+ end
+ else
+ -- ClutTeX uses dvipdfmx to generate PDF from DVI output.
+ options.check_driver = "dvipdfmx"
+ end
+ end
+
return inputfile, engine, options
end
@@ -2127,7 +2169,7 @@ local CMD = {
local function exec_msg(commandline)
if use_colors then
- io.stderr:write(CMD.fg_x_white, CMD.bg_red, "[EXEC]", CMD.reset, " ", CMD.fg_red, commandline, CMD.reset, "\n")
+ io.stderr:write(CMD.fg_x_white, CMD.bg_red, "[EXEC]", CMD.reset, " ", CMD.fg_cyan, commandline, CMD.reset, "\n")
else
io.stderr:write("[EXEC] ", commandline, "\n")
end
@@ -2659,8 +2701,194 @@ return {
safeinput = safeinput,
}
end
+package.preload["texrunner.checkdriver"] = function(...)
+--[[
+ Copyright 2020 ARATA Mizuki
+
+ This file is part of ClutTeX.
+
+ ClutTeX is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ ClutTeX is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with ClutTeX. If not, see <http://www.gnu.org/licenses/>.
+]]
+local assert = assert
+local ipairs = ipairs
+local error = error
+local string = string
+local pathutil = require "texrunner.pathutil"
+local message = require "texrunner.message"
+
+local right_values = {
+ dvips = {
+ graphics = "dvips",
+ expl3 = "dvips",
+ hyperref = "dvips",
+ xypic = "dvips",
+ },
+ dvipdfmx = {
+ graphics = "dvipdfmx",
+ expl3 = "dvipdfmx",
+ hyperref = "dvipdfmx",
+ xypic = "pdf",
+ },
+ dvisvgm = {
+ graphics = "dvisvgm",
+ expl3 = "dvisvgm",
+ },
+ xetex = {
+ graphics = "xetex",
+ expl3 = "xdvipdfmx",
+ hyperref = "xetex",
+ xypic = "pdf",
+ },
+ pdftex = {
+ graphics = "pdftex",
+ expl3 = "pdfmode",
+ hyperref = "pdftex",
+ xypic = "pdf",
+ },
+ luatex = {
+ graphics = "luatex",
+ expl3 = "pdfmode",
+ hyperref = "luatex",
+ xypic = "pdf",
+ },
+}
+
+-- expected_driver: one of "dvips", "dvipdfmx", "dvisvgm", "pdftex", "xetex", "luatex"
+local function checkdriver(expected_driver, filelist)
+ if CLUTTEX_VERBOSITY >= 1 then
+ message.info("checkdriver: expects ", expected_driver)
+ end
+
+ local loaded = {}
+ for i,t in ipairs(filelist) do
+ if t.kind == "input" then
+ local basename = pathutil.basename(t.path)
+ loaded[basename] = true
+ end
+ end
+
+ local graphics_driver = nil -- "dvipdfmx" | "dvips" | "dvisvgm" | "pdftex" | "luatex" | "xetex" | "unknown"
+ if loaded["graphics.sty"] or loaded["color.sty"] then
+ if loaded["dvipdfmx.def"] then
+ graphics_driver = "dvipdfmx"
+ elseif loaded["dvips.def"] then
+ graphics_driver = "dvips"
+ elseif loaded["dvisvgm.def"] then
+ graphics_driver = "dvisvgm"
+ elseif loaded["pdftex.def"] then
+ graphics_driver = "pdftex"
+ elseif loaded["luatex.def"] then
+ graphics_driver = "luatex"
+ elseif loaded["xetex.def"] then
+ graphics_driver = "xetex"
+ else
+ -- Not supported: dvipdf, dvipsone, emtex, textures, pctexps, pctexwin, pctexhp, pctex32, truetex, tcidvi, vtex
+ graphics_driver = "unknown"
+ end
+ end
+ local expl3_driver = nil -- "pdfmode" | "dvisvgm" | "xdvipdfmx" | "dvipdfmx" | "dvips" | "unknown"
+ if loaded["expl3-code.tex"] or loaded["expl3.sty"] or loaded["l3backend-dvips.def"] or loaded["l3backend-dvipdfmx.def"] or loaded["l3backend-xdvipdfmx.def"] or loaded["l3backend-pdfmode.def"] then
+ if loaded["l3backend-pdfmode.def"] then
+ expl3_driver = "pdfmode" -- pdftex, luatex
+ elseif loaded["l3backend-dvisvgm.def"] then
+ expl3_driver = "dvisvgm"
+ elseif loaded["l3backend-xdvipdfmx.def"] then
+ expl3_driver = "xdvipdfmx"
+ elseif loaded["l3backend-dvipdfmx.def"] then
+ expl3_driver = "dvipdfmx"
+ elseif loaded["l3backend-dvips.def"] then
+ expl3_driver = "dvips"
+ else
+ -- TODO: driver=latex2e?
+ expl3_driver = "unknown"
+ end
+ end
+ local hyperref_driver = nil -- "luatex" | "pdftex" | "xetex" | "dvipdfmx" | "dvips" | "unknown"
+ if loaded["hyperref.sty"] then
+ if loaded["hluatex.def"] then
+ hyperref_driver = "luatex"
+ elseif loaded["hpdftex.def"] then
+ hyperref_driver = "pdftex"
+ elseif loaded["hxetex.def"] then
+ hyperref_driver = "xetex"
+ elseif loaded["hdvipdfm.def"] then
+ hyperref_driver = "dvipdfmx"
+ elseif loaded["hdvips.def"] then
+ hyperref_driver = "dvips"
+ else
+ -- Not supported: dvipson, dviwind, tex4ht, texture, vtex, vtexhtm, xtexmrk, hypertex
+ hyperref_driver = "unknown"
+ end
+ -- TODO: dvisvgm?
+ end
+ local xypic_driver = nil -- "pdf" | "dvips" | "unknown"
+ if loaded["xy.tex"] then
+ if loaded["xypdf.tex"] then
+ xypic_driver = "pdf" -- pdftex, luatex, xetex, dvipdfmx
+ elseif loaded["xydvips.tex"] then
+ xypic_driver = "dvips"
+ else
+ -- Not supported: dvidrv, dvitops, oztex, 17oztex, textures, 16textures, xdvi
+ xypic_driver = "unknown"
+ end
+ -- TODO: dvisvgm?
+ end
+
+ if CLUTTEX_VERBOSITY >= 1 then
+ message.info("checkdriver: graphics=", tostring(graphics_driver))
+ message.info("checkdriver: expl3=", tostring(expl3_driver))
+ message.info("checkdriver: hyperref=", tostring(hyperref_driver))
+ message.info("checkdriver: xypic=", tostring(xypic_driver))
+ end
+
+ local expected = assert(right_values[expected_driver], "invalid value for expected_driver")
+ if graphics_driver ~= nil and expected.graphics ~= nil and graphics_driver ~= expected.graphics then
+ message.diag("The driver option for graphics(x)/color is missing or wrong.")
+ message.diag("Consider setting '", expected.graphics, "' option.")
+ end
+ if expl3_driver ~= nil and expected.expl3 ~= nil and expl3_driver ~= expected.expl3 then
+ message.diag("The driver option for expl3 is missing or wrong.")
+ message.diag("Consider setting 'driver=", expected.expl3, "' option when loading expl3.")
+ end
+ if hyperref_driver ~= nil and expected.hyperref ~= nil and hyperref_driver ~= expected.hyperref then
+ message.diag("The driver option for hyperref is missing or wrong.")
+ message.diag("Consider setting '", expected.hyperref, "' option.")
+ end
+ if xypic_driver ~= nil and expected.xypic ~= nil and xypic_driver ~= expected.xypic then
+ message.diag("The driver option for Xy-pic is missing or wrong.")
+ if expected_driver == "dvipdfmx" then
+ message.diag("Consider setting 'dvipdfmx' option or running \\xyoption{pdf}.")
+ elseif expected_driver == "pdftex" then
+ message.diag("Consider setting 'pdftex' option or running \\xyoption{pdf}.")
+ elseif expected.xypic == "pdf" then
+ message.diag("Consider setting 'pdf' package option or running \\xyoption{pdf}.")
+ elseif expected.xypic == "dvips" then
+ message.diag("Consider setting 'dvips' option.")
+ end
+ end
+end
+
+--[[
+filelist[i] = {path = ""}
+]]
+
+return {
+ checkdriver = checkdriver,
+}
+end
--[[
- Copyright 2016,2018-2019 ARATA Mizuki
+ Copyright 2016-2020 ARATA Mizuki
This file is part of ClutTeX.
@@ -2678,7 +2906,7 @@ end
along with ClutTeX. If not, see <http://www.gnu.org/licenses/>.
]]
-CLUTTEX_VERSION = "v0.4"
+CLUTTEX_VERSION = "v0.5"
-- Standard libraries
local coroutine = coroutine
@@ -2700,6 +2928,7 @@ local message = require "texrunner.message"
local safename = require "texrunner.safename"
local extract_bibtex_from_aux_file = require "texrunner.auxfile".extract_bibtex_from_aux_file
local handle_cluttex_options = require "texrunner.handleoption".handle_cluttex_options
+local checkdriver = require "texrunner.checkdriver".checkdriver
os.setlocale("", "ctype") -- Workaround for recent Universal CRT
@@ -2729,9 +2958,6 @@ end
local jobname = options.jobname
assert(jobname ~= "", "jobname cannot be empty")
-if options.output_format == nil then
- options.output_format = "pdf"
-end
local output_extension
if options.output_format == "dvi" then
output_extension = engine.dvi_extension or "dvi"
@@ -2955,6 +3181,10 @@ local function single_run(auxstatus, iteration)
logfile:close()
end
+ if options.check_driver ~= nil then
+ checkdriver(options.check_driver, filelist)
+ end
+
if options.makeindex then
-- Look for .idx files and run MakeIndex
for _,file in ipairs(filelist) do