comma separated decimal numbers in pgf-pie
Package pgf-pie
provides two hooks for printing the numbers: before number
and after number
. They define macros \beforenumber
and \afternumber
. The number is set as macro \p
between the two hooks. This can be used to smuggle in a macro, which grabs the number and passes it to a more powerful package for setting numbers, package siunitx
, for example:
\documentclass{article}
\usepackage{pgf-pie}
\usepackage{siunitx}
\sisetup{
output-decimal-marker={,},
group-separator={\,},
}
\def\ScanPercentage#1\afternumber{\SI{#1}{\percent}}
\begin{document}
\begin{tikzpicture}
\pie[
before number=\ScanPercentage,
after number={},
]{20.1/xxx,79.9/yyy}
\end{tikzpicture}
\end{document}