Code Monkey home page Code Monkey logo

cluttex's Introduction

ClutTeX: Process LaTeX document without cluttering your directory

ClutTeX is a program to automatically process your LaTeX document. If necessary, it re-runs (La)TeX program to resolve cross-references and everything.

One of its main feature is that, it does not clutter your working directory (but the final .pdf file is still brought for you).

Blog:

Features

  • Does not clutter your working directory with .aux, .log, etc. files.
  • Does not prompt for input when there is a (La)TeX error.
  • 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]

Usage

$ cluttex -e pdflatex file.tex

More general form:

$ cluttex [OPTIONS] [--] INPUT.tex

See example/ for some examples.

Install

Click [Clone or download] button on GitHub and [Download ZIP]. Unpack cluttex-master.zip and copy bin/cluttex (or bin/cluttex.bat on Windows) to somewhere in PATH.

Command-line Options

  • -e, --engine=ENGINE Specify which TeX engine/format to use. ENGINE is one of the following: pdflatex, pdftex, lualatex, luatex, luajittex, xelatex, xetex, latex, etex, tex, platex, eptex, ptex, uplatex, euptex, uptex.
  • -o, --output=FILE The name of output file. [default: JOBNAME.FORMAT]
  • --fresh Clean intermediate files before running TeX. Cannot be used with --output-directory.
  • --max-iterations=N Maximum number of running TeX to resolve cross-references. [default: 3]
  • --[no-]change-directory Change the current working directory to the output directory when running TeX.
  • --watch[=ENGINE] Watch input files for change. Requires fswatch program or inotifywait program to be installed on Unix systems.
  • --color[=WHEN] Make ClutTeX's message colorful. WHEN is one of always, auto, or never. [default: auto if --color is omitted, always if =WHEN is omitted]
  • --includeonly=NAMEs Insert \includeonly{NAMEs}.
  • --make-depends=FILE Write dependencies as a Makefile rule.
  • --tex-option=OPTION Pass OPTION to TeX as a single option.
  • --tex-options=OPTIONs Pass OPTIONs to TeX as multiple options.
  • --dvipdfmx-option[s]=OPTION[s] Same for dvipdfmx.
  • -h, --help Print this message and exit.
  • -v, --version Print version information and exit.
  • -V, --verbose Be more verbose.
  • --print-output-directory Print the output directory and exit.
  • --package-support=PKG1[,PKG2,...,PKGn] Enable special support for shell-escaping packages. Currently supported packages are minted and epstopdf.
  • --engine-executable=COMMAND The actual TeX command to use.
  • --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:

  • --makeindex=COMMAND Use MakeIndex program to process .idx files. (e.g. --makeindex=makeindex, or --makeindex=mendex)
  • --bibtex=COMMAND Use BibTeX program to produce .bbl file from .aux files. (e.g. --bibtex=bibtex, or --bibtex=upbibtex)
  • --biber[=COMMAND] Use Biber program to produce .bbl file from .bcf file.
  • --makeglossaries[=COMMAND] Use makeglossaries program to produce .gls file from .glo file.

TeX-compatible options:

  • --[no-]shell-escape
  • --shell-restricted
  • --synctex=NUMBER
  • --[no-]file-line-error [default: yes]
  • --[no-]halt-on-error [default: yes]
  • --interaction=STRING (STRING=batchmode/nonstopmode/scrollmode/errorstopmode) [default: nonstopmode]
  • --jobname=STRING
  • --fmt=FORMAT
  • --output-directory=DIR [default: somewhere in the temporary directory]
  • --output-format=FORMAT Set output format (pdf or dvi). [default: pdf]

For TeX-compatible options, single-hypen forms are allowed (e.g. -synctex=1 in addition to --synctex=1).

If run as cllualatex or clxelatex, then the default engine is lualatex or xelatex, accordingly.

License

This program is distributed under GNU General Public License, version 3.

cluttex's People

Contributors

atticus-sullivan avatar gksato avatar minoki avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

cluttex's Issues

How is ClutTeX different from latexmk?

The latexmk command used to be the uniformly accepted "make" command for TeX. It does not seem to support makeglossaries, and still keeps all the files in the same directory.

Are these the only differences? Would it be possible to document how exactly cluttex improves over latemk?

Same color for EXEC and ERROR

こんにちは。最近ClutTeXを知って使ってみました。
使っていて気になったのですが、エスケープシーケンスによるカラー出力で、[EXEC]のメッセージと[ERROR]のメッセージはどちらも全く同じ色(赤)で出力されるようです。

別の色にした方がわかりやすいと思うのですが、どうでしょうか?

[Feature Request] Rerun BibTeX if bbl file has been outdated

現在のClutTeXの--bibtexオプションでは、BibTeXが再実行されるかはauxファイルが更新されたかどうか(?)で決まっているようです。
そのため、bibファイルのエントリの中身を変えるだけではBibTeXは再実行されず、古いbblが使われてしまいます。
なのでbibファイルのエントリを更新したときもBibTeXを再実行する機能が欲しいです。

BibTeXが再実行されるべきなのは、「LaTeXソースで使われているBibTeXエントリ」の中身が「書き変わった場合」ですが、これは大変なので、使われているbibファイルたちの更新日時とbblファイルの更新日時を比べてbblファイルが古ければBibTeXを再実行する、のが現実的な気がします。
ClutTeXの実装を見てみましたが、extract_bibtex_from_aux_fileでbibdataの中をパースしてbibファイル名を取り出してごにょごにょするのかなと思います。が、BIBINPUTSやbiberのことも考えると難しそうです...

makeglossaries with abbreviations/acronyms

--makeglossaries doesn't work with other extensions than .glo/.glg/.gls. Therefore, it can't be used for acronyms or other glossaries.

I'd work on this, but not right now. Just wanted to file this "bug/feature".

I'd have to read the glossaries documentation more carefully if there are some common extensions (I think so). Then maybe we should activate these by default and allow the user to add more extensions to it.

Plan: Rewrite in Standard ML

I think Lua is a good language for some little scripting, but not very good for a complex application like ClutTeX. I want to switch to a statically-typed language.

However, a Lua script has the advantage that it can easily be distributed with TeX Live (see Contributing packages - TeX Live - TeX Users Group).

Therefore, a transpiler from the statically-typed language to Lua is needed. There are some choices:

...but neither existed around 2020 (at least, I didn't know). So I created LunarML:

After several years of development, LunarML has become somewhat usable. So it is a good time to rewrite ClutTeX in Standard ML.

The plan is:

  1. Release ClutTeX v0.6 with already-merged and ongoing changes.
  2. Rewrite ClutTeX in Standard ML; this is being done in sml branch. Some parts will remain in Lua.
  3. Release LunarML v0.1 after confirming it is usable enough for ClutTeX's needs.
    • Hopefully, in 2023.
  4. Release ClutTeX v0.7, compiled with LunarML.

Expected backends for expl3 are no longer correct for XeTeX, PDFTeX, LuaTeX

I got a warning when I, with the latest TeX Live, ran

$ cluttex --engine=pdflatex

against a LaTeX file that has:

\usepackage{xparse}

The error message said

[DIAG] The driver option for expl3 is missing or wrong.
[DIAG] Consider setting 'driver=pdfmode' option when loading expl3.

However this warning is no longer valid since l3backend has received its updates and we have l3backend-pdftex.def, l3backend-luatex.def, and l3backend-xetex.def instead of l3backend-pdfmode.def and l3backend-xdvipdfmx.def. A pull request that will fix this will follow.

最新のTeX Live で expl3 を読み込む LaTex file を clpdflatex すると expl3 のドライバミスマッチエラーがでます.これは l3backend のドライバ名が pdfmode -> pdftex, luatex および
xdvipdfmx -> xetex と変わったためだと思われます.PR投げて修正しますが,Luaは不慣れなのでお助けいただけるとありがたいです.

available create option '--inputonly' as like as '--includeonly' ?

Is it possible to add an option similar to --includeonly called --inputonly?

cluttex supports \include with the "-includeonly" option,
but this primitive(?) has the side effect of page breaks.
To avoid this, I started to use 'source' instead of '\input'.
At the same time, I am beginning to wish there was a similar option called "--iinputonly"
as like as "--includeonly".

If possible, please consider it.

[Question] Add benchmarking

Hi,
I'm currently writing some sort of benchmarking feature which enables the user to see which sections take long time to compile (it is open what to do with that information, but I find it interesting to know which parts take a long time (except for the preamble parsing/loading which hardly can be measured) the overall compilation time is high).

For that purpose, one would need to add this snippet to the preamble

\usepackage{l3benchmark}
\newwrite\benchmarkOutput
\immediate\openout\benchmarkOutput=\jobname.time
\ExplSyntaxOn
\AddToHook{cmd/section/before}{\benchmark_toc:\immediate\write\myoutput{\thesection \g_benchmark_time_fp}\benchmark_tic:}
\benchmark_tic:
\ExplSyntaxOff

(see l3benchmark.pdf for reference)

This creates a new file which holds the benchmarking results and the corresponding section number (which can be resolved by the use of the .aux file to the section name (this is done with a simple lua function called in the end which just parses the files)).

Does someone have an idea how to inject this into the input tex file? (I think the alternative would be to display information to the user what to add to the preamble if the time file is too old or not present)

PS: Sorry for asking the question as an issue, but I didn't found another way to get in touch.

change-directory doesn't seem to be working correctly

Hi,
I've read that setting -output-directory for latex engines breaks many packages. So I thought of using cd instead of setting output-directory (in effect this should be similar to cd <dir> && <latex-engine> ... && cp <output-file> ../ instead of <latex-engine> -output-directory <dir> && cp <dir>/<output-file> ./).

Is this possible with the current set of options?

If not can one avoid that cluttex sets output-directory at all (so that cd etc can be handled by a Makefile on my own)?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.