summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/datatool/datapie.sty
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/latex/datatool/datapie.sty')
-rw-r--r--Master/texmf-dist/tex/latex/datatool/datapie.sty272
1 files changed, 145 insertions, 127 deletions
diff --git a/Master/texmf-dist/tex/latex/datatool/datapie.sty b/Master/texmf-dist/tex/latex/datatool/datapie.sty
index b585b5456c3..c48d051638e 100644
--- a/Master/texmf-dist/tex/latex/datatool/datapie.sty
+++ b/Master/texmf-dist/tex/latex/datatool/datapie.sty
@@ -39,7 +39,7 @@
%% Grave accent \` Left brace \{ Vertical bar \|
%% Right brace \} Tilde \~}
\NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{datapie}[2013/01/15 v2.13 (NLCT)]
+\ProvidesPackage{datapie}[2013/06/28 v2.14 (NLCT)]
\RequirePackage{xkeyval}
\newif\ifDTLcolorpiechart
\DTLcolorpiecharttrue
@@ -153,132 +153,150 @@
\define@key{datapie}{outerlabel}{%
\def\dtl@outerlabel{#1}}
\newcommand*{\DTLpiechart}[4][\boolean{true}]{%
-{\let\DTLpievariable=\relax
-\setkeys{datapie}{#2}%
-\ifx\DTLpievariable\relax
- \PackageError{datapie}{\string\DTLpiechart\space missing variable}{}%
-\else
-\def\dtl@total{0}%
-\@sDTLforeach[#1]{#3}{#4}{%
-\let\dtl@oldtotal=\dtl@total
-\expandafter\DTLconverttodecimal\expandafter
- {\DTLpievariable}{\dtl@variable}%
-\FPadd{\dtl@total}{\dtl@variable}{\dtl@total}%
-}%
-\expandafter\DTLconverttodecimal\expandafter
- {\DTLstartangle}{\@dtl@start}%
-\@sDTLforeach[#1]{#3}{#4}{%
-\expandafter\DTLconverttodecimal\expandafter
- {\DTLpievariable}{\dtl@variable}%
-\dtl@computeangles{%
-\csname c@DTLrow\romannumeral\dtlforeachlevel\endcsname}{%
-\dtl@variable}%
-\expandafter\@dtl@seg\expandafter=
-\csname c@DTLrow\romannumeral\dtlforeachlevel\endcsname%
-\FPmul{\dtl@tmp}{\dtl@variable}{100}%
-\let\dtl@old=\dtl@tmp
-\FPdiv{\dtl@tmp}{\dtl@old}{\dtl@total}%
-\expandafter\FPround
-\csname dtl@piepercent@\romannumeral\@dtl@seg\endcsname\dtl@tmp
-\c@DTLpieroundvar
-}%
-\@for\dtl@row:=\dtl@piecutaways\do{%
-\expandafter\@dtl@set@off\dtl@row-\relax
-}%
-\let\dtl@start=\DTLstartangle
-\begin{tikzpicture}
-\DTLpieatbegintikz
-\@sDTLforeach[#1]{#3}{#4}{%
-\expandafter\@dtl@seg\expandafter=
-\csname c@DTLrow\romannumeral\dtlforeachlevel\endcsname%
-\edef\dtl@start{\csname dtl@sang@\romannumeral\@dtl@seg\endcsname}%
-\edef\dtl@extent{\csname dtl@angle@\romannumeral\@dtl@seg\endcsname}%
-\FPadd{\dtl@endangle}{\dtl@start}{\dtl@extent}%
-\edef\dtl@angle{\csname dtl@cut@angle@\romannumeral\@dtl@seg\endcsname}%
-\let\dtl@old=\dtl@angle
-\dtl@truncatedecimal\dtl@angle
-\ifnum\dtl@angle>180
- \FPsub{\dtl@angle}{\dtl@old}{360}%
- \dtl@truncatedecimal\dtl@angle
-\fi
-\edef\dtl@cutlen{%
-\csname dtl@cut@len@\romannumeral\@dtl@seg\endcsname}
-\edef\@dtl@shift{(\dtl@angle:\dtl@cutlen)}%
-\FPmul{\dtl@angle}{\dtl@extent}{0.5}%
-\FPadd{\dtl@midangle}{\dtl@angle}{\dtl@start}%
-\begin{scope}[shift={\@dtl@shift}]%
-\dtl@truncatedecimal\dtl@start
-\dtl@truncatedecimal\dtl@endangle
-\fill[color=\DTLgetpiesegmentcolor\@dtl@seg] (0,0) --
-(\dtl@start:\DTLradius)
-arc (\dtl@start:\dtl@endangle:\DTLradius) -- cycle;
-\ifdim\DTLpieoutlinewidth>0pt\relax
-\draw[color=\DTLpieoutlinecolor,line width=\DTLpieoutlinewidth]
-(0,0) -- (\dtl@start:\DTLradius)
-arc (\dtl@start:\dtl@endangle:\DTLradius) -- cycle;
-\fi
-\dtl@truncatedecimal\dtl@midangle
-\ifDTLrotateinner
-\ifthenelse{\(\dtl@midangle > 90 \and \dtl@midangle < 270\)
-\TE@or \dtl@midangle < -90}{%
- \FPsub{\dtl@labelangle}{\dtl@midangle}{180}%
- \dtl@truncatedecimal\dtl@labelangle
- \edef\dtl@innernodeopt{anchor=east,rotate=\dtl@labelangle}%
-}{%
- \edef\dtl@innernodeopt{anchor=west,rotate=\dtl@midangle}%
-}%
-\else
- \edef\dtl@innernodeopt{anchor=center}%
-\fi
-\ifDTLrotateouter
-\ifthenelse{\(\dtl@midangle > 90 \and \dtl@midangle < 270\)
-\TE@or \dtl@midangle < -90}{%
- \FPsub{\dtl@labelangle}{\dtl@midangle}{180}%
- \dtl@truncatedecimal\dtl@labelangle
- \edef\dtl@outernodeopt{anchor=east,rotate=\dtl@labelangle}%
-}{%
- \edef\dtl@outernodeopt{anchor=west,rotate=\dtl@midangle}%
-}%
-\else
- \ifthenelse{\(\dtl@midangle<45\and\dtl@midangle>-45\)
- \TE@or \dtl@midangle=45
- \TE@or \dtl@midangle>315}{%
- % east quadrant
- \edef\dtl@outernodeopt{anchor=west}%
- }{%
- \ifthenelse{\(\dtl@midangle<135\and\dtl@midangle>45\)
- \TE@or \dtl@midangle=135}{%
- % north quadrant
- \edef\dtl@outernodeopt{anchor=south}%
- }{%
- \ifthenelse{\(\dtl@midangle<225\and\dtl@midangle>135\)
- \TE@or \dtl@midangle=225
- \TE@or \dtl@midangle=-135
- \TE@or \dtl@midangle<-135}{%
- % west quadrant
- \edef\dtl@outernodeopt{anchor=east}%
- }{%
- \edef\dtl@outernodeopt{anchor=north}%
- }%
- }
- }
-\fi
-\edef\@dtl@dolabel{%
-\noexpand\draw (\dtl@midangle:\the\dtl@inneroffset)
-node[\dtl@innernodeopt]{%
-\noexpand\DTLdisplayinnerlabel{\noexpand\dtl@innerlabel}};}%
-\@dtl@dolabel
-\edef\@dtl@dolabel{%
-\noexpand\draw (\dtl@midangle:\the\dtl@outeroffset)
-node[\dtl@outernodeopt]{%
-\noexpand\DTLdisplayouterlabel{\noexpand\dtl@outerlabel}};}%
-\@dtl@dolabel
-\end{scope}
-}%
-\DTLpieatendtikz
-\end{tikzpicture}
-\fi
-}}
+\bgroup
+ \let\DTLpievariable=\relax
+ \setkeys{datapie}{#2}%
+ \ifx\DTLpievariable\relax
+ \PackageError{datapie}%
+ {\string\DTLpiechart\space missing variable}{}%
+ \else
+ \def\dtl@total{0}%
+ \@sDTLforeach[#1]{#3}{#4}{%
+ \let\dtl@oldtotal=\dtl@total
+ \expandafter\DTLconverttodecimal\expandafter
+ {\DTLpievariable}{\dtl@variable}%
+ \FPadd{\dtl@total}{\dtl@variable}{\dtl@total}%
+ }%
+ \expandafter\DTLconverttodecimal\expandafter
+ {\DTLstartangle}{\@dtl@start}%
+ \@sDTLforeach[#1]{#3}{#4}{%
+ \expandafter\DTLconverttodecimal\expandafter
+ {\DTLpievariable}{\dtl@variable}%
+ \dtl@computeangles{%
+ \csname c@DTLrow\romannumeral\dtlforeachlevel\endcsname}{%
+ \dtl@variable}%
+ \expandafter\@dtl@seg\expandafter=
+ \csname c@DTLrow\romannumeral\dtlforeachlevel\endcsname%
+ \FPmul{\dtl@tmp}{\dtl@variable}{100}%
+ \let\dtl@old=\dtl@tmp
+ \FPdiv{\dtl@tmp}{\dtl@old}{\dtl@total}%
+ \expandafter\FPround
+ \csname dtl@piepercent@\romannumeral\@dtl@seg\endcsname\dtl@tmp
+ \c@DTLpieroundvar
+ }%
+ \@for\dtl@row:=\dtl@piecutaways\do{%
+ \expandafter\@dtl@set@off\dtl@row-\relax
+ }%
+ \let\dtl@start=\DTLstartangle
+ \begin{tikzpicture}
+ \DTLpieatbegintikz
+ \@sDTLforeach[#1]{#3}{#4}%
+ {%
+ \expandafter\@dtl@seg\expandafter=
+ \csname c@DTLrow\romannumeral\dtlforeachlevel\endcsname%
+ \edef\dtl@start{%
+ \csname dtl@sang@\romannumeral\@dtl@seg\endcsname}%
+ \edef\dtl@extent{%
+ \csname dtl@angle@\romannumeral\@dtl@seg\endcsname}%
+ \FPadd{\dtl@endangle}{\dtl@start}{\dtl@extent}%
+ \edef\dtl@angle{%
+ \csname dtl@cut@angle@\romannumeral\@dtl@seg\endcsname}%
+ \let\dtl@old=\dtl@angle
+ \dtl@truncatedecimal\dtl@angle
+ \ifnum\dtl@angle>180\relax
+ \FPsub{\dtl@angle}{\dtl@old}{360}%
+ \dtl@truncatedecimal\dtl@angle
+ \fi
+ \edef\dtl@cutlen{%
+ \csname dtl@cut@len@\romannumeral\@dtl@seg\endcsname
+ }%
+ \edef\@dtl@shift{(\dtl@angle:\dtl@cutlen)}%
+ \FPmul{\dtl@angle}{\dtl@extent}{0.5}%
+ \FPadd{\dtl@midangle}{\dtl@angle}{\dtl@start}%
+ \begin{scope}[shift={\@dtl@shift}]%
+ \dtl@truncatedecimal\dtl@start
+ \dtl@truncatedecimal\dtl@endangle
+ \fill[color=\DTLgetpiesegmentcolor\@dtl@seg] (0,0) --
+ (\dtl@start:\DTLradius)
+ arc (\dtl@start:\dtl@endangle:\DTLradius) -- cycle;
+ \ifdim\DTLpieoutlinewidth>0pt\relax
+ \draw[color=\DTLpieoutlinecolor,%
+ line width=\DTLpieoutlinewidth]
+ (0,0) -- (\dtl@start:\DTLradius)
+ arc (\dtl@start:\dtl@endangle:\DTLradius) -- cycle;
+ \fi
+ \dtl@truncatedecimal\dtl@midangle
+ \ifDTLrotateinner
+ \ifthenelse{\(\dtl@midangle > 90 \and \dtl@midangle < 270\)
+ \TE@or \dtl@midangle < -90}%
+ {%
+ \FPsub{\dtl@labelangle}{\dtl@midangle}{180}%
+ \dtl@truncatedecimal\dtl@labelangle
+ \edef\dtl@innernodeopt{anchor=east,rotate=\dtl@labelangle}%
+ }%
+ {%
+ \edef\dtl@innernodeopt{anchor=west,rotate=\dtl@midangle}%
+ }%
+ \else
+ \edef\dtl@innernodeopt{anchor=center}%
+ \fi
+ \ifDTLrotateouter
+ \ifthenelse{\(\dtl@midangle > 90 \and \dtl@midangle < 270\)
+ \TE@or \dtl@midangle < -90}%
+ {%
+ \FPsub{\dtl@labelangle}{\dtl@midangle}{180}%
+ \dtl@truncatedecimal\dtl@labelangle
+ \edef\dtl@outernodeopt{anchor=east,rotate=\dtl@labelangle}%
+ }%
+ {%
+ \edef\dtl@outernodeopt{anchor=west,rotate=\dtl@midangle}%
+ }%
+ \else
+ \ifthenelse{\(\dtl@midangle<45\and\dtl@midangle>-45\)
+ \TE@or \dtl@midangle=45
+ \TE@or \dtl@midangle>315}%
+ {%
+ \edef\dtl@outernodeopt{anchor=west}%
+ }%
+ {%
+ \ifthenelse{\(\dtl@midangle<135\and\dtl@midangle>45\)
+ \TE@or \dtl@midangle=135}%
+ {%
+ \edef\dtl@outernodeopt{anchor=south}%
+ }%
+ {%
+ \ifthenelse{\(\dtl@midangle<225\and\dtl@midangle>135\)
+ \TE@or \dtl@midangle=225
+ \TE@or \dtl@midangle=-135
+ \TE@or \dtl@midangle<-135}%
+ {%
+ \edef\dtl@outernodeopt{anchor=east}%
+ }%
+ {%
+ \edef\dtl@outernodeopt{anchor=north}%
+ }%
+ }%
+ }%
+ \fi
+ \edef\@dtl@dolabel{%
+ \noexpand\draw (\dtl@midangle:\the\dtl@inneroffset)
+ node[\dtl@innernodeopt]{%
+ \noexpand\DTLdisplayinnerlabel{\noexpand\dtl@innerlabel}};
+ }%
+ \@dtl@dolabel
+ \edef\@dtl@dolabel{%
+ \noexpand\draw (\dtl@midangle:\the\dtl@outeroffset)
+ node[\dtl@outernodeopt]{%
+ \noexpand\DTLdisplayouterlabel{\noexpand\dtl@outerlabel}};
+ }%
+ \@dtl@dolabel
+ \end{scope}%
+ }%
+ \DTLpieatendtikz
+ \end{tikzpicture}%
+ \fi
+\egroup
+}
\newcommand*{\dtl@computeangles}[2]{%
\FPifgt{\@dtl@start}{180}%
\let\dtl@old=\@dtl@start