[Tex/LaTex] tikzpicture “There is no … in font nullfont”, but no extraneous text

errorsloggingtikz-pgf

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):

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 to the linked question) and look at the log afterwards, you will see these lines:

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!
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!

(Why is it a 0 instead of a 5 this time? I don't know.)

\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},
    arrow very thick/.style={arrow line width=3},
    arrow ultra thick/.style={arrow line width=4},
}
\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}

Best Answer

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 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

\pgflinewidth = \pgflinewidth@arrow \pgflinewidth \relax

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.