I try to make a pie chart, but can't get the labels right: This is the MWE:



    \foreach [
        remember=\endangle as \startangle,
        evaluate=\i as \endangle using {\startangle-(\csname#1\endcsname[\i-1]/100*360)},
        evaluate=\halfangle using {(\endangle-\startangle)/2+\startangle},
    ] \i in {1,...,#2} {%
        \fill[{#3!![\i]}] (0,0) --++(\startangle:#4) arc (\startangle:\endangle:#4);
        \draw[white, line width=0.75mm](0,0)--++(\startangle:#4+0.1pt);
        \node at (\halfangle:#4) {\pgfmathparse{\csname#5\endcsname[\i-1]}\pgfmathresult};% With this line commented out there is no error...
    \draw[white,line width=0.75mm](0,0)--++(\startangle:#4);
    \fill[white](0,0)circle [radius=#4*0.4];%




This brings up the error

Argument of \language@active@arg" has an extra }. \par  ...piechart{shares}{4}{colorser}{2cm}{labels}

The output I hope for looks like that:

enter image description here

Without the labels, everything works...


The active " is a babel shorthand, TikZ library babel helps:

  • Well, I didn't expect this to come true that fast... Learned something already!! – caligula Jun 8 '15 at 7:14
  • For example that I can't use this library with TikZ/PGF < 3.0 :( see here – caligula Jun 8 '15 at 7:25

It turned out that this comes from the babel package: The double quotation marks aren't recognized correctly. \shorthandoff{"} is the key here:


Hope this helps someone, it cost me hours and hours. This helped me to find the solution and is slightly similar to this question, so I leave it up to you to mark this as duplicate or not. I think this question is the other way around and provides an error message that might be searched for...

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.