# Problem generating pie chart with pgf-pie package

I am having troubles with TexStudio making pie charts with the pgf-pie package. I literally copied a fragment of this template: https://es.overleaf.com/latex/examples/drawing-pie-charts-with-pgf-pie/bjghbcfkrdvn

\documentclass{article}
\usepackage{pgf-pie}
\begin{document}
\begin{tikzpicture}
\pie{10/A, 20/B, 30/C, 40/D}
\end{tikzpicture}
\end{document}


The log only shows the following message: Overfull \hbox (1033.10823pt too wide) in paragraph

As you can see the result is not the expected one, first because it does not show any pie chard, and secondo of all it should be something like this (done through Overleaf):

Does anybody knows how to fix this error?

Thank you for reading and for your Help.

David.

• Just to add: I have already updated all MiKTeX packages, and reinstalled TeXstudio 2.12.14. I also try to compile the example in another computer, and It worked, but in mine, it does not. I also tried this tex.stackexchange.com/questions/378649/…, but the weird text is still there. – David Cano Jan 10 at 2:32
• it seems that pgf-pie is broken or not compatible anymore with recent tikz. – Zarko Jan 10 at 3:10
• (not only reinstalled TeXstudio but also MiKTeX, gsview and ghostscript). – David Cano Jan 10 at 3:42
• Zarko, the think is that the other computer where I tried the code, has the very same version of all (MiKTeK, GSview, Ghostscript and TeXStudio -including its profile-) and it gives still the same pdf file with the weird text. – David Cano Jan 10 at 4:04
• @AubreyBlumsohn Well, I'm not sure redefining \color, locally or not, is good practice ... Do a find&replace in pgf-pie.sty, replacing \color with e.g. \pie@color, and it works fine. I'll add a comment on the GitHub issue as well. – Torbjørn T. Jan 10 at 17:22

The problem seems to come from the \def\color inside the definition of \setcolor, though I can't give any details of what happens.

Anyways, replacing \color with something else, like \pgfpie@color in pgf-pie.sty appears to fix the problem. There are three occurrences, on lines 68, 133, and 235.

I made a pull request on GitHub implementing that, but I don't know if the author is still active, so cannot say whether a fix will make its way to CTAN.

If you don't want to edit the package file, you can do this:

\documentclass{article}
\usepackage{pgf-pie}
\usepackage{xpatch}
\makeatletter
\def\setcolor#1\pgfeov{\def\pgfpie@color{#1}}
\pgfkeyslet{/color/.@cmd}{\setcolor}
\xpatchcmd{\pgfpie@findColor}{\color}{\pgfpie@color}{}{}
\xpatchcmd{\pie}{\color}{\pgfpie@color}{}{}
\makeatother
\begin{document}
\begin{tikzpicture}
\pie{10/A, 20/B, 30/C, 40/D}
\end{tikzpicture}
\end{document}