Command Line

Every option of the mlatex program, with examples.

mlatex [options] [document]

mlatex sets one document into a PDF.

The document

Naming the document

A document named without an extension is looked for as NAME.mtex, then NAME.tex, then NAME.bib:

mlatex paper          # paper.mtex, or paper.tex, or paper.bib

A bibliography as the document

A .bib file given as the document is set as a list of every entry it holds, cited or not. See Bibliographies.

No document

With no document named, mLaTeX's own sample paper is set.


Writing options

Dashes

Options take one dash or two: -interaction=batch-mode and --interaction=batch-mode are the same.

Values

A value follows its option after = or as the next argument: -o out and --output-directory=out are the same. The logger's options, --log-level and --log-file, take their value only after =.

TeX's spellings

Names are words with dashes between them. TeX's run-together spellings, -jobname, -draftmode and batchmode, are accepted too, so scripts written for pdfLaTeX run unchanged.

Ending the options

-- ends the options, for a document whose name starts with a dash:

mlatex -- -draft.tex

Output

mlatex -o build -j final thesis.tex          # build/final.pdf

-o, --output-directory

--output-directory=DIR writes the PDF into DIR, creating it if needed. Without it, the PDF goes beside the document.

-j, --job-name

--job-name=NAME names the PDF NAME.pdf instead of after the document. TeX's -jobname works too.

-n, --draft-mode

--draft-mode reads and sets the document, reporting every error, but writes no PDF. It is the quickest way to check a document. TeX's -draftmode works too.

--halt-on-error

--halt-on-error leaves no PDF when the document has an error. Without it, a PDF of what could be set is still written.

-O, --open

--open shows the PDF in the system's viewer once it is written.


Input

mlatex -I chapters -I figures --watch --open thesis.tex

-I, --include-directory

--include-directory=DIR also looks in DIR, after the document's own folder, for what the document reads: \input, \include, \usepackage, \includegraphics and bibliographies. Give it again for more folders; they are searched in order.

--assets

--assets=DIR reads the fonts and hyphenation patterns from DIR instead of the assets folder found above the program. See Installation.

--offline

--offline makes no network requests. \httpget, \httppost and pictures from https:// addresses become errors, and nothing is sent. Use it for documents you did not write; see Security.

-w, --watch

--watch sets the document again each time it is saved, until interrupted with Ctrl+C.


Messages

-i, --interaction

--interaction=MODE chooses how much is printed:

ModePrints
batch-modeNothing but errors.
non-stop-modeWhat was done, and errors.
scroll-modeThe same.
error-stop-modeThe same.

TeX's batchmode, nonstopmode, scrollmode and errorstopmode work too. mLaTeX never stops to ask a question, whatever the mode.

-q, --quiet

--quiet is the same as --interaction=batch-mode.

--file-line-error

--file-line-error prints each error as file:line:column: message, the form editors and build tools understand:

paper.tex:7:17: error (primitive): \includegraphics could not read 'nopicture.png'

-T, --time

--time prints how long each part of the run took.

--time-statistics

--time-statistics prints every stage of mLaTeX, what it made and how long each stage took. See Performance.

-h, --help

--help prints the options and exits.

-v, --version

--version prints the version and exits.


Diagnostics

These are for investigating mLaTeX itself rather than a document.

-d, --debug

--debug logs mLaTeX's steps. --debug=PARTS logs only the parts named, among lexer, mouth, parser, layout, memory and semantics:

mlatex --debug=lexer,parser paper.tex

--trace

--trace logs every step, in full.

--log-level

--log-level=LEVEL is one of traceback, debug, info, warn, error or silent. The value must follow =.

--log-file

--log-file=FILE writes the log to FILE. The value must follow =.

--no-color

--no-color logs without colour.


Target

-t, --target

--target=TARGET says what the document is made into:

TargetWhat it makes
aotA PDF, now. The default.
jitJust in time. Accepted, and does nothing yet.

Any other target is a command-line error (exit status 2). WebAssembly is not a target; it is a separate build of mLaTeX, see JavaScript.


Exit status

StatusMeaning
0The document was set with nothing reported. Warnings do not count.
1The document had an error, or could not be found, read, or given its assets.
2The command line was wrong: an unknown option, a missing value, a folder that does not exist, or two documents.

Recipes

mlatex -q --halt-on-error --file-line-error paper.tex

Quiet, no PDF on error, and errors in the form editors understand.

mlatex --watch --open paper.tex

Sets the document on every save and opens the PDF once; most viewers reload it when it changes.

mlatex -q -o out paper.tex && test -f out/paper.pdf

The exit status is 0 only for a clean document.

mlatex -q --offline --halt-on-error upload.tex

No network access, and nothing written but the PDF. See Security.