Basic Usage
Write a first document, turn it into a PDF, and read what mLaTeX tells you.
A first document
Write it
Save this as hello.tex:
\documentclass{article}
\title{Hello}
\author{Ada Lovelace}
\begin{document}
\maketitle
Hello, \LaTeX! Here is a formula: $e^{i\pi} + 1 = 0$.
\end{document}Set it
mlatex hello.texThis is mLaTeX 0.1.0.
hello.tex
Output written on hello.pdf (1 page, 20668 bytes).What you get
hello.pdf is written beside the document. That is the whole process: no second run, no BibTeX step, no auxiliary files to clean up.
Naming the document
Extensions
A document named without its extension is looked for as NAME.mtex, then NAME.tex, then NAME.bib:
mlatex hello.mtex and .tex
.mtex is mLaTeX's own extension. The language in it is the same LaTeX; use it for documents and packages written with mLaTeX's additions in mind, and .tex for anything you also compile with TeX.
A bibliography
A .bib file given as the document is set as a list of every entry it holds, which is a quick way to look a bibliography over. See Bibliographies.
Where the PDF goes
A folder and a name
mlatex --output-directory=out --job-name=final hello.texwrites out/final.pdf, creating out if needed.
No PDF at all
--draft-mode reads and sets the whole document, reporting every error, without writing a PDF at all.
Reading errors
Errors and where they are
A document with mistakes is still set as far as it can be, and the errors are listed with their line and column:
\documentclass{article}
\begin{document}
Before \nosuchcommand after.
\begin{itemize}
\item one
\end{enumerate}
\end{document}This is mLaTeX 0.1.0.
broken.tex
3:8: error (macro): Undefined control sequence \nosuchcommand
6:16: error (environment): \begin{itemize} ended by \end{enumerate}
Output written on broken.pdf (1 page, 4648 bytes).The messages use LaTeX's own words, so an error you know from LaTeX reads the same here. Troubleshooting explains each one.
With the file name
With --file-line-error, each message starts with its file name, the form editors and IDEs jump to:
broken.tex:3:8: error (macro): Undefined control sequence \nosuchcommandA PDF is still written
A PDF is written even when there are errors, so you can see what went wrong where. Add --halt-on-error to leave no PDF behind instead.
Exit status
The statuses
| Status | Meaning |
|---|---|
0 | The document was set with nothing reported |
1 | The document has an error, or could not be found or read |
2 | The command line itself was wrong, such as an unknown option |
Warnings
Warnings, such as an unknown package or a citation with no entry, are printed but do not change the status.
While you write
mlatex --watch --open hello.tex--watch
--watch sets the document again every time it is saved, until you stop it.
--open
--open shows the PDF in your system's viewer once it is written. Most viewers reload a PDF that changes on disk, so the two together give you a live preview.
How long it took
--time
mlatex --time hello.texTime
Finding the document and its assets 0.1 ms
Setting it and writing its PDF 4.7 ms
In all 4.9 ms--time-statistics
--time-statistics goes further and prints every stage of mLaTeX with its timing. See Performance.
Quiet runs
-q
-q (or --interaction=batch-mode) prints nothing but errors, which suits scripts and build systems.
Scripts written for pdfLaTeX
TeX's own spellings, such as -interaction=batchmode and -jobname, are accepted too, so a script written for pdfLaTeX runs unchanged. Every option is on the Command Line page.