Quantcast
Channel: Question and Answer » babel
Viewing all articles
Browse latest Browse all 75

How do I define a list of strings with the babel package and the ngerman option?

$
0
0

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

documentclass{article}
usepackage[ngerman]{babel}
usepackage{tikz}

definecolorseries{colorser}{rgb}{last}{blue}{green}

defpiechart#1#2#3#4#5{%1:data,2:numberOfElements,3:colors,4:outerRadius,5:labels
    resetcolorseries[#2]{#3}
    edefstartangle{90}
    foreach [
        remember=endangle as startangle,
        evaluate=i as endangle using {startangle-(csname#1endcsname[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#5endcsname[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];%
}

begin{document}

begin{tikzpicture}
    newcommandshares{{50,30,15,5}}
    newcommandlabels{{"a","b","c","d"}}
    piechart{shares}{4}{colorser}{2cm}{labels}
end{tikzpicture}

end{document}

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…


Viewing all articles
Browse latest Browse all 75

Trending Articles