texlive[53698] trunk: cluttex (6feb20)
commits+karl at tug.org
commits+karl at tug.org
Thu Feb 6 21:51:06 CET 2020
Revision: 53698
http://tug.org/svn/texlive?view=revision&revision=53698
Author: karl
Date: 2020-02-06 21:51:06 +0100 (Thu, 06 Feb 2020)
Log Message:
-----------
cluttex (6feb20)
Modified Paths:
--------------
trunk/Build/source/texk/texlive/linked_scripts/cluttex/cluttex.lua
trunk/Build/source/texk/texlive/linked_scripts/context/perl/mptopdf.pl
trunk/Master/texmf-dist/doc/support/cluttex/CHANGELOG.md
trunk/Master/texmf-dist/doc/support/cluttex/Makefile
trunk/Master/texmf-dist/doc/support/cluttex/README.md
trunk/Master/texmf-dist/doc/support/cluttex/bin/cluttex.bat
trunk/Master/texmf-dist/doc/support/cluttex/build.lua
trunk/Master/texmf-dist/doc/support/cluttex/doc/Makefile
trunk/Master/texmf-dist/doc/support/cluttex/src/cluttex.lua
trunk/Master/texmf-dist/doc/support/cluttex/src/texrunner/auxfile.lua
trunk/Master/texmf-dist/doc/support/cluttex/src/texrunner/handleoption.lua
trunk/Master/texmf-dist/doc/support/cluttex/src/texrunner/luatexinit.lua
trunk/Master/texmf-dist/doc/support/cluttex/src/texrunner/message.lua
trunk/Master/texmf-dist/scripts/cluttex/cluttex.lua
Added Paths:
-----------
trunk/Master/texmf-dist/doc/support/cluttex/doc/cluttex-ja.pdf
trunk/Master/texmf-dist/doc/support/cluttex/doc/cluttex-ja.tex
trunk/Master/texmf-dist/doc/support/cluttex/doc/cluttex.pdf
trunk/Master/texmf-dist/doc/support/cluttex/doc/cluttex.tex
trunk/Master/texmf-dist/doc/support/cluttex/src/texrunner/checkdriver.lua
Removed Paths:
-------------
trunk/Master/texmf-dist/doc/support/cluttex/doc/manual-ja.pdf
trunk/Master/texmf-dist/doc/support/cluttex/doc/manual-ja.tex
trunk/Master/texmf-dist/doc/support/cluttex/doc/manual.pdf
trunk/Master/texmf-dist/doc/support/cluttex/doc/manual.tex
Modified: trunk/Build/source/texk/texlive/linked_scripts/cluttex/cluttex.lua
===================================================================
--- trunk/Build/source/texk/texlive/linked_scripts/cluttex/cluttex.lua 2020-02-06 20:50:18 UTC (rev 53697)
+++ trunk/Build/source/texk/texlive/linked_scripts/cluttex/cluttex.lua 2020-02-06 20:51:06 UTC (rev 53698)
@@ -1133,8 +1133,9 @@
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 @@
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 @@
-- 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 @@
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 @@
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 @@
long = "package-support",
param = true
},
+ {
+ long = "check-driver",
+ param = true
+ },
-- Options for TeX
{
long = "synctex",
@@ -1621,6 +1633,10 @@
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 @@
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 @@
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 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,9 @@
safeinput = safeinput,
}
end
+package.preload["texrunner.checkdriver"] = function(...)
--[[
- Copyright 2016,2018-2019 ARATA Mizuki
+ Copyright 2020 ARATA Mizuki
This file is part of ClutTeX.
@@ -2677,9 +2720,194 @@
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"
-CLUTTEX_VERSION = "v0.4"
+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-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/>.
+]]
+
+CLUTTEX_VERSION = "v0.5"
+
-- Standard libraries
local coroutine = coroutine
local tostring = tostring
@@ -2700,6 +2928,7 @@
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 @@
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 @@
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
Modified: trunk/Build/source/texk/texlive/linked_scripts/context/perl/mptopdf.pl
===================================================================
--- trunk/Build/source/texk/texlive/linked_scripts/context/perl/mptopdf.pl 2020-02-06 20:50:18 UTC (rev 53697)
+++ trunk/Build/source/texk/texlive/linked_scripts/context/perl/mptopdf.pl 2020-02-06 20:51:06 UTC (rev 53698)
@@ -3,6 +3,12 @@
# 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
Modified: trunk/Master/texmf-dist/doc/support/cluttex/CHANGELOG.md
===================================================================
--- trunk/Master/texmf-dist/doc/support/cluttex/CHANGELOG.md 2020-02-06 20:50:18 UTC (rev 53697)
+++ trunk/Master/texmf-dist/doc/support/cluttex/CHANGELOG.md 2020-02-06 20:51:06 UTC (rev 53698)
@@ -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)
-----
Modified: trunk/Master/texmf-dist/doc/support/cluttex/Makefile
===================================================================
--- trunk/Master/texmf-dist/doc/support/cluttex/Makefile 2020-02-06 20:50:18 UTC (rev 53697)
+++ trunk/Master/texmf-dist/doc/support/cluttex/Makefile 2020-02-06 20:51:06 UTC (rev 53698)
@@ -21,6 +21,7 @@
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
Modified: trunk/Master/texmf-dist/doc/support/cluttex/README.md
===================================================================
--- trunk/Master/texmf-dist/doc/support/cluttex/README.md 2020-02-06 20:50:18 UTC (rev 53697)
+++ trunk/Master/texmf-dist/doc/support/cluttex/README.md 2020-02-06 20:51:06 UTC (rev 53698)
@@ -90,6 +90,10 @@
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:
Modified: trunk/Master/texmf-dist/doc/support/cluttex/bin/cluttex.bat
===================================================================
--- trunk/Master/texmf-dist/doc/support/cluttex/bin/cluttex.bat 2020-02-06 20:50:18 UTC (rev 53697)
+++ trunk/Master/texmf-dist/doc/support/cluttex/bin/cluttex.bat 2020-02-06 20:51:06 UTC (rev 53698)
@@ -1136,8 +1136,9 @@
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 @@
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 @@
-- 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 @@
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 @@
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 @@
long = "package-support",
param = true
},
+ {
+ long = "check-driver",
+ param = true
+ },
-- Options for TeX
{
long = "synctex",
@@ -1624,6 +1636,10 @@
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 @@
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 @@
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 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,9 @@
safeinput = safeinput,
}
end
+package.preload["texrunner.checkdriver"] = function(...)
--[[
- Copyright 2016,2018-2019 ARATA Mizuki
+ Copyright 2020 ARATA Mizuki
This file is part of ClutTeX.
@@ -2680,9 +2723,194 @@
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"
-CLUTTEX_VERSION = "v0.4"
+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-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/>.
+]]
+
+CLUTTEX_VERSION = "v0.5"
+
-- Standard libraries
local coroutine = coroutine
local tostring = tostring
@@ -2703,6 +2931,7 @@
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 @@
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 @@
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
Modified: trunk/Master/texmf-dist/doc/support/cluttex/build.lua
===================================================================
--- trunk/Master/texmf-dist/doc/support/cluttex/build.lua 2020-02-06 20:50:18 UTC (rev 53697)
+++ trunk/Master/texmf-dist/doc/support/cluttex/build.lua 2020-02-06 20:51:06 UTC (rev 53698)
@@ -91,6 +91,10 @@
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"}
Modified: trunk/Master/texmf-dist/doc/support/cluttex/doc/Makefile
===================================================================
--- trunk/Master/texmf-dist/doc/support/cluttex/doc/Makefile 2020-02-06 20:50:18 UTC (rev 53697)
+++ trunk/Master/texmf-dist/doc/support/cluttex/doc/Makefile 2020-02-06 20:51:06 UTC (rev 53698)
@@ -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
Added: trunk/Master/texmf-dist/doc/support/cluttex/doc/cluttex-ja.pdf
===================================================================
(Binary files differ)
Index: trunk/Master/texmf-dist/doc/support/cluttex/doc/cluttex-ja.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/support/cluttex/doc/cluttex-ja.pdf 2020-02-06 20:50:18 UTC (rev 53697)
+++ trunk/Master/texmf-dist/doc/support/cluttex/doc/cluttex-ja.pdf 2020-02-06 20:51:06 UTC (rev 53698)
Property changes on: trunk/Master/texmf-dist/doc/support/cluttex/doc/cluttex-ja.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/support/cluttex/doc/cluttex-ja.tex
===================================================================
--- trunk/Master/texmf-dist/doc/support/cluttex/doc/cluttex-ja.tex (rev 0)
+++ trunk/Master/texmf-dist/doc/support/cluttex/doc/cluttex-ja.tex 2020-02-06 20:51:06 UTC (rev 53698)
@@ -0,0 +1,281 @@
+\documentclass[a4paper]{ltjsreport}
+\usepackage[unicode]{hyperref}
+\usepackage{jslogo} % for \BibTeX
+\usepackage{amsmath}
+\newcommand\ClutTeX{Clut\TeX}
+\newcommand\texcmd[1]{\texttt{\textbackslash #1}}
+\newcommand\texenv[1]{\texttt{#1}}
+\newcommand\texpkg[1]{\texttt{#1}}
+\newcommand\metavar[1]{\textsf{#1}}
+\renewcommand\sectionautorefname{セクション}
+\renewcommand\subsectionautorefname{サブセクション}
+
+\title{\ClutTeX{}マニュアル\\(バージョン0.5)}
+\author{ARATA Mizuki}
+\date{2020年2月6日}
+
+\begin{document}
+\maketitle
+\tableofcontents
+
+\chapter{\ClutTeX{}の概要}
+\ClutTeX{}は、\LaTeX{}処理の自動化ツールである。
+基本的な特徴として、
+\begin{itemize}
+\item 作業ディレクトリを\texttt{.aux}や\texttt{.log}等の「余計な」ファイルで散らかさない
+\item (相互参照の解決などで)複数回処理を行う必要がある場合に、必要な回数だけ自動で処理する
+\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}
+などがある。
+
+\LaTeX{}処理の自動化ツールとしては\texttt{latexmk}が普及している。
+そのような既存のツールに対する\ClutTeX{}の最大の差別化ポイントは「作業ディレクトリを散らかさない」ことである。
+
+\texttt{.aux}等の補助ファイルは「処理後に消す」のではなく、「隔離された場所に生成させる」。
+そのため、「相互参照を使う文書の処理に関して、\ClutTeX{}を使わない場合に比べて\ClutTeX{}を使う場合に実行回数が増える」ようなことは基本的にはない\footnote{PCの再起動直後など、テンポラリディレクトリーが空の場合を除く。}。
+
+\chapter{\ClutTeX{}の使い方}
+\section{インストール}
+\ClutTeX{}は最新の\TeX\ Liveに収録されている。
+よって、\TeX\ Liveを利用している方は、\TeX\ Liveの更新(コマンドなら\texttt{tlmgr upgrade --all})を行えば\ClutTeX{}がインストールされる。
+
+何らかの理由により手動でインストールしたい場合は、GitHub\footnote{\url{https://github.com/minoki/cluttex}}からアーカイブをダウンロードし、その中にある\texttt{bin/cluttex}か\texttt{bin/cluttex.bat}をPATHの通った場所にコピーする。
+
+\section{コマンドライン}
+基本的な使い方:
+\begin{center}
+ \texttt{cluttex -e \metavar{ENGINE} \metavar{OPTIONs} [--] \metavar{INPUT}.tex}
+\end{center}
+
+基本的なオプション:
+\begin{description}
+\item[\texttt{-e}, \texttt{--engine=\metavar{ENGINE}}]
+ 使用する\TeX{}エンジン・フォーマットを指定する。
+ \metavar{ENGINE}は以下のいずれかを指定する:
+ \texttt{pdflatex}, \texttt{pdftex},
+ \texttt{lualatex}, \texttt{luatex}, \texttt{luajittex},
+ \texttt{xelatex}, \texttt{xetex},
+ \texttt{latex}, \texttt{etex}, \texttt{tex},
+ \texttt{platex}, \texttt{eptex}, \texttt{ptex},
+ \texttt{uplatex}, \texttt{euptex}, \texttt{uptex}.
+ 必須。
+\item[\texttt{-o}, \texttt{--output=\metavar{FILE}}]
+ 出力ファイル名を指定する。
+ デフォルト:\texttt{\metavar{JOBNAME}.\metavar{FORMAT}}
+\item[\texttt{--fresh}]
+ 補助ファイルを削除してから処理を行う。
+ \texttt{--output-directory}との併用はできない。
+\item[\texttt{--max-iterations=\metavar{N}}]
+ 相互参照の解決等のために最大何回処理を行うかを指定する。
+ デフォルト:3
+\item[\texttt{--watch}]
+ 入力ファイルを監視する。
+ 別途、\texttt{fswatch}プログラムまたは\texttt{inotifywait}プログラムが必要となる場合がある。
+ 詳しくは\autoref{sec:watch-mode}を参照。
+\item[\texttt{--color[=\metavar{WHEN}]}]
+ ターミナルへの出力を色付けする。
+ \metavar{WHEN}は\texttt{always}, \texttt{auto}, \texttt{never}のいずれかを指定する。
+ \texttt{--color}自体を省略した場合は\texttt{auto}, \metavar{WHEN}を省略した場合は\texttt{always}が使用される。
+\item[\texttt{--includeonly=\metavar{NAMEs}}]
+ \texttt{\texcmd{includeonly}\{\metavar{NAMEs}\}}を挿入する。
+\item[\texttt{--make-depends=\metavar{FILE}}]
+ Makefile用の依存関係を\metavar{FILE}に書き出す。
+\item[\texttt{--engine-executable=\metavar{COMMAND}}]
+ 実際に使う\TeX{}コマンドを指定する。
+\item[\texttt{--tex-option=\metavar{OPTION}}, \texttt{--tex-options=\metavar{OPTIONs}}]
+ \TeX{}に追加のオプションを渡す。
+\item[\texttt{--dvipdfmx-option=\metavar{OPTION}}, \texttt{--dvipdfmx-options=\metavar{OPTIONs}}]
+ \texttt{dvipdfmx}に追加のオプションを渡す。
+\item[\texttt{--[no-]change-directory}]
+ \TeX{}の実行時に、出力ディレクトリに移動する。
+ シェルエスケープするパッケージを利用する場合に有用となる可能性がある。
+\item[\texttt{-h}, \texttt{--help}]
+\item[\texttt{-v}, \texttt{--version}]
+\item[\texttt{-V}, \texttt{--verbose}]
+\item[\texttt{--print-output-directory}]
+ \texttt{--output-directory}の値を標準出力に出力して、そのまま終了する。
+\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}
+
+補助コマンド実行用のオプション:
+\begin{description}
+\item[\texttt{--makeindex=\metavar{COMMAND}}]
+ MakeIndexを実行する。
+\item[\texttt{--bibtex=\metavar{COMMAND}}]
+ \BibTeX{}を実行する。
+\item[\texttt{--biber[=\metavar{COMMAND}]}]
+ Biberを実行する。
+ \metavar{COMMAND}のデフォルト値:\texttt{biber}
+\item[\texttt{--makeglossaries[=\metavar{COMMAND}]}]
+ makeglossariesを実行する。
+ このオプションは試験的なものである。
+\end{description}
+
+\TeX{}互換オプション:
+\begin{description}
+\item[\texttt{--[no-]shell-escape}]
+\item[\texttt{--shell-restricted}]
+\item[\texttt{--synctex=\metavar{NUMBER}}]
+ Sync\TeX{}用のファイルを生成する。
+ 注意点として、\texttt{.synctex.gz}ファイルは\texttt{.pdf}ファイルと同じディレクトリに生成される。
+ 詳しくは\autoref{sec:synctex}を参照。
+\item[\texttt{--[no-]file-line-error}]
+ デフォルト:Yes
+\item[\texttt{--[no-]halt-on-error}]
+ デフォルト:Yes
+\item[\texttt{--interaction=\metavar{STRING}}]
+ \metavar{STRING}は\texttt{batchmode}, \texttt{nonstopmode}, \texttt{scrollmode}, \texttt{errorstopmode}のいずれか。
+ デフォルト:\texttt{nonstopmode}
+\item[\texttt{--jobname=\metavar{STRING}}]
+\item[\texttt{--fmt=\metavar{FORMAT}}]
+\item[\texttt{--output-directory=\metavar{DIR}}]
+ (\TeX{}処理系にとっての)出力ディレクトリを指定する。
+ 補助ファイルはここで指定されたディレクトリに生成される。
+ デフォルト:テンポラリディレクトリのどこか
+\item[\texttt{--output-format=\metavar{FORMAT}}]
+ 出力フォーマットを指定する。
+ \texttt{pdf}または\texttt{dvi}を指定できる。
+ デフォルト:\texttt{pdf}
+\end{description}
+
+長いオプションは基本的にハイフンを二つ必要とするが、\TeX{}互換オプションに関してはハイフンが一つでも受理される(例:\texttt{-color}は受理されないが\texttt{-synctex=1}は受理される)。
+短いオプションを複数繋げる書き方には対応していない(例:\texttt{-Ve pdflatex}とは書けない)。
+
+\section{Sync\TeX}\label{sec:synctex}
+\texttt{--synctex=1}オプションを使うとSync\TeX{}用のファイルを生成させる。
+
+\ClutTeX{}のモットーは「作業ディレクトリを汚さない」であるが、\texttt{.synctex.gz}ファイルに関してはPDFファイルと同じ場所に生成される。
+これは、\texttt{.synctex.gz}ファイルがPDFファイルと同じ場所にないとSync\TeX{}が動作しないためである。
+
+\section{監視モード}\label{sec:watch-mode}
+\ClutTeX{}に\texttt{--watch}オプションを指定して起動した場合、文書の処理後に\emph{監視モード}に入る。
+
+Windows上では、\ClutTeX{}単体でファイルシステムの監視を行う。
+一方で、それ以外のOS(Unix系)では、\texttt{fswatch}\footnote{\url{http://emcrisostomo.github.io/fswatch/}}プログラムまたは\texttt{inotifywait}プログラムが予めインストールされている必要がある。
+
+\section{MakeIndexや\BibTeX}
+MakeIndexや\BibTeX を使って処理を行う場合は、\texttt{--makeindex}や\texttt{--bibtex}等のオプションを指定する。
+オプションの引数としては、実際に処理に使うコマンド名(\texttt{makeindex}や\texttt{mendex})を指定する。
+
+Biberを使って文献リストを処理する場合、使用すべきオプションは\texttt{--bibtex=biber}ではなく\texttt{--biber}である。
+
+%索引や文献リストを使用する文書であっても、\texttt{--includeonly}を指定する場合は\texttt{--makeindex}や\texttt{--bibtex}等のオプションは指定しないのが吉である。
+
+\section{大規模な文書を書く場合}
+\LaTeX{}で大きな文書を書く場合は\texcmd{include}コマンドによってファイル分割を行うことが多いだろう。
+この際に\texcmd{includeonly}コマンドを使うと、処理時に「一部のファイルしか処理しない」ようにできて、処理時間の削減ができる。
+しかし、\texcmd{includeonly}コマンドを\TeX{}ソース中に記述していちいち切り替えるのは面倒である。
+
+そこで、\ClutTeX{}では\texcmd{includeonly}コマンドを\texttt{--includeonly}オプションによって指定できるようにした。
+使用例は\autoref{sec:makefile-example}を参照せよ。
+
+Tips: \texttt{includeonly}を使用する際は、\texttt{--makeindex}等のオプションは使用しない方が良い。
+
+処理時間の削減方法として、\texttt{--max-iterations=1}を指定するという手もある。
+デフォルトでは\ClutTeX{}は相互参照等を正しくするために\TeX{}を複数回実行する。
+だが、大規模な文書であれば\TeX{}を一回実行するのには数十秒や数分かかり、複数回実行すればその数倍の時間がかかる。
+作業中の文書に関してそれだけの時間をかけて相互参照等を正しくするのは時間の無駄であろう。
+であれば、作業中の文書に関しては\texttt{--max-iterations=1}を指定して\TeX{}の実行回数を最小限に止めることが有効と考えられる。
+
+\section{Makefileと組み合わせる}\label{sec:makefile-example}
+各プロジェクトに応じたコマンドを毎回打ち込むのは大変なので、Makefileと組み合わせると良いだろう。
+例:
+\begin{verbatim}
+main.pdf: main.tex chap1.tex chap2.tex
+ cluttex -e lualatex -o $@ --makeindex=mendex $<
+
+main-preview.pdf: main.tex chap1.tex chap2.tex
+ cluttex -e lualatex -o $@ --makeindex=mendex --max-iterations=1 $<
+
+chap1-preview.pdf: main.tex chap1.tex
+ cluttex -e lualatex -o $@ --max-iterations=1 --includeonly=chap1 $<
+
+chap2-preview.pdf: main.tex chap2.tex
+ cluttex -e lualatex -o $@ --max-iterations=1 --includeonly=chap2 $<
+\end{verbatim}
+
+\texttt{--make-depends}オプションを使うと、依存関係をMakefileのルールとしてファイルに書き出すことができる。
+これを使うと、\texttt{main.tex}, \texttt{chap1.tex}, \texttt{chap2.tex}の3つのファイルからなる文書を以下のMakefileで処理させることができる。
+この際、\texttt{main.pdf}の依存先に\texttt{chap1.tex}と\texttt{chap2.tex}を明示しなくても良い。
+
+\begin{verbatim}
+main.pdf: main.tex
+ cluttex -e lualatex -o $@ --make-depends=main.pdf.dep $<
+
+-include main.pdf.dep
+\end{verbatim}
+
+ただし、\texttt{--make-depends}オプションはまだ実験的なものであり、\texttt{--makeindex}等の他の機能との組み合わせがうまく動かなかったり、将来のバージョンで仕様が変更されるかもしれない。
+
+\section{出力ディレクトリについて}
+デフォルトでは、\texttt{.aux}ファイル等の補助ファイルは、テンポラリディレクトリ以下の適当なディレクトリに生成される。
+このディレクトリ名は、以下の3要素に依存する:
+\begin{itemize}
+\item 入力ファイルの絶対パス
+\item \texttt{--jobname}オプション
+\item \texttt{--engine}オプション
+\end{itemize}
+一方、以下の要素はディレクトリ名に影響しない:
+\begin{itemize}
+\item \texttt{--includeonly}
+\item \texttt{--makeindex}, \texttt{--bibtex}, \texttt{--biber}, \texttt{--makeglossaries}
+\end{itemize}
+
+もし何らかの事情で自動生成された出力ディレクトリの位置を知りたければ、\ClutTeX{}を\texttt{--print-output-directory}オプションを使うとよい。
+例えば、Makefileの\texttt{clean}ターゲットは次のように書ける:
+\begin{verbatim}
+clean:
+ -rm -rf $(shell cluttex -e pdflatex --print-output-directory main.tex)
+ -rm main.pdf
+\end{verbatim}
+
+出力ディレクトリに生成された補助ファイルは、\texttt{--fresh}オプションを指定しない限り、\ClutTeX{}が消去することはない。
+一方、テンポラリディレクトリを使用するということは、PCの再起動時に補助ファイルが削除される可能性があるということでもある。
+
+\section{エイリアス}
+Unix用コマンドの中には、自身の名前によって挙動を変えるものがある。
+つまり、あるコマンドに対してシンボリックリンクリンクによって別名をつけると、元のコマンドと別名によって挙動を変える。
+\TeX\ Liveでも、
+\begin{itemize}
+\item \texttt{extractbb}, \texttt{dvipdfmx} は \texttt{xdvipdfmx} へのエイリアス
+\item \texttt{repstopdf} は \texttt{epstopdf} へのエイリアス
+\end{itemize}
+という例がある。
+
+\texttt{cluttex} が \texttt{cl}\(\langle\text{エンジン名}\rangle\) として呼び出された場合、使用されるエンジン名(\texttt{--engine}オプション)がそれに指定される。
+
+例えば、\texttt{cllualatex}は\texttt{cluttex --engine lualatex}の別名であり、\texttt{clxelatex}は\texttt{cluttex --engine xelatex}の別名である。
+
+\section{\texpkg{minted}と\texpkg{epstopdf}への対策}
+一般に、外部コマンド実行(シェルエスケープ)を行うパッケージは\texttt{-output-directory}を指定した際に正常に動作しない。
+したがって、\ClutTeX{}の下ではそういうパッケージはうまく動かない。
+
+一方で、パッケージによっては\texttt{-output-directory}の値を指示するためのパッケージオプションを持っているものがある。
+例えば、\texpkg{minted}の\texttt{outputdir}オプション、\texpkg{epstopdf}の\texttt{outdir}オプションがそれである。
+
+\ClutTeX{}からこれらのパッケージオプションを指定することはできるが、そのためには使用するパッケージを\ClutTeX{}が事前に知っておかねばならない。
+使用するパッケージを\ClutTeX{}に知らせるには、\texttt{--package-support}オプションを使う。
+
+例えば、\texpkg{minted}を使う文書を処理する場合は次のように実行すれば良い:
+\begin{verbatim}
+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}
Property changes on: trunk/Master/texmf-dist/doc/support/cluttex/doc/cluttex-ja.tex
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/support/cluttex/doc/cluttex.pdf
===================================================================
(Binary files differ)
Index: trunk/Master/texmf-dist/doc/support/cluttex/doc/cluttex.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/support/cluttex/doc/cluttex.pdf 2020-02-06 20:50:18 UTC (rev 53697)
+++ trunk/Master/texmf-dist/doc/support/cluttex/doc/cluttex.pdf 2020-02-06 20:51:06 UTC (rev 53698)
Property changes on: trunk/Master/texmf-dist/doc/support/cluttex/doc/cluttex.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/support/cluttex/doc/cluttex.tex
===================================================================
--- trunk/Master/texmf-dist/doc/support/cluttex/doc/cluttex.tex (rev 0)
+++ trunk/Master/texmf-dist/doc/support/cluttex/doc/cluttex.tex 2020-02-06 20:51:06 UTC (rev 53698)
@@ -0,0 +1,273 @@
+\documentclass[a4paper]{report}
+\usepackage[unicode]{hyperref}
+\usepackage{amsmath}
+\newcommand\ClutTeX{Clut\TeX}
+\providecommand\BibTeX{\textsc{Bib}\TeX}
+\newcommand\texcmd[1]{\texttt{\textbackslash #1}}
+\newcommand\texenv[1]{\texttt{#1}}
+\newcommand\texpkg[1]{\texttt{#1}}
+\newcommand\metavar[1]{\textnormal{\textsf{#1}}}
+
+\title{\ClutTeX\ manual\\(Version 0.5)}
+\author{ARATA Mizuki}
+\date{2020-02-06}
+
+\begin{document}
+\maketitle
+\tableofcontents
+
+\chapter{About \ClutTeX}
+\ClutTeX\ is an automation tool for \LaTeX\ document processing.
+Basic features are,
+\begin{itemize}
+\item Does not clutter your working directory with ``extra'' files, like \texttt{.aux} or \texttt{.log}.
+\item If multiple runs are required to generate correct document, do so.
+\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.
+
+% A competitor: \href{http://www.personal.psu.edu/jcc8/latexmk/}{Latexmk}
+
+\chapter{How to use \ClutTeX}
+\section{Installation}
+If you are using the latest \TeX\ Live, you should have \ClutTeX\ installed.
+If not, upgrade your copy of \TeX\ Live with \texttt{tlmgr update --all}.
+
+If you want to install \ClutTeX\ manually, fetch an archive from GitHub\footnote{\url{https://github.com/minoki/cluttex}}, extract it, and copy \texttt{bin/cluttex} or \texttt{bin/cluttex.bat} to somewhere in your \texttt{PATH}.
+
+\section{Command-line usage}
+Usage:
+\begin{center}
+ \texttt{cluttex -e \metavar{ENGINE} \metavar{OPTIONs} [--] \metavar{INPUT}.tex}
+\end{center}
+
+Basic options:
+\begin{description}
+\item[\texttt{-e}, \texttt{--engine=\metavar{ENGINE}}]
+ Set which \TeX\ engine/format to use.
+ \metavar{ENGINE} is one of the following:
+ \texttt{pdflatex}, \texttt{pdftex},
+ \texttt{lualatex}, \texttt{luatex}, \texttt{luajittex},
+ \texttt{xelatex}, \texttt{xetex},
+ \texttt{latex}, \texttt{etex}, \texttt{tex},
+ \texttt{platex}, \texttt{eptex}, \texttt{ptex},
+ \texttt{uplatex}, \texttt{euptex}, or \texttt{uptex}.
+ Required.
+\item[\texttt{-o}, \texttt{--output=\metavar{FILE}}]
+ Set output file name.
+ Default: \texttt{\metavar{JOBNAME}.\metavar{FORMAT}}
+\item[\texttt{--fresh}]
+ Clean auxiliary files before run.
+ Cannot be used in conjunction with \texttt{--output-directory}.
+\item[\texttt{--max-iterations=\metavar{N}}]
+ Set maximum number of run, for resolving cross-references and etc.
+ Default: 3
+\item[\texttt{--watch}]
+ Watch input files for change.
+ May need an external program to be available.
+ See \autoref{sec:watch-mode} for details.
+\item[\texttt{--color[=\metavar{WHEN}]}]
+ Colorize messages.
+ \metavar{WHEN} is one of \texttt{always}, \texttt{auto}, or \texttt{never}.
+ If \texttt{--color} option is omitted, \texttt{auto} is used.
+ If \metavar{WHEN} is omitted, \texttt{always} is used.
+\item[\texttt{--includeonly=\metavar{NAMEs}}]
+ Insert \texttt{\texcmd{includeonly}\{\metavar{NAMEs}\}}.
+\item[\texttt{--make-depends=\metavar{FILE}}]
+ Write Makefile-style dependencies information to \metavar{FILE}.
+\item[\texttt{--engine-executable=\metavar{COMMAND}}]
+ The actual \TeX\ command to use.
+\item[\texttt{--tex-option=\metavar{OPTION}}, \texttt{--tex-options=\metavar{OPTIONs}}]
+ Pass extra options to \TeX.
+\item[\texttt{--dvipdfmx-option=\metavar{OPTION}}, \texttt{--dvipdfmx-options=\metavar{OPTIONs}}]
+ Pass extra options to \texttt{dvipdfmx}.
+\item[\texttt{--[no-]change-directory}]
+ Change to the output directory when run.
+ May be useful with shell-escaping packages.
+\item[\texttt{-h}, \texttt{--help}]
+\item[\texttt{-v}, \texttt{--version}]
+\item[\texttt{-V}, \texttt{--verbose}]
+\item[\texttt{--print-output-directory}]
+ Print the output directory and exit.
+\item[\texttt{--package-support=PKG1[,PKG2,...,PKGn]}]
+ Enable special support for shell-escaping packages.
+ 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:
+\begin{description}
+\item[\texttt{--makeindex=\metavar{COMMAND}}]
+ Run MakeIndex.
+\item[\texttt{--bibtex=\metavar{COMMAND}}]
+ Run \BibTeX.
+\item[\texttt{--biber[=\metavar{COMMAND}]}]
+ Run Biber. Default value for \metavar{COMMAND}: \texttt{biber}
+\item[\texttt{--makeglossaries[=\metavar{COMMAND}]}]
+ Run makeglossaries. Experimental.
+\end{description}
+
+\TeX-compatible options:
+\begin{description}
+\item[\texttt{--[no-]shell-escape}]
+\item[\texttt{--shell-restricted}]
+\item[\texttt{--synctex=\metavar{NUMBER}}]
+ Generate Sync\TeX\ file.
+ Note that \texttt{.synctex.gz} is created alongside the final \texttt{.pdf}.
+ See \autoref{sec:synctex} for details.
+\item[\texttt{--[no-]file-line-error}]
+ Default: Yes
+\item[\texttt{--[no-]halt-on-error}]
+ Default: Yes
+\item[\texttt{--interaction=\metavar{STRING}}]
+ \metavar{STRING} is one of \texttt{batchmode}, \texttt{nonstopmode}, \texttt{scrollmode}, or \texttt{errorstopmode}.
+ Default: \texttt{nonstopmode}
+\item[\texttt{--jobname=\metavar{STRING}}]
+\item[\texttt{--fmt=\metavar{FORMAT}}]
+\item[\texttt{--output-directory=\metavar{DIR}}]
+ Set output directory for \TeX\ engine.
+ Auxiliary files are produced in this directory.
+ Default: somewhere in the temporary directory.
+\item[\texttt{--output-format=\metavar{FORMAT}}]
+ Set output format.
+ Possible values are \texttt{pdf} or \texttt{dvi}.
+ Default: \texttt{pdf}
+\end{description}
+
+Long options, except \TeX-compatible ones, need two hyphens (e.g. \texttt{-synctex=1} is accepted, but not \texttt{--color}).
+Combining multiple short options, like \texttt{-Ve pdflatex}, is not supported.
+
+\section{Sync\TeX}\label{sec:synctex}
+You can generate Sync\TeX\ data with \texttt{--synctex=1} option.
+
+Although \ClutTeX\ has ``Don't clutter your working directory'' as its motto, the \texttt{.synctex.gz} file is always produced alongside the PDF file.
+This is because Sync\TeX\ cannot find its data file if it's not in the same directory as the PDF.
+
+\section{Watch mode}\label{sec:watch-mode}
+If \texttt{--watch} option is given, \ClutTeX\ enters \emph{watch mode} after processing the document.
+
+On Windows, a built-in filesystem watcher is implemented.
+On other platforms, an auxiliary program \texttt{fswatch}\footnote{\url{http://emcrisostomo.github.io/fswatch/}} or \texttt{inotifywait} needs to be installed.
+
+\section{MakeIndex and \BibTeX}
+If you want to generate index or bibliography, using MakeIndex or \BibTeX, set \texttt{--makeindex}, \texttt{--bibtex}, or \texttt{--biber} option.
+You need to explicitly specify the command name as an argument (e.g. \texttt{--makeindex=makeindex}, \texttt{--bibtex=bibtex}).
+
+If you want to use Biber to process bibliography, the option to use is \texttt{--biber}, not \texttt{--bibtex=biber}.
+
+\section{For writing a large document}
+When writing a large document with \LaTeX, you usually split the \TeX\ files with \texcmd{include} command.
+When doing so, \texcmd{includeonly} can be used to eliminate processing time.
+But writing \texcmd{includeonly} in the \TeX\ source file is somewhat inconvenient.
+After all, \texcmd{includeonly} is about \emph{how} to process the document, not about its content.
+
+Therefore, \ClutTeX\ provides an command-line option to use \texcmd{includeonly}.
+See \autoref{sec:makefile-example} for example.
+
+Tips: When using \texttt{includeonly}, avoid using \texttt{--makeindex} or \texttt{--biber}.
+
+Another technique for eliminating time is, setting \texttt{--max-iterations=1}.
+It stops \ClutTeX\ from processing the document multiple times, which may take several extra minutes.
+
+\section{Using Makefile}\label{sec:makefile-example}
+You can create Makefile to avoid writing \ClutTeX\ options each time.
+Example:
+\begin{verbatim}
+main.pdf: main.tex chap1.tex chap2.tex
+ cluttex -e lualatex -o $@ --makeindex=mendex $<
+
+main-preview.pdf: main.tex chap1.tex chap2.tex
+ cluttex -e lualatex -o $@ --makeindex=mendex --max-iterations=1 $<
+
+chap1-preview.pdf: main.tex chap1.tex
+ cluttex -e lualatex -o $@ --max-iterations=1 --includeonly=chap1 $<
+
+chap2-preview.pdf: main.tex chap2.tex
+ cluttex -e lualatex -o $@ --max-iterations=1 --includeonly=chap2 $<
+\end{verbatim}
+
+With \texttt{--make-depends} option, you can let \ClutTeX\ infer sub-files and omit them from Makefile.
+Example:
+
+\begin{verbatim}
+main.pdf: main.tex
+ cluttex -e lualatex -o $@ --make-depends=main.pdf.dep $<
+
+-include main.pdf.dep
+\end{verbatim}
+
+After initial \texttt{make} run, \texttt{main.pdf.dep} will contain something like this:
+\begin{verbatim}
+main.pdf: ... main.tex ... chap1.tex chap2.tex
+\end{verbatim}
+
+Note that \texttt{--make-depends} option is still experimental, and may not work well with other options like \texttt{--makeindex}.
+
+\section{Default output directory}
+The auxiliary files like \texttt{.aux} are generated somewhere in the temporary directory, by default.
+The directory name depends on the following three parameters:
+\begin{itemize}
+\item The absolute path of the input file
+\item \texttt{--jobname} option
+\item \texttt{--engine} option
+\end{itemize}
+On the other hand, the following parameters doesn't affect the directory name:
+\begin{itemize}
+\item \texttt{--includeonly}
+\item \texttt{--makeindex}, \texttt{--bibtex}, \texttt{--biber}, \texttt{--makeglossaries}
+\end{itemize}
+
+If you need to know the exact location of the automatically-generated output directory, you can invoke \ClutTeX\ with \texttt{--print-output-directory}.
+For example, \texttt{clean} target of your Makefile could be written as:
+\begin{verbatim}
+clean:
+ -rm -rf $(shell cluttex -e pdflatex --print-output-directory main.tex)
+\end{verbatim}
+
+\ClutTeX\ itself doesn't erase the auxiliary files, unless \texttt{--fresh} option is set.
+Note that, the use of a temporary directory means, the auxiliary files may be cleared when the computer is rebooted.
+
+\section{Aliases}
+Some Unix commands change its behavior when it is called under a different name.
+There are several examples in \TeX\ Live:
+\begin{itemize}
+\item \texttt{extractbb} and \texttt{dvipdfmx} are aliases for \texttt{xdvipdfmx}.
+\item \texttt{repstopdf} is an alias for \texttt{epstopdf}.
+\end{itemize}
+
+If \ClutTeX\ is called as \texttt{cl}\(\langle\text{\metavar{ENGINE}}\rangle\), the \texttt{--engine} option is set accordingly.
+For example, \texttt{cllualatex} is an alias for \texttt{cluttex --engine lualatex} and \texttt{clxelatex} for \texttt{cluttex --engine xelatex}.
+
+% The aliases provided by \TeX\ Live are, \texttt{cllualatex} and \texttt{clxelatex}.
+
+\section{Support for \texpkg{minted} and \texpkg{epstopdf}}
+In general, packages that execute external commands (shell-escape) don't work well with \texttt{-output-directory}.
+Therefore, they don't work well with \ClutTeX.
+
+However, some packages provide a package option to let them know the location of \texttt{-output-directory}.
+For example, \texpkg{minted} provides \texttt{outputdir}, and \texpkg{epstopdf} provides \texttt{outdir}.
+
+\ClutTeX\ can supply them the appropriate options, but only if it knows that the package is going to be used.
+To let \ClutTeX\ what packages are going to be used, use \texttt{--package-support} option.
+
+For example, if you want to typeset a document that uses \texpkg{minted}, run the following:
+\begin{verbatim}
+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}
Property changes on: trunk/Master/texmf-dist/doc/support/cluttex/doc/cluttex.tex
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Deleted: trunk/Master/texmf-dist/doc/support/cluttex/doc/manual-ja.pdf
===================================================================
(Binary files differ)
Deleted: trunk/Master/texmf-dist/doc/support/cluttex/doc/manual-ja.tex
===================================================================
--- trunk/Master/texmf-dist/doc/support/cluttex/doc/manual-ja.tex 2020-02-06 20:50:18 UTC (rev 53697)
+++ trunk/Master/texmf-dist/doc/support/cluttex/doc/manual-ja.tex 2020-02-06 20:51:06 UTC (rev 53698)
@@ -1,268 +0,0 @@
-\documentclass[a4paper]{ltjsreport}
-\usepackage[unicode]{hyperref}
-\usepackage{jslogo} % for \BibTeX
-\usepackage{amsmath}
-\newcommand\ClutTeX{Clut\TeX}
-\newcommand\texcmd[1]{\texttt{\textbackslash #1}}
-\newcommand\texenv[1]{\texttt{#1}}
-\newcommand\texpkg[1]{\texttt{#1}}
-\newcommand\metavar[1]{\textsf{#1}}
-\renewcommand\sectionautorefname{セクション}
-\renewcommand\subsectionautorefname{サブセクション}
-
-\title{\ClutTeX{}マニュアル\\(バージョン0.4)}
-\author{ARATA Mizuki}
-\date{2019年8月21日}
-
-\begin{document}
-\maketitle
-\tableofcontents
-
-\chapter{\ClutTeX{}の概要}
-\ClutTeX{}は、\LaTeX{}処理の自動化ツールである。
-基本的な特徴として、
-\begin{itemize}
-\item 作業ディレクトリを\texttt{.aux}や\texttt{.log}等の「余計な」ファイルで散らかさない
-\item (相互参照の解決などで)複数回処理を行う必要がある場合に、必要な回数だけ自動で処理する
-\item 入力ファイルを監視し、変更があった場合に自動で再処理する(\texttt{--watch}オプション\footnote{Unix系OSでは、別途プログラムが必要。})
-\item MakeIndex, \BibTeX, Biber等のコマンドを自動で実行する(\texttt{--makeindex}オプション, \texttt{--bibtex}オプション, \texttt{--biber}オプション)
-\item p\TeX 系列の処理系でPDFを生成する場合、別途\texttt{dvipdfmx}を実行する必要がない(自動で\texttt{dvipdfmx}を実行する)
-\end{itemize}
-などがある。
-
-\LaTeX{}処理の自動化ツールとしては\texttt{latexmk}が普及している。
-そのような既存のツールに対する\ClutTeX{}の最大の差別化ポイントは「作業ディレクトリを散らかさない」ことである。
-
-\texttt{.aux}等の補助ファイルは「処理後に消す」のではなく、「隔離された場所に生成させる」。
-そのため、「相互参照を使う文書の処理に関して、\ClutTeX{}を使わない場合に比べて\ClutTeX{}を使う場合に実行回数が増える」ようなことは基本的にはない\footnote{PCの再起動直後など、テンポラリディレクトリーが空の場合を除く。}。
-
-\chapter{\ClutTeX{}の使い方}
-\section{インストール}
-\ClutTeX{}は最新の\TeX\ Liveに収録されている。
-よって、\TeX\ Liveを利用している方は、\TeX\ Liveの更新(コマンドなら\texttt{tlmgr upgrade --all})を行えば\ClutTeX{}がインストールされる。
-
-何らかの理由により手動でインストールしたい場合は、GitHub\footnote{\url{https://github.com/minoki/cluttex}}からアーカイブをダウンロードし、その中にある\texttt{bin/cluttex}か\texttt{bin/cluttex.bat}をPATHの通った場所にコピーする。
-
-\section{コマンドライン}
-基本的な使い方:
-\begin{center}
- \texttt{cluttex -e \metavar{ENGINE} \metavar{OPTIONs} [--] \metavar{INPUT}.tex}
-\end{center}
-
-基本的なオプション:
-\begin{description}
-\item[\texttt{-e}, \texttt{--engine=\metavar{ENGINE}}]
- 使用する\TeX{}エンジン・フォーマットを指定する。
- \metavar{ENGINE}は以下のいずれかを指定する:
- \texttt{pdflatex}, \texttt{pdftex},
- \texttt{lualatex}, \texttt{luatex}, \texttt{luajittex},
- \texttt{xelatex}, \texttt{xetex},
- \texttt{latex}, \texttt{etex}, \texttt{tex},
- \texttt{platex}, \texttt{eptex}, \texttt{ptex},
- \texttt{uplatex}, \texttt{euptex}, \texttt{uptex}.
- 必須。
-\item[\texttt{-o}, \texttt{--output=\metavar{FILE}}]
- 出力ファイル名を指定する。
- デフォルト:\texttt{\metavar{JOBNAME}.\metavar{FORMAT}}
-\item[\texttt{--fresh}]
- 補助ファイルを削除してから処理を行う。
- \texttt{--output-directory}との併用はできない。
-\item[\texttt{--max-iterations=\metavar{N}}]
- 相互参照の解決等のために最大何回処理を行うかを指定する。
- デフォルト:3
-\item[\texttt{--watch}]
- 入力ファイルを監視する。
- 別途、\texttt{fswatch}プログラムまたは\texttt{inotifywait}プログラムが必要となる場合がある。
- 詳しくは\autoref{sec:watch-mode}を参照。
-\item[\texttt{--color[=\metavar{WHEN}]}]
- ターミナルへの出力を色付けする。
- \metavar{WHEN}は\texttt{always}, \texttt{auto}, \texttt{never}のいずれかを指定する。
- \texttt{--color}自体を省略した場合は\texttt{auto}, \metavar{WHEN}を省略した場合は\texttt{always}が使用される。
-\item[\texttt{--includeonly=\metavar{NAMEs}}]
- \texttt{\texcmd{includeonly}\{\metavar{NAMEs}\}}を挿入する。
-\item[\texttt{--make-depends=\metavar{FILE}}]
- Makefile用の依存関係を\metavar{FILE}に書き出す。
-\item[\texttt{--engine-executable=\metavar{COMMAND}}]
- 実際に使う\TeX{}コマンドを指定する。
-\item[\texttt{--tex-option=\metavar{OPTION}}, \texttt{--tex-options=\metavar{OPTIONs}}]
- \TeX{}に追加のオプションを渡す。
-\item[\texttt{--dvipdfmx-option=\metavar{OPTION}}, \texttt{--dvipdfmx-options=\metavar{OPTIONs}}]
- \texttt{dvipdfmx}に追加のオプションを渡す。
-\item[\texttt{--[no-]change-directory}]
- \TeX{}の実行時に、出力ディレクトリに移動する。
- シェルエスケープするパッケージを利用する場合に有用となる可能性がある。
-\item[\texttt{-h}, \texttt{--help}]
-\item[\texttt{-v}, \texttt{--version}]
-\item[\texttt{-V}, \texttt{--verbose}]
-\item[\texttt{--print-output-directory}]
- \texttt{--output-directory}の値を標準出力に出力して、そのまま終了する。
-\item[\texttt{--package-support=PKG1[,PKG2,...,PKGn]}]
- 外部コマンドを実行するパッケージ用の個別の対策を有効にする。
- 現在のところ、\texttt{minted}と\texttt{epstopdf}に対応している。
-\end{description}
-
-補助コマンド実行用のオプション:
-\begin{description}
-\item[\texttt{--makeindex=\metavar{COMMAND}}]
- MakeIndexを実行する。
-\item[\texttt{--bibtex=\metavar{COMMAND}}]
- \BibTeX{}を実行する。
-\item[\texttt{--biber[=\metavar{COMMAND}]}]
- Biberを実行する。
- \metavar{COMMAND}のデフォルト値:\texttt{biber}
-\item[\texttt{--makeglossaries[=\metavar{COMMAND}]}]
- makeglossariesを実行する。
- このオプションは試験的なものである。
-\end{description}
-
-\TeX{}互換オプション:
-\begin{description}
-\item[\texttt{--[no-]shell-escape}]
-\item[\texttt{--shell-restricted}]
-\item[\texttt{--synctex=\metavar{NUMBER}}]
- Sync\TeX{}用のファイルを生成する。
- 注意点として、\texttt{.synctex.gz}ファイルは\texttt{.pdf}ファイルと同じディレクトリに生成される。
- 詳しくは\autoref{sec:synctex}を参照。
-\item[\texttt{--[no-]file-line-error}]
- デフォルト:Yes
-\item[\texttt{--[no-]halt-on-error}]
- デフォルト:Yes
-\item[\texttt{--interaction=\metavar{STRING}}]
- \metavar{STRING}は\texttt{batchmode}, \texttt{nonstopmode}, \texttt{scrollmode}, \texttt{errorstopmode}のいずれか。
- デフォルト:\texttt{nonstopmode}
-\item[\texttt{--jobname=\metavar{STRING}}]
-\item[\texttt{--fmt=\metavar{FORMAT}}]
-\item[\texttt{--output-directory=\metavar{DIR}}]
- (\TeX{}処理系にとっての)出力ディレクトリを指定する。
- 補助ファイルはここで指定されたディレクトリに生成される。
- デフォルト:テンポラリディレクトリのどこか
-\item[\texttt{--output-format=\metavar{FORMAT}}]
- 出力フォーマットを指定する。
- \texttt{pdf}または\texttt{dvi}を指定できる。
- デフォルト:\texttt{pdf}
-\end{description}
-
-長いオプションは基本的にハイフンを二つ必要とするが、\TeX{}互換オプションに関してはハイフンが一つでも受理される(例:\texttt{-color}は受理されないが\texttt{-synctex=1}は受理される)。
-短いオプションを複数繋げる書き方には対応していない(例:\texttt{-Ve pdflatex}とは書けない)。
-
-\section{Sync\TeX}\label{sec:synctex}
-\texttt{--synctex=1}オプションを使うとSync\TeX{}用のファイルを生成させる。
-
-\ClutTeX{}のモットーは「作業ディレクトリを汚さない」であるが、\texttt{.synctex.gz}ファイルに関してはPDFファイルと同じ場所に生成される。
-これは、\texttt{.synctex.gz}ファイルがPDFファイルと同じ場所にないとSync\TeX{}が動作しないためである。
-
-\section{監視モード}\label{sec:watch-mode}
-\ClutTeX{}に\texttt{--watch}オプションを指定して起動した場合、文書の処理後に\emph{監視モード}に入る。
-
-Windows上では、\ClutTeX{}単体でファイルシステムの監視を行う。
-一方で、それ以外のOS(Unix系)では、\texttt{fswatch}\footnote{\url{http://emcrisostomo.github.io/fswatch/}}プログラムまたは\texttt{inotifywait}プログラムが予めインストールされている必要がある。
-
-\section{MakeIndexや\BibTeX}
-MakeIndexや\BibTeX を使って処理を行う場合は、\texttt{--makeindex}や\texttt{--bibtex}等のオプションを指定する。
-オプションの引数としては、実際に処理に使うコマンド名(\texttt{makeindex}や\texttt{mendex})を指定する。
-
-Biberを使って文献リストを処理する場合、使用すべきオプションは\texttt{--bibtex=biber}ではなく\texttt{--biber}である。
-
-%索引や文献リストを使用する文書であっても、\texttt{--includeonly}を指定する場合は\texttt{--makeindex}や\texttt{--bibtex}等のオプションは指定しないのが吉である。
-
-\section{大規模な文書を書く場合}
-\LaTeX{}で大きな文書を書く場合は\texcmd{include}コマンドによってファイル分割を行うことが多いだろう。
-この際に\texcmd{includeonly}コマンドを使うと、処理時に「一部のファイルしか処理しない」ようにできて、処理時間の削減ができる。
-しかし、\texcmd{includeonly}コマンドを\TeX{}ソース中に記述していちいち切り替えるのは面倒である。
-
-そこで、\ClutTeX{}では\texcmd{includeonly}コマンドを\texttt{--includeonly}オプションによって指定できるようにした。
-使用例は\autoref{sec:makefile-example}を参照せよ。
-
-Tips: \texttt{includeonly}を使用する際は、\texttt{--makeindex}等のオプションは使用しない方が良い。
-
-処理時間の削減方法として、\texttt{--max-iterations=1}を指定するという手もある。
-デフォルトでは\ClutTeX{}は相互参照等を正しくするために\TeX{}を複数回実行する。
-だが、大規模な文書であれば\TeX{}を一回実行するのには数十秒や数分かかり、複数回実行すればその数倍の時間がかかる。
-作業中の文書に関してそれだけの時間をかけて相互参照等を正しくするのは時間の無駄であろう。
-であれば、作業中の文書に関しては\texttt{--max-iterations=1}を指定して\TeX{}の実行回数を最小限に止めることが有効と考えられる。
-
-\section{Makefileと組み合わせる}\label{sec:makefile-example}
-各プロジェクトに応じたコマンドを毎回打ち込むのは大変なので、Makefileと組み合わせると良いだろう。
-例:
-\begin{verbatim}
-main.pdf: main.tex chap1.tex chap2.tex
- cluttex -e lualatex -o $@ --makeindex=mendex $<
-
-main-preview.pdf: main.tex chap1.tex chap2.tex
- cluttex -e lualatex -o $@ --makeindex=mendex --max-iterations=1 $<
-
-chap1-preview.pdf: main.tex chap1.tex
- cluttex -e lualatex -o $@ --max-iterations=1 --includeonly=chap1 $<
-
-chap2-preview.pdf: main.tex chap2.tex
- cluttex -e lualatex -o $@ --max-iterations=1 --includeonly=chap2 $<
-\end{verbatim}
-
-\texttt{--make-depends}オプションを使うと、依存関係をMakefileのルールとしてファイルに書き出すことができる。
-これを使うと、\texttt{main.tex}, \texttt{chap1.tex}, \texttt{chap2.tex}の3つのファイルからなる文書を以下のMakefileで処理させることができる。
-この際、\texttt{main.pdf}の依存先に\texttt{chap1.tex}と\texttt{chap2.tex}を明示しなくても良い。
-
-\begin{verbatim}
-main.pdf: main.tex
- cluttex -e lualatex -o $@ --make-depends=main.pdf.dep $<
-
--include main.pdf.dep
-\end{verbatim}
-
-ただし、\texttt{--make-depends}オプションはまだ実験的なものであり、\texttt{--makeindex}等の他の機能との組み合わせがうまく動かなかったり、将来のバージョンで仕様が変更されるかもしれない。
-
-\section{出力ディレクトリについて}
-デフォルトでは、\texttt{.aux}ファイル等の補助ファイルは、テンポラリディレクトリ以下の適当なディレクトリに生成される。
-このディレクトリ名は、以下の3要素に依存する:
-\begin{itemize}
-\item 入力ファイルの絶対パス
-\item \texttt{--jobname}オプション
-\item \texttt{--engine}オプション
-\end{itemize}
-一方、以下の要素はディレクトリ名に影響しない:
-\begin{itemize}
-\item \texttt{--includeonly}
-\item \texttt{--makeindex}, \texttt{--bibtex}, \texttt{--biber}, \texttt{--makeglossaries}
-\end{itemize}
-
-もし何らかの事情で自動生成された出力ディレクトリの位置を知りたければ、\ClutTeX{}を\texttt{--print-output-directory}オプションを使うとよい。
-例えば、Makefileの\texttt{clean}ターゲットは次のように書ける:
-\begin{verbatim}
-clean:
- -rm -rf $(shell cluttex -e pdflatex --print-output-directory main.tex)
- -rm main.pdf
-\end{verbatim}
-
-出力ディレクトリに生成された補助ファイルは、\texttt{--fresh}オプションを指定しない限り、\ClutTeX{}が消去することはない。
-一方、テンポラリディレクトリを使用するということは、PCの再起動時に補助ファイルが削除される可能性があるということでもある。
-
-\section{エイリアス}
-Unix用コマンドの中には、自身の名前によって挙動を変えるものがある。
-つまり、あるコマンドに対してシンボリックリンクリンクによって別名をつけると、元のコマンドと別名によって挙動を変える。
-\TeX\ Liveでも、
-\begin{itemize}
-\item \texttt{extractbb}, \texttt{dvipdfmx} は \texttt{xdvipdfmx} へのエイリアス
-\item \texttt{repstopdf} は \texttt{epstopdf} へのエイリアス
-\end{itemize}
-という例がある。
-
-\texttt{cluttex} が \texttt{cl}\(\langle\text{エンジン名}\rangle\) として呼び出された場合、使用されるエンジン名(\texttt{--engine}オプション)がそれに指定される。
-
-例えば、\texttt{cllualatex}は\texttt{cluttex --engine lualatex}の別名であり、\texttt{clxelatex}は\texttt{cluttex --engine xelatex}の別名である。
-
-\section{\texpkg{minted}と\texpkg{epstopdf}への対策}
-一般に、外部コマンド実行(シェルエスケープ)を行うパッケージは\texttt{-output-directory}を指定した際に正常に動作しない。
-したがって、\ClutTeX{}の下ではそういうパッケージはうまく動かない。
-
-一方で、パッケージによっては\texttt{-output-directory}の値を指示するためのパッケージオプションを持っているものがある。
-例えば、\texpkg{minted}の\texttt{outputdir}オプション、\texpkg{epstopdf}の\texttt{outdir}オプションがそれである。
-
-\ClutTeX{}からこれらのパッケージオプションを指定することはできるが、そのためには使用するパッケージを\ClutTeX{}が事前に知っておかねばならない。
-使用するパッケージを\ClutTeX{}に知らせるには、\texttt{--package-support}オプションを使う。
-
-例えば、\texpkg{minted}を使う文書を処理する場合は次のように実行すれば良い:
-\begin{verbatim}
-cluttex -e pdflatex --shell-escape --package-support=minted document.tex
-\end{verbatim}
-
-\end{document}
Deleted: trunk/Master/texmf-dist/doc/support/cluttex/doc/manual.pdf
===================================================================
(Binary files differ)
Deleted: trunk/Master/texmf-dist/doc/support/cluttex/doc/manual.tex
===================================================================
--- trunk/Master/texmf-dist/doc/support/cluttex/doc/manual.tex 2020-02-06 20:50:18 UTC (rev 53697)
+++ trunk/Master/texmf-dist/doc/support/cluttex/doc/manual.tex 2020-02-06 20:51:06 UTC (rev 53698)
@@ -1,260 +0,0 @@
-\documentclass[a4paper]{report}
-\usepackage[unicode]{hyperref}
-\usepackage{amsmath}
-\newcommand\ClutTeX{Clut\TeX}
-\providecommand\BibTeX{\textsc{Bib}\TeX}
-\newcommand\texcmd[1]{\texttt{\textbackslash #1}}
-\newcommand\texenv[1]{\texttt{#1}}
-\newcommand\texpkg[1]{\texttt{#1}}
-\newcommand\metavar[1]{\textnormal{\textsf{#1}}}
-
-\title{\ClutTeX\ manual\\(Version 0.4)}
-\author{ARATA Mizuki}
-\date{2019-08-21}
-
-\begin{document}
-\maketitle
-\tableofcontents
-
-\chapter{About \ClutTeX}
-\ClutTeX\ is an automation tool for \LaTeX\ document processing.
-Basic features are,
-\begin{itemize}
-\item Does not clutter your working directory with ``extra'' files, like \texttt{.aux} or \texttt{.log}.
-\item If multiple runs are required to generate correct document, do so.
-\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.
-\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.
-
-% A competitor: \href{http://www.personal.psu.edu/jcc8/latexmk/}{Latexmk}
-
-\chapter{How to use \ClutTeX}
-\section{Installation}
-If you are using the latest \TeX\ Live, you should have \ClutTeX\ installed.
-If not, upgrade your copy of \TeX\ Live with \texttt{tlmgr update --all}.
-
-If you want to install \ClutTeX\ manually, fetch an archive from GitHub\footnote{\url{https://github.com/minoki/cluttex}}, extract it, and copy \texttt{bin/cluttex} or \texttt{bin/cluttex.bat} to somewhere in your \texttt{PATH}.
-
-\section{Command-line usage}
-Usage:
-\begin{center}
- \texttt{cluttex -e \metavar{ENGINE} \metavar{OPTIONs} [--] \metavar{INPUT}.tex}
-\end{center}
-
-Basic options:
-\begin{description}
-\item[\texttt{-e}, \texttt{--engine=\metavar{ENGINE}}]
- Set which \TeX\ engine/format to use.
- \metavar{ENGINE} is one of the following:
- \texttt{pdflatex}, \texttt{pdftex},
- \texttt{lualatex}, \texttt{luatex}, \texttt{luajittex},
- \texttt{xelatex}, \texttt{xetex},
- \texttt{latex}, \texttt{etex}, \texttt{tex},
- \texttt{platex}, \texttt{eptex}, \texttt{ptex},
- \texttt{uplatex}, \texttt{euptex}, or \texttt{uptex}.
- Required.
-\item[\texttt{-o}, \texttt{--output=\metavar{FILE}}]
- Set output file name.
- Default: \texttt{\metavar{JOBNAME}.\metavar{FORMAT}}
-\item[\texttt{--fresh}]
- Clean auxiliary files before run.
- Cannot be used in conjunction with \texttt{--output-directory}.
-\item[\texttt{--max-iterations=\metavar{N}}]
- Set maximum number of run, for resolving cross-references and etc.
- Default: 3
-\item[\texttt{--watch}]
- Watch input files for change.
- May need an external program to be available.
- See \autoref{sec:watch-mode} for details.
-\item[\texttt{--color[=\metavar{WHEN}]}]
- Colorize messages.
- \metavar{WHEN} is one of \texttt{always}, \texttt{auto}, or \texttt{never}.
- If \texttt{--color} option is omitted, \texttt{auto} is used.
- If \metavar{WHEN} is omitted, \texttt{always} is used.
-\item[\texttt{--includeonly=\metavar{NAMEs}}]
- Insert \texttt{\texcmd{includeonly}\{\metavar{NAMEs}\}}.
-\item[\texttt{--make-depends=\metavar{FILE}}]
- Write Makefile-style dependencies information to \metavar{FILE}.
-\item[\texttt{--engine-executable=\metavar{COMMAND}}]
- The actual \TeX\ command to use.
-\item[\texttt{--tex-option=\metavar{OPTION}}, \texttt{--tex-options=\metavar{OPTIONs}}]
- Pass extra options to \TeX.
-\item[\texttt{--dvipdfmx-option=\metavar{OPTION}}, \texttt{--dvipdfmx-options=\metavar{OPTIONs}}]
- Pass extra options to \texttt{dvipdfmx}.
-\item[\texttt{--[no-]change-directory}]
- Change to the output directory when run.
- May be useful with shell-escaping packages.
-\item[\texttt{-h}, \texttt{--help}]
-\item[\texttt{-v}, \texttt{--version}]
-\item[\texttt{-V}, \texttt{--verbose}]
-\item[\texttt{--print-output-directory}]
- 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`.
-\end{description}
-
-Options for running auxiliary programs:
-\begin{description}
-\item[\texttt{--makeindex=\metavar{COMMAND}}]
- Run MakeIndex.
-\item[\texttt{--bibtex=\metavar{COMMAND}}]
- Run \BibTeX.
-\item[\texttt{--biber[=\metavar{COMMAND}]}]
- Run Biber. Default value for \metavar{COMMAND}: \texttt{biber}
-\item[\texttt{--makeglossaries[=\metavar{COMMAND}]}]
- Run makeglossaries. Experimental.
-\end{description}
-
-\TeX-compatible options:
-\begin{description}
-\item[\texttt{--[no-]shell-escape}]
-\item[\texttt{--shell-restricted}]
-\item[\texttt{--synctex=\metavar{NUMBER}}]
- Generate Sync\TeX\ file.
- Note that \texttt{.synctex.gz} is created alongside the final \texttt{.pdf}.
- See \autoref{sec:synctex} for details.
-\item[\texttt{--[no-]file-line-error}]
- Default: Yes
-\item[\texttt{--[no-]halt-on-error}]
- Default: Yes
-\item[\texttt{--interaction=\metavar{STRING}}]
- \metavar{STRING} is one of \texttt{batchmode}, \texttt{nonstopmode}, \texttt{scrollmode}, or \texttt{errorstopmode}.
- Default: \texttt{nonstopmode}
-\item[\texttt{--jobname=\metavar{STRING}}]
-\item[\texttt{--fmt=\metavar{FORMAT}}]
-\item[\texttt{--output-directory=\metavar{DIR}}]
- Set output directory for \TeX\ engine.
- Auxiliary files are produced in this directory.
- Default: somewhere in the temporary directory.
-\item[\texttt{--output-format=\metavar{FORMAT}}]
- Set output format.
- Possible values are \texttt{pdf} or \texttt{dvi}.
- Default: \texttt{pdf}
-\end{description}
-
-Long options, except \TeX-compatible ones, need two hyphens (e.g. \texttt{-synctex=1} is accepted, but not \texttt{--color}).
-Combining multiple short options, like \texttt{-Ve pdflatex}, is not supported.
-
-\section{Sync\TeX}\label{sec:synctex}
-You can generate Sync\TeX\ data with \texttt{--synctex=1} option.
-
-Although \ClutTeX\ has ``Don't clutter your working directory'' as its motto, the \texttt{.synctex.gz} file is always produced alongside the PDF file.
-This is because Sync\TeX\ cannot find its data file if it's not in the same directory as the PDF.
-
-\section{Watch mode}\label{sec:watch-mode}
-If \texttt{--watch} option is given, \ClutTeX\ enters \emph{watch mode} after processing the document.
-
-On Windows, a built-in filesystem watcher is implemented.
-On other platforms, an auxiliary program \texttt{fswatch}\footnote{\url{http://emcrisostomo.github.io/fswatch/}} or \texttt{inotifywait} needs to be installed.
-
-\section{MakeIndex and \BibTeX}
-If you want to generate index or bibliography, using MakeIndex or \BibTeX, set \texttt{--makeindex}, \texttt{--bibtex}, or \texttt{--biber} option.
-You need to explicitly specify the command name as an argument (e.g. \texttt{--makeindex=makeindex}, \texttt{--bibtex=bibtex}).
-
-If you want to use Biber to process bibliography, the option to use is \texttt{--biber}, not \texttt{--bibtex=biber}.
-
-\section{For writing a large document}
-When writing a large document with \LaTeX, you usually split the \TeX\ files with \texcmd{include} command.
-When doing so, \texcmd{includeonly} can be used to eliminate processing time.
-But writing \texcmd{includeonly} in the \TeX\ source file is somewhat inconvenient.
-After all, \texcmd{includeonly} is about \emph{how} to process the document, not about its content.
-
-Therefore, \ClutTeX\ provides an command-line option to use \texcmd{includeonly}.
-See \autoref{sec:makefile-example} for example.
-
-Tips: When using \texttt{includeonly}, avoid using \texttt{--makeindex} or \texttt{--biber}.
-
-Another technique for eliminating time is, setting \texttt{--max-iterations=1}.
-It stops \ClutTeX\ from processing the document multiple times, which may take several extra minutes.
-
-\section{Using Makefile}\label{sec:makefile-example}
-You can create Makefile to avoid writing \ClutTeX\ options each time.
-Example:
-\begin{verbatim}
-main.pdf: main.tex chap1.tex chap2.tex
- cluttex -e lualatex -o $@ --makeindex=mendex $<
-
-main-preview.pdf: main.tex chap1.tex chap2.tex
- cluttex -e lualatex -o $@ --makeindex=mendex --max-iterations=1 $<
-
-chap1-preview.pdf: main.tex chap1.tex
- cluttex -e lualatex -o $@ --max-iterations=1 --includeonly=chap1 $<
-
-chap2-preview.pdf: main.tex chap2.tex
- cluttex -e lualatex -o $@ --max-iterations=1 --includeonly=chap2 $<
-\end{verbatim}
-
-With \texttt{--make-depends} option, you can let \ClutTeX\ infer sub-files and omit them from Makefile.
-Example:
-
-\begin{verbatim}
-main.pdf: main.tex
- cluttex -e lualatex -o $@ --make-depends=main.pdf.dep $<
-
--include main.pdf.dep
-\end{verbatim}
-
-After initial \texttt{make} run, \texttt{main.pdf.dep} will contain something like this:
-\begin{verbatim}
-main.pdf: ... main.tex ... chap1.tex chap2.tex
-\end{verbatim}
-
-Note that \texttt{--make-depends} option is still experimental, and may not work well with other options like \texttt{--makeindex}.
-
-\section{Default output directory}
-The auxiliary files like \texttt{.aux} are generated somewhere in the temporary directory, by default.
-The directory name depends on the following three parameters:
-\begin{itemize}
-\item The absolute path of the input file
-\item \texttt{--jobname} option
-\item \texttt{--engine} option
-\end{itemize}
-On the other hand, the following parameters doesn't affect the directory name:
-\begin{itemize}
-\item \texttt{--includeonly}
-\item \texttt{--makeindex}, \texttt{--bibtex}, \texttt{--biber}, \texttt{--makeglossaries}
-\end{itemize}
-
-If you need to know the exact location of the automatically-generated output directory, you can invoke \ClutTeX\ with \texttt{--print-output-directory}.
-For example, \texttt{clean} target of your Makefile could be written as:
-\begin{verbatim}
-clean:
- -rm -rf $(shell cluttex -e pdflatex --print-output-directory main.tex)
-\end{verbatim}
-
-\ClutTeX\ itself doesn't erase the auxiliary files, unless \texttt{--fresh} option is set.
-Note that, the use of a temporary directory means, the auxiliary files may be cleared when the computer is rebooted.
-
-\section{Aliases}
-Some Unix commands change its behavior when it is called under a different name.
-There are several examples in \TeX\ Live:
-\begin{itemize}
-\item \texttt{extractbb} and \texttt{dvipdfmx} are aliases for \texttt{xdvipdfmx}.
-\item \texttt{repstopdf} is an alias for \texttt{epstopdf}.
-\end{itemize}
-
-If \ClutTeX\ is called as \texttt{cl}\(\langle\text{\metavar{ENGINE}}\rangle\), the \texttt{--engine} option is set accordingly.
-For example, \texttt{cllualatex} is an alias for \texttt{cluttex --engine lualatex} and \texttt{clxelatex} for \texttt{cluttex --engine xelatex}.
-
-% The aliases provided by \TeX\ Live are, \texttt{cllualatex} and \texttt{clxelatex}.
-
-\section{Support for \texpkg{minted} and \texpkg{epstopdf}}
-In general, packages that execute external commands (shell-escape) don't work well with \texttt{-output-directory}.
-Therefore, they don't work well with \ClutTeX.
-
-However, some packages provide a package option to let them know the location of \texttt{-output-directory}.
-For example, \texpkg{minted} provides \texttt{outputdir}, and \texpkg{epstopdf} provides \texttt{outdir}.
-
-\ClutTeX\ can supply them the appropriate options, but only if it knows that the package is going to be used.
-To let \ClutTeX\ what packages are going to be used, use \texttt{--package-support} option.
-
-For example, if you want to typeset a document that uses \texpkg{minted}, run the following:
-\begin{verbatim}
-cluttex -e pdflatex --shell-escape --package-support=minted document.tex
-\end{verbatim}
-
-\end{document}
Modified: trunk/Master/texmf-dist/doc/support/cluttex/src/cluttex.lua
===================================================================
--- trunk/Master/texmf-dist/doc/support/cluttex/src/cluttex.lua 2020-02-06 20:50:18 UTC (rev 53697)
+++ trunk/Master/texmf-dist/doc/support/cluttex/src/cluttex.lua 2020-02-06 20:51:06 UTC (rev 53698)
@@ -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 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 @@
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 @@
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
Modified: trunk/Master/texmf-dist/doc/support/cluttex/src/texrunner/auxfile.lua
===================================================================
--- trunk/Master/texmf-dist/doc/support/cluttex/src/texrunner/auxfile.lua 2020-02-06 20:50:18 UTC (rev 53697)
+++ trunk/Master/texmf-dist/doc/support/cluttex/src/texrunner/auxfile.lua 2020-02-06 20:51:06 UTC (rev 53698)
@@ -31,8 +31,9 @@
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 @@
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
Added: trunk/Master/texmf-dist/doc/support/cluttex/src/texrunner/checkdriver.lua
===================================================================
--- trunk/Master/texmf-dist/doc/support/cluttex/src/texrunner/checkdriver.lua (rev 0)
+++ trunk/Master/texmf-dist/doc/support/cluttex/src/texrunner/checkdriver.lua 2020-02-06 20:51:06 UTC (rev 53698)
@@ -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,
+}
Property changes on: trunk/Master/texmf-dist/doc/support/cluttex/src/texrunner/checkdriver.lua
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Modified: trunk/Master/texmf-dist/doc/support/cluttex/src/texrunner/handleoption.lua
===================================================================
--- trunk/Master/texmf-dist/doc/support/cluttex/src/texrunner/handleoption.lua 2020-02-06 20:50:18 UTC (rev 53697)
+++ trunk/Master/texmf-dist/doc/support/cluttex/src/texrunner/handleoption.lua 2020-02-06 20:51:06 UTC (rev 53698)
@@ -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 @@
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 @@
long = "package-support",
param = true
},
+ {
+ long = "check-driver",
+ param = true
+ },
-- Options for TeX
{
long = "synctex",
@@ -257,6 +263,10 @@
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 @@
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 @@
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
Modified: trunk/Master/texmf-dist/doc/support/cluttex/src/texrunner/luatexinit.lua
===================================================================
--- trunk/Master/texmf-dist/doc/support/cluttex/src/texrunner/luatexinit.lua 2020-02-06 20:50:18 UTC (rev 53697)
+++ trunk/Master/texmf-dist/doc/support/cluttex/src/texrunner/luatexinit.lua 2020-02-06 20:51:06 UTC (rev 53698)
@@ -17,17 +17,19 @@
-- 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
Modified: trunk/Master/texmf-dist/doc/support/cluttex/src/texrunner/message.lua
===================================================================
--- trunk/Master/texmf-dist/doc/support/cluttex/src/texrunner/message.lua 2020-02-06 20:50:18 UTC (rev 53697)
+++ trunk/Master/texmf-dist/doc/support/cluttex/src/texrunner/message.lua 2020-02-06 20:51:06 UTC (rev 53698)
@@ -89,7 +89,7 @@
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
Modified: trunk/Master/texmf-dist/scripts/cluttex/cluttex.lua
===================================================================
--- trunk/Master/texmf-dist/scripts/cluttex/cluttex.lua 2020-02-06 20:50:18 UTC (rev 53697)
+++ trunk/Master/texmf-dist/scripts/cluttex/cluttex.lua 2020-02-06 20:51:06 UTC (rev 53698)
@@ -1133,8 +1133,9 @@
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 @@
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 @@
-- 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 @@
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 @@
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 @@
long = "package-support",
param = true
},
+ {
+ long = "check-driver",
+ param = true
+ },
-- Options for TeX
{
long = "synctex",
@@ -1621,6 +1633,10 @@
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 @@
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 @@
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 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,9 @@
safeinput = safeinput,
}
end
+package.preload["texrunner.checkdriver"] = function(...)
--[[
- Copyright 2016,2018-2019 ARATA Mizuki
+ Copyright 2020 ARATA Mizuki
This file is part of ClutTeX.
@@ -2677,9 +2720,194 @@
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"
-CLUTTEX_VERSION = "v0.4"
+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-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/>.
+]]
+
+CLUTTEX_VERSION = "v0.5"
+
-- Standard libraries
local coroutine = coroutine
local tostring = tostring
@@ -2700,6 +2928,7 @@
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 @@
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 @@
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
More information about the tex-live-commits
mailing list.