Debian Codegraph @

texmf-dist/doc/latex/datatool/datatool-user-examples/datatool-user-example123.tex

raw
1 % This file is embedded in datatool-user.pdf version 3.4.3 2025-12-04
2 % Example 123 Pie Chart (Changing the Label Format)
3 % Label: "ex:piechartlabelfmt"
4 % arara: pdflatex
5 % arara: pdfcrop
6 \documentclass[12pt]{article}
7 \pagestyle{empty}
8 % sample CSV file:
9 \begin{filecontents}[noheader,overwrite]{fruit.csv}
10 Name,Quantity
11 "Apples",30
12 "Pears",25
13 "Lemons,Limes",40.5
14 "Peaches",34.5
15 "Cherries",20
16 \end{filecontents}
17
18
19 \usepackage{datapie}
20 % Load data from fruit.csv file:
21 \DTLsetup{store-datum,default-name=fruit}
22 \DTLread{fruit.csv}
23 % customize the label format:
24 \renewcommand{\DTLdisplayinnerlabel}[1]{%
25 \textcolor{lightgray}{\bfseries #1}%
26 }
27 \renewcommand{\DTLdisplayouterlabel}[1]{\textsf{#1}}
28 \begin{document}
29 \DTLpiechart
30 {
31 variable=\Quantity,
32 round=0,
33 inner-label=\DTLpiepercent\%,
34 outer-label=\Name\ (\DTLpievariable)
35 }
36 {fruit}% database
37 {\Quantity=Quantity,\Name=Name}
38 \end{document}