tikz pgf - tikzpicture _There is no ... in font nullfont_, but no extraneous text - TeX - LaTeX Stack Exchange
tikz pgf - tikzpicture _There is no ... in font nullfont_, but no extraneous text - TeX - LaTeX Stack Exchange
While looking at the log file of my document, I see a lot of paired error message lines that look like this
(there might be slight inaccuracies, I am typing this on another computer for reasons I won't go into):
27
Missing character: There is no . in font nullfont!
Missing character: There is no 5 in font nullfont!
These occur together in pairs, always one that is a "." and one that is a "5", and always in that order.
Generally there are a handful of them together in one place. From other questions I have gleaned that this
error message generally occurs when extraneous text (i.e. text that is neither TikZ commands nor TeX
comments) is entered inside a tikzpicture environment. The places in the log file that these errors appear do
indeed appear to correspond to places where tikzpictures are found in my document. Moreover, bigger
collections of them generally seem to correspond to bigger tikzpictures (in the sense of more TikZ code).
However, as far as I can tell there is no extraneous text in my tikzpicture environments. In this question the
questioner was unwittingly causing this sort of error by putting two [] -delimited sets of options in the
same place, but I do not think that is what is happening here.
I can try to put together an example file later today, if that would be helpful. I say "try" because I don't know
for certain that I'll be able to create another, sufficiently small document that exhibits the same behaviour
(the document whose log file displays this issue is too large for posting it here, inline, to be practical.)
Update
It turns out this has something to do with code that was generously written for me by another TeX/LaTeX
Stack Exchange user, in response to another question I asked. As such, this is slightly embarrassing, because
it makes me look somewhat ungrateful if I point out defects (if indeed that is what this is) in something
someone gave me for free. But I didn't know that's what was going wrong before I asked the question. I'd be
interested to know what is going wrong though.
Anyway, if you compile the below example document (taken without modification from Qrrbrbirlbel's answer
By clicking “Accept all cookies”, you agree Stack Exchange
to the linked question) and look at the log afterwards, you will see these lines:
can store cookies on your device and disclose information in
accordance with our Cookie Policy.
Missing character: There is no . in font nullfont!
Missing
Accept allcharacter:
cookies ThereNecessary
is no 0 in font only
cookies nullfont!
Missing character: There is no . in font nullfont!
Missing character: There is no 0 in font nullfont!
Customize settings
Missing character: There is no . in font nullfont!
Missing character: There is no 0 in font nullfont!
Missing character: There is no . in font nullfont!
Missing character: There is no 0 in font nullfont!
\documentclass[tikz,border=2pt]{standalone}
\usepackage{tikz}
\usetikzlibrary{decorations.markings}
\makeatletter
\tikzset{nomorepostaction/.code = \let\tikz@postactions\pgfutil@empty}
\def\pgf@arrowset#1#2{%
\pgfutil@ifundefined{pgf@arrow@code@#2}
{\PackageError{pgf}{Arrow #1 type ``#2'' unknown}{}}
{%
\edef\pgf@arrow@temp{#2}%
\ifx\pgf@arrow@temp\pgfutil@empty% ah. clear!
\expandafter\let\csname pgf@#1arrow\endcsname=\pgfutil@empty%
\expandafter\let\csname pgf@shorten@#1\endcsname=\pgfutil@empty%
\else%
%\pgf@arrow@prepare{#2}%
\expandafter\def\csname pgf@#1arrow\endcsname{\multiply\pgflinewidth by
\pgflinewidth@arrow\relax\pgf@arrow@call{#2}}%
\expandafter\edef\csname pgf@shorten@#1\endcsname{\multiply\pgflinewidth by
\noexpand\pgflinewidth@arrow\relax\expandafter\noexpand\csname
pgf@arrow@right@#2\endcsname}%
\fi%
}%
}
\tikzset{
bigdiagramarrow/.style = {
-latex,
arrow thick
},
arrow line width/.code={
\pgfmathsetmacro\pgflinewidth@arrow{#1}
},
arrow line width=1,
arrow ultra thin/.style={arrow line width=0.25},
arrow very thin/.style={arrow line width=0.5},
arrow thin/.style={arrow line width=1},
arrow semithick/.style={arrow line width=1.5},
arrow thick/.style={arrow line width=2},
By clickingarrow
“Accept all cookies”,
very you agree Stackline
thick/.style={arrow Exchange
width=3},
can store cookies on your device and disclose information in
arrow ultra thick/.style={arrow line width=4},
accordance with our Cookie Policy.
}
\makeatother
\begin{document}
\begin{tikzpicture}
\node [draw] (A) at (0, 0) {$A$};
\node [draw] (B) at (0, 1) {$B$};
\node [draw] (C) at (2, 1) {$C$};
\draw [bigdiagramarrow] (A) to (B);
\draw [out = 0, in = 180][bigdiagramarrow] (A) to (C);
\end{tikzpicture}
\end{document}
Share Improve this question Follow edited Apr 13, 2017 at 12:34 asked Nov 30, 2013 at 15:00
Community Bot Hammerite
1 3,716 2 24 35
1 There is little chance we can help you unless you post a minimal working example (MWE) that reproduces the behaviour
you describe. – jub0bs Nov 30, 2013 at 15:30
I don't see any warnings. Which version of TikZ are you using? You can check it by putting \listfiles in your
preamble and then looking at your log file. – percusse Nov 30, 2013 at 20:48
There are several lines that seem relevant to TikZ/PGF. tikz.sty 2010/10/13 v2.10 (rcs-revision 1.76)
pgf.sty 2008/01/15 v2.10 (rcs-revision 1.12) pgfcore.sty 2010/04/11 v2.10 (rcs-revision 1.7) and
several others containing "pgf". – Hammerite Nov 30, 2013 at 21:11
1 I noticed warnings like this some years ago when trying to recreate tikz's own documentation. When I tracked them
down then, they corresponded to bugs in pgf code that used integer operations on decimals. In such operations, the "."
ends the integer and becomes ordinary text, as do the digits after the decimal. As do the letters "pt" if the number
happens to be a dimension. Tikz pictures switch to nullfont so extraneous spaces (and text) don't spoil the picture. – Dan
Dec 1, 2013 at 2:19
After testing your example, these warnings seem to be the result of the \multiply commands in the code of
\pgf@arrowset . The expression after by in a \multiply command must be an integer. If it expands to a
16 decimal number the . and the digits following are seen as text. The following changes should be made:
change
\multiply\pgflinewidth by \pgflinewidth@arrow\relax
to
By clicking “Accept all cookies”, you agree Stack Exchange
\pgflinewidth
can store = \pgflinewidth@arrow
cookies on your \pgflinewidth
device and disclose information in \relax
accordance with our Cookie Policy.
and
\multiply\pgflinewidth by \noexpand\pgflinewidth@arrow\relax
to
\pgflinewidth = \noexpand\pgflinewidth@arrow \pgflinewidth \relax
These use the fact that a dimension ( \pdflinewidth in this case) can be preceded by a factor (stored in the
macro \pgflinewidth@arrow in this case) to effect a multiplication. I don't know much about pgf, so I can't
say that this will be free of other problems.
I made these changes and the offending lines went away in the log file. I didn't see any side effects from the changes,
either in the posted example or in my main document, but I'll bear in mind the possibility that side effects might exist.
As it stands though, this seems to solve the problem. Cheers! – Hammerite Dec 1, 2013 at 11:49
If you take my tikz answer and add 0.5pt between the two \draw commands, you get no error, and the
output looks the same but the log warns:
33
Missing character: There is no 0 in font nullfont!
Missing character: There is no . in font nullfont!
Missing character: There is no 5 in font nullfont!
Missing character: There is no p in font nullfont!
Missing character: There is no t in font nullfont!
If you want to see where the error is, you can make \nullfont have the characters add
\font\nullfont=cmr10
Then again you get no error but this time no warning in the log, but the output is very messed up and you
can see the offending characters.
Share Improve this answer Follow edited Apr 13, 2017 at 12:35 answered Nov 30, 2013 at 17:09
Community Bot David Carlisle
1 798k 71 1.6k 2.5k
2 @DavidCarlisle, thanks for the reply. Now I'm more confused. When I see the "Missing character: There is no 0 in font
nullfont!" messages, does that mean there's an error in my code? Or is this just a bug in the tikz package which I have to
live with? – Jim Newton Aug 30, 2018 at 8:59
2 @JimNewton this specific case that I looked at 5 years ago, i have no idea, it's probably a bug that the characters are
there, but the tikz author explictly invokes nullfont with the documented reason that it avoids the need to catch
spurious characters (notably space) in some case. but it's not just tikz, any code has a right really to assume that
\nullfont gives a minimally valid font with no characters, as that is what the texbook say it does. – David Carlisle Aug
30, 2018 at 10:57
2 The redefinition trick saved my life: there was an extra ; in my tikz code that I couldn't find without that. Thanks.
– Anne Jun 21, 2019 at 14:53
4 \documentclass{standalone}
\usepackage{tikz}
\begin{document}
\tikz bad \node {good};
\end{document}
This produces the correct output as follows
but will also generate the following error message in the log
The error is due to orphan characters that do not belong to any TikZ command (in my above example the
three characters bad ).