5

Please why does

\begin{document}
\begin{tikzpicture}
\foreach \x [remember=\x as \lastx (initially A)] in {B,...,H}{%
  $\overrightarrow{\lastx\x}$,
}
\end{tikzpicture}
\end{document}

give

Missing character: There is no , in font nullfont!

in the log file while in document body? Removing the comma (,) after $ relieves the warning.

  • 1
    It works for me. You probably need to update some packages. Please add \listfiles before \begin{document}, and post the file versions here. Alternatively, update your packages (and I hope you are not on a 2009 release). – Peter Grill Nov 14 '12 at 20:13
  • @PeterGrill There are no errors or warnings, the commas are missing in the output and the .log file shows the lines about Missing character quoted in the question. – Heiko Oberdiek Nov 14 '12 at 20:28
10

The tikzpicture environment is not intended to put bare text there. It resets the font to \nullfont. The text needs to be placed, for example, as node text.

If you just want to have the \foreach loop, then you do not need the tikzpicture:

\documentclass{article}
\usepackage{tikz}
\begin{document}
\foreach \x [remember=\x as \lastx (initially A)] in {B,...,H}{%
  $\overrightarrow{\lastx\x}$\if\x H\else, \fi
}
\end{document}

Result

| improve this answer | |
  • If you just want the \foreach loop with no tikzpictures in your document, you can use \usepackage{pgffor} instead of \usepackage{tikz}. – Ignasi Nov 15 '12 at 8:25
  • OK, thanks. I first observed the warning when using \newforeach in \tikzpicture environment. I thought it was due to a bug in \newforeach until I got it replicated by \foreach. – Ahmed Musa Nov 15 '12 at 20:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.