Command-line tools#

texindent#

Indent code using texplain.indent().

usage: texindent [-h] [-v] files [files ...]

Positional Arguments#

files

TeX file(s) (changed in-place).

Named Arguments#

-v, --version

show program’s version number and exit

texplain#

Create a clean output directory with only included files/citations.

usage: texplain [-h] [-c] [-v] file outdir

Positional Arguments#

file

Main TeX file.

outdir

Output directory for formatted/included files.

Named Arguments#

-c, --keep-comments

Keep comments

Default: False

-v, --version

show program’s version number and exit

texcleanup#

Apply some simple clean-up rules. Most of the options are fully self explanatory, except for:

--replace-command

Replace a command by another command. This can also be ‘removing’ the command and keeping just a sequence of arguments. This option is very much like a LaTeX command, but applied to the source. For example:

--replace-command "{\TG}[2]" "#1"

Applies a change as follows:

>>> This is a \TG{text}{test}.
<<< This is a test.

Note that the number of arguments defaults to 1 (above [2] fixes 2 arguments). Finally, commented text is ignored.

usage: texcleanup [-h] [-c] [-C] [-r cmd def] [-l old new] [-f]
                  [-F PREPEND_FORMAT_LABELS] [-s] [-a] [--re-sub pattern repl]
                  [-v]
                  files [files ...]

Positional Arguments#

files

TeX file(s) (changed in-place).

Named Arguments#

-c, --remove-commentlines

Remove all lines that have only comments (excluding preamble).

Default: False

-C, --remove-comments

Remove all comments (excluding preamble).

Default: False

-r, --replace-command

Replace command (see above).

-l, --change-label

Rename a specific label.

-f, --format-labels

Automatically prepend labels with “fig:”, “eq:”, “tab:”, “sec:”, “ch:” (if needed).

Default: False

-F, --prepend-format-labels

Add ARG to labels (e.g. “fig:ARG:…”, “eq:ARG:…”; see --format-labels).

-s, --use-cleveref

Change “Fig.~ref{…}” etc. to “\cref{…}”.

Default: False

-a, --fix-quotes

Fix non-LaTeX quotation marks: “…” -> ``…’’

Default: False

--re-sub

Apply re.sub(pattern, repl, text).

-v, --version

show program’s version number and exit