属性被打印为 pgf-pie 中的文本,导致“字体 nullfont 中没有......!”错误

属性被打印为 pgf-pie 中的文本,导致“字体 nullfont 中没有......!”错误

pgf-pie让我头疼。

这是我的 LaTeX 代码:

\documentclass{article}
\usepackage{pgf-pie}

\begin{document}

\begin{tikzpicture}
\pie[color={black!10, black!20, black!30}]
    {62/\TeX\ Live and Mac\TeX,
     32/MiK\TeX\ and Pro\TeX t, 6/Other \TeX}
\end{tikzpicture}

\end{document}

我使用 MiKTeX 和 PdfLaTeX 作为我的 PDF 引擎,当我运行它时日志档案返回这些错误:

Missing character: There is no b in font nullfont!
Missing character: There is no l in font nullfont!
Missing character: There is no a in font nullfont!
Missing character: There is no c in font nullfont!
Missing character: There is no k in font nullfont!
Missing character: There is no ! in font nullfont!
Missing character: There is no 1 in font nullfont!
Missing character: There is no 0 in font nullfont!
Missing character: There is no b in font nullfont!
Missing character: There is no l in font nullfont!
Missing character: There is no a in font nullfont!
Missing character: There is no c in font nullfont!
Missing character: There is no k in font nullfont!
Missing character: There is no ! in font nullfont!
Missing character: There is no 2 in font nullfont!
Missing character: There is no 0 in font nullfont!
Missing character: There is no b in font nullfont!
Missing character: There is no l in font nullfont!
Missing character: There is no a in font nullfont!
Missing character: There is no c in font nullfont!
Missing character: There is no k in font nullfont!
Missing character: There is no ! in font nullfont!
Missing character: There is no 3 in font nullfont!
Missing character: There is no 0 in font nullfont!

PDF 如下所示:

以文本形式打印属性的饼图

对我来说,属性/选项似乎被意外地打印为文本。

我发现了类似的问题(例如tikzpicture 选项导致“字体 nullfont 中没有 [!”?),但这些都没有给我指明解决这个问题的方向。

更新:这个问题似乎是重复的。其中一个答案让我找到了这个问题的答案:使用 pgf-pie 包生成饼图时出现问题

这帮我解决了这个问题。

答案1

由于某种原因,pgf-pie 在一个地方输出颜色。您可以修补该命令。

但我不推荐这个软件包。它相当无情地重新定义了用户命令\color,因此必然会破坏其他代码。

\documentclass{article}
\usepackage{pgf-pie,etoolbox}
\makeatletter
\patchcmd\pgfpie@findColor{\thecolor \breakforeach }{\breakforeach}{}{\fail}
\makeatother
\begin{document}

\begin{tikzpicture}
\pie[color={red!10, black!20, black!30}]
    {62/\TeX\ Live Mac\TeX,
     32/MiK\TeX\ and Pro\TeX t, 6/Other \TeX}
\end{tikzpicture}

\end{document}

相关内容