LaTeX warning "Missing character: There is no L in font nullfont!": cause and fix
TeX was asked to print a character that the current font does not contain. It leaves the character out and writes this line to the log. No error stops the run, so the gap in the PDF is easy to overlook.
Why it happens
- Text stands directly inside a
tikzpicture, outside a node. TikZ switches to an empty font namednullfontthere, so stray text is dropped. - A TikZ path lacks its command, as in
(0,0) -- (2,0);without\draw. Every character of that line is reported. - With LuaLaTeX, the font has no glyph for a character, for example for Cyrillic letters in the default font Latin Modern. The message then names the character and its Unicode number.
\symbol{...}asks for a position the font does not fill, such as\symbol{200}in the default font of pdfLaTeX.
How to fix it
- Put text in a picture into a node:
\node at (1,0.3) {Label};. - Begin every TikZ path with a command such as
\drawor\nodeand end it with;. - With LuaLaTeX, choose an installed font that contains the characters, using
fontspec:\setmainfont{DejaVu Serif}. - Search the log for
Missing characterafter a run. To turn the warning into an error, set\tracinglostchars=3in the preamble.
A document that produces the message
\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\draw (0,0) -- (2,0);
Label
\end{tikzpicture}
\end{document}The corrected document
\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\draw (0,0) -- (2,0);
\node at (1,0.3) {Label};
\end{tikzpicture}
\end{document}Both documents were compiled with pdfLaTeX from TeX Live 2023. The first produces the message, the second compiles without an error.
Finding the line in the editor
The editor lists every error and warning of a compile run with file and line. Select an entry and the cursor jumps to that line. See Error list with jump to the line.
Related pages
- Error Unicode character α (U+03B1) not set up for use with LaTeX
- Package
tikz - Package
fontspec - How-to Draw with TikZ in LaTeX