Deft Docs

LaTeX in Deft

What Deft does with LaTeX is on the LaTeX page; this one has the details. Compiling is in the desktop app; the phone and tablet apps show .tex files without compiling them.


Compiling


Press Ctrl+Enter (Cmd+Enter on a Mac), or choose Compile in the note’s menu. Deft saves every open file first, then shows the PDF in place of the text; Esc goes back. The PDF preview button beside the note shows the last PDF, and compiles again only after an edit made in Deft. After changing a file elsewhere, such as a figure, use Compile.


The PDF is kept in Deft’s own cache, not beside your files. Export PDF… in the note’s menu saves a copy where you choose, next to the main file unless you pick another place.


The bundled compiler or your own TeX


The bundled compiler, Tectonic, is based on XeTeX, so a few commands made for pdfTeX, such as \pdfglyphtounicode, don’t work under it.


To use a TeX Live, MacTeX or MiKTeX installation instead, open Settings › LaTeX, and in Compile With choose Choose latexmk…, then pick the latexmk program. Latexmk Engine below it picks pdfLaTeX, XeLaTeX or LuaLaTeX. A latexmkrc or .latexmkrc in the project’s folder is read too. Deft’s own options are passed after it, but an rc that redefines the command latexmk runs, such as $pdflatex, overrides Latexmk Engine.


Packages


To be asked before the bundled compiler downloads a package, set Tectonic Package Downloads in Settings › LaTeX to Ask first: Deft then compiles with what it has and asks only when a package is missing.


Projects of several files


Compiling any file of a document compiles it from its main file, which Deft finds this way:


  1. A % !TeX root = main.tex line in the first 20 lines of the open file, with the path relative to it.
  2. The open file, if it has a \documentclass line.
  3. The open file’s folder, or the nearest one above it inside the open folder, with a file that has one: main.tex first, then the first by name.


If none of these finds one, the file compiles on its own. A % !TeX root path outside the open folder is ignored.


A folder that holds a main file shows in the file list as one document. New LaTeX Project makes one to start from, with a main.tex and a refs.bib.


Bibliographies


The bundled compiler runs BibTeX by itself. It has no biber of its own: it uses one installed on your computer, if it’s on the path Deft was started with, and its version may not match the bundled biblatex. If a document needs biber and there is none, the Problems panel says so. latexmk runs BibTeX or biber as the document needs.


Errors


A problem’s line stays underlined in the text until the next compile. Compile log at the foot of the panel shows TeX’s own output, and Copy all problems in its right-click menu copies the list.