Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Features
* With pTeX-like engines, automatically run dvipdfmx to produce PDF file.
* Automatically re-run (La)TeX to resolve cross-references and other things.
* Watch input files for change (requires an external program). \[`--watch` option\]
* Support for MakeIndex, BibTeX, Biber, makeglossaries commands. \[`--makeindex`, `--bibtex`, `--biber`, `--makeglossaries` options\]
* Support for MakeIndex, BibTeX, Biber, makeglossaries, sagetex commands. \[`--makeindex`, `--bibtex`, `--biber`, `--makeglossaries`, `--sagetex` options\]

Usage
-----
Expand Down Expand Up @@ -107,6 +107,8 @@ Options to run auxiliary programs:
Use Biber program to produce `.bbl` file from `.bcf` file.
* `--makeglossaries[=COMMAND]`
Use makeglossaries program to produce `.gls` file from `.glo` file.
* `--sagetex[=COMMAND]`
Use sagetex program to produce `.sout` and `.scmd` file from `.sage` file.

TeX-compatible options:

Expand Down
Binary file modified doc/cluttex.pdf
Binary file not shown.
2 changes: 2 additions & 0 deletions doc/cluttex.tex
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,8 @@ \section{Command-line usage}
Run Biber. Default value for \metavar{COMMAND}: \texttt{biber}
\item[\texttt{--makeglossaries[=\metavar{COMMAND}]}]
Run makeglossaries. Experimental.
\item[\texttt{--sagetex[=\metavar{COMMAND}]}]
Run sagetex. Experimental.
\end{description}

\TeX-compatible options:
Expand Down
21 changes: 21 additions & 0 deletions src/cluttex.lua
Original file line number Diff line number Diff line change
Expand Up @@ -427,6 +427,27 @@ local function single_run(auxstatus, iteration)
end
end

if options.sagetex then
for _,file in ipairs(filelist) do
if pathutil.ext(file.path) == "sage" then
local sagefileinfo = {path = file.path, abspath = file.abspath, kind = "auxiliary"}
if reruncheck.comparefileinfo({sagefileinfo}, auxstatus) then
local sage_command = {
options.sagetex, -- Do not escape options.sagetex to allow additional options
-- TODO handle output directory?
pathutil.basename(file.abspath)
}
coroutine.yield(table.concat(sage_command, " "))
end
end
end
else
-- Check log file
if string.find(execlog, "Run Sage on") then
message.diag("You may want to use --sagetex option.")
end
end

if string.find(execlog, "No pages of output.") then
return "No pages of output."
end
Expand Down
10 changes: 10 additions & 0 deletions src/texrunner/handleoption.lua
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ Options:
--bibtex=COMMAND+OPTIONs Command for BibTeX, such as
`bibtex' or `pbibtex'.
--biber[=COMMAND+OPTIONs] Command for Biber.
--sagetex[=COMMAND+OPTIONS] Command for sagetex
--makeglossaries[=COMMAND+OPTIONs] Command for makeglossaries.
-h, --help Print this message and exit.
-v, --version Print version information and exit.
Expand Down Expand Up @@ -242,6 +243,11 @@ local option_spec = {
param = true,
default = "biber",
},
{
long = "sagetex",
param = true,
default = "sage",
},
{
long = "makeglossaries",
param = true,
Expand Down Expand Up @@ -434,6 +440,10 @@ local function handle_cluttex_options(arg)
assert(options.makeglossaries == nil, "multiple --makeglossaries options")
options.makeglossaries = param

elseif name == "sagetex" then
assert(options.sagetex == nil, "multiple --sagetex options")
options.sagetex = param

end
end

Expand Down
2 changes: 2 additions & 0 deletions src/texrunner/reruncheck.lua
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@ local function parse_recorder_file(file, options, filelist, filemap)
kind = "auxiliary"
elseif ext == "glo" then -- makeglossaries
kind = "auxiliary"
elseif ext == "sage" then -- sagetex
kind = "auxiliary"
end
fileinfo = {path = path, abspath = abspath, kind = kind}
table.insert(filelist, fileinfo)
Expand Down