Skip to content

ktex

Kleag's TeX tool: a complete LaTeX build, in one command, for any document, followed by a report of errors and warnings located as file:line.

ktex

This command:

  • runs the LaTeX passes (pdflatex, xelatex or lualatex) and the bibliography (Biber or BibTeX), either detected automatically or set in the configuration;
  • builds outside the sources, in a temporary directory specific to the document: no .aux, .log, .bbl… in your tree, including those of \included chapters;
  • replaces the final PDF atomically: the viewer never sees an empty or partial PDF, and a failed build leaves the previous PDF in place;
  • first removes .aux files truncated by an interrupted run (the cause of "File ended while scanning use of…" right at \begin{document});
  • at the end, whether the build succeeded or failed, writes a report that locates each problem in the right file, including \input/\included files, with hints.
===== ERRORS (1) =====
chapters/intro.tex:5: LaTeX Error: \begin{itemize} on input line 3 ended by \end{enumerate}.
    → \end{enumerate} ⟨here⟩
    ↳ \begin{itemize} probably opened at: chapters/intro.tex:3

With ktex -w, ktex keeps the PDF up to date: it rebuilds the document whenever one of its source files changes. This watch mode was inspired by texbuild, and the way it finds the files to watch (the .fls file written by TeX) by latexmk.

ktex only needs Python ≥ 3.11 and a TeX distribution (TeX Live, MiKTeX…) that provides the engines and tools you use. Its messages are in English, or in French when your locale is French (see Usage).

Install ktex Getting started