5 stable releases

1.4.0 Apr 18, 2024
1.3.0 Oct 29, 2023
1.2.3 Sep 7, 2023
1.2.2 Jul 4, 2023

#234 in Text processing

MIT license

26KB
579 lines

autotex Manual

autotex is a linux program that runs TeX and LaTeX continuously. For simple example, when

autotex testfile.tex

runs in bash (or zsh), pdfTeX runs once. This program is written in Rust.

Installation

It can be installed using cargo.

Using Cargo

git clone https://github.com/e0328eric/autotex.git
cd autotex
cargo install --path .

Usage

Run TeX Engines

Use --engine or -e option to specify TeX engines. For example, if you want to use plain TeX, type either

autotex -e tex testfile.tex
autotex --engine tex testfile.tex
autotex -e plaintex testfile.tex
autotex --engine plaintex testfile.tex

in the folder that contains a file to be compiled, then TeX runs and make testfile.dvi.

Option --engine can get pdftex, xetex, luatex, tex, plaintex, pdflatex, xelatex, lualatex and latex.

Another ways to use these options is use specific engine options. Below table shows flags for each engines.

TeX Related Engine Flag
pdftex -p
xetex -x
luatex -l
tex -t
pdflatex -pL
xelatex -xL
lualatex -lL
latex -L

For example, below arguments are identical:

autotex --engine xelatex testfile.tex
autotex -e xelatex testfile.tex
autotex -xL testfile.tex
autotex -Lx testfile.tex

If there is no options like

autotex testfile.tex

then pdfTeX runs in default.

Continuous Compiling

The option -c

Many people might want to run TeX engine continuously. This means that TeX engine runs if the compiled file is modified. There is an option what you want. If you run autotex like

autotex -c testfile.tex

then TeX engine runs (in this example, there is no engine options, so pdfTeX runs) and autotexwaits until thetestfile.tex` file is modified. If this file is modified, then TeX engine runs one more time.

If you want to do this with LuaLaTeX, then run like either

autotex -e lualatex -c testfile.tex

as we expected. Note that there is no order for options. So

autotex -c -e lualatex testfile.tex
autotex -ce lualatex testfile.tex
autotex -ec lualatex testfile.tex
autotex -lLc testfile.tex
autotex -clL testfile.tex

runs exactly same as in the previous example.

View Pdf

If the option -v is enabeled, then open a pdf viewer so that we can view the pdf that compiled from TeX file. Hence, the command, for instance,

autotex -vcpL testfile.tex

means that compile with pdflatex continuously and view the pdf file of it.

v0.2.0 upgrade part

autotex config

autotex can be configurable with yaml file. It must be placed in ~/.config/autotex and must have name with config.yaml. The example config is in below:

engine:
  main: pdflatex
pdf: zathura

In general, the command autotex FILENAME runs pdftex in default. However, if the config file is like in above, it runs pdflatex in default. pdf part gives the default pdf viewer. The default pdf viewer is xdg-open.

Dependencies

~1.4–9MB
~71K SLoC