Skip to content

Commit

Permalink
Merge pull request #19 from atticus-sullivan/feat-silent
Browse files Browse the repository at this point in the history
feat: add option to make TeX less verbose
  • Loading branch information
atticus-sullivan authored Dec 17, 2024
2 parents faaac96 + 96ea4de commit ea1626a
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 0 deletions.
8 changes: 8 additions & 0 deletions doc/cluttealtex.tex
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,14 @@ \subsection{Basic options}
\item[\texttt{-o}, \texttt{--output=\metavar{FILE}}]
Set output file name.
Default: \texttt{\metavar{JOBNAME}.\metavar{FORMAT}}
\item[\texttt{-q}, \texttt{--quiet[=\metavar{LEVEL}]}]
Supress some output of the issued TeX command.\\
Level 0: show all\\
Level 1: avoid over-/underfull boxes (to some extend)\\
Level 2: only show output generated inside document environment\\
Default: \texttt{1}

It is recomended to disable quiet output eventually to really make sure no warning goes unnoticed.
\item[\texttt{--fresh}]
Clean auxiliary files before run.
Cannot be used in conjunction with \texttt{--output-directory}.
Expand Down
9 changes: 9 additions & 0 deletions src_teal/cluttealtex.tl
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,15 @@ local function single_run(auxstatus:{string:reruncheck.Status}, iteration:intege
if options.memoize_opts then
tex_injection = string.format("%s\\PassOptionsToPackage{%s}{memoize}", tex_injection or "", table.concat(options.memoize_opts, ","))
end
if options.quiet then
if options.quiet >= 1 then
tex_injection = string.format("%s\\AddToHook{begindocument/end}[quietX]{\\hbadness=99999 \\hfuzz=9999pt}", tex_injection or "")
end
if options.quiet >= 2 then
tex_options.interaction = "batchmode"
tex_injection = string.format("%s\\AddToHook{begindocument/end}[quiet]{\\nonstopmode}\\AddToHook{enddocument/info}[quiet]{\\batchmode}", tex_injection or "")
end
end

local inputline = tex_injection .. safename.safeinput(inputfile, engine)

Expand Down
18 changes: 18 additions & 0 deletions src_teal/texrunner/option_spec.tl
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,11 @@ Options:
--engine-executable=COMMAND+OPTIONs
The actual TeX command to use.
[default: ENGINE]
-q, --quiet[=LEVEL] Reduce output from TeX command.
Level 0: show all
Level 1: avoid over-/underfull boxes (to some extend)
Level 2: only show output generated inside document environment
[default: 1]
-o, --output=FILE The name of output file.
[default: JOBNAME.pdf or JOBNAME.dvi]
--fresh Clean intermediate files before running TeX.
Expand Down Expand Up @@ -736,6 +741,19 @@ local option_spec:{string:Option} = {
end
end
},
quiet = {
long = "quiet",
param = true,
default = "1",
handle_cli = function(options:options.Options, param:string|boolean)
assert(options.quiet == nil, "multiple --quiet options")
if param is string then
options.quiet = assert(tonumber(param) as integer, "parameter must be an integer")
else
error("invalid param type")
end
end
},
}

return {
Expand Down
1 change: 1 addition & 0 deletions src_teal/texrunner/option_type.tl
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ local record Module
memoize: string
memoize_opts: {string}
extraoptions: {string}
quiet: integer
end
record WatchIncExc
type: string
Expand Down

0 comments on commit ea1626a

Please sign in to comment.