%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /data/old/usr/share/texlive/texmf-dist/tex/latex/datatool/
Upload File :
Create Path :
Current File : //data/old/usr/share/texlive/texmf-dist/tex/latex/datatool/datapie.sty

%%
%% This is file `datapie.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% datatool.dtx  (with options: `datapie.sty,package')
%% 
%%  datatool.dtx
%%  Copyright 2013 Nicola Talbot
%% 
%%  This work may be distributed and/or modified under the
%%  conditions of the LaTeX Project Public License, either version 1.3
%%  of this license of (at your option) any later version.
%%  The latest version of this license is in
%%    http://www.latex-project.org/lppl.txt
%%  and version 1.3 or later is part of all distributions of LaTeX
%%  version 2005/12/01 or later.
%% 
%%  This work has the LPPL maintenance status `maintained'.
%% 
%%  The Current Maintainer of this work is Nicola Talbot.
%% 
%%  This work consists of the files datatool.dtx and datatool.ins and the derived files datatool-base.sty, datatool-fp.sty, datatool-pgfmath.sty, datatool.sty, datagidx.sty, databib.sty, databar.sty, datapie.sty, dataplot.sty, person.sty, databib.bst.
%% 
%% \CharacterTable
%%  {Upper-case    \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
%%   Lower-case    \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
%%   Digits        \0\1\2\3\4\5\6\7\8\9
%%   Exclamation   \!     Double quote  \"     Hash (number) \#
%%   Dollar        \$     Percent       \%     Ampersand     \&
%%   Acute accent  \'     Left paren    \(     Right paren   \)
%%   Asterisk      \*     Plus          \+     Comma         \,
%%   Minus         \-     Point         \.     Solidus       \/
%%   Colon         \:     Semicolon     \;     Less than     \<
%%   Equals        \=     Greater than  \>     Question mark \?
%%   Commercial at \@     Left bracket  \[     Backslash     \\
%%   Right bracket \]     Circumflex    \^     Underscore    \_
%%   Grave accent  \`     Left brace    \{     Vertical bar  \|
%%   Right brace   \}     Tilde         \~}
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{datapie}[2013/01/15 v2.13 (NLCT)]
\RequirePackage{xkeyval}
\newif\ifDTLcolorpiechart
\DTLcolorpiecharttrue
\DeclareOption{color}{\DTLcolorpiecharttrue}
\DeclareOption{gray}{\DTLcolorpiechartfalse}
\define@boolkey{datapie}[DTL]{rotateinner}[true]{}
\define@boolkey{datapie}[DTL]{rotateouter}[true]{}
\DTLrotateinnerfalse
\DTLrotateouterfalse
\DeclareOption{rotateinner}{\DTLrotateinnertrue}
\DeclareOption{norotateinner}{\DTLrotateinnerfalse}
\DeclareOption{rotateouter}{\DTLrotateoutertrue}
\DeclareOption{norotateouter}{\DTLrotateouterfalse}
\ProcessOptions
\RequirePackage{datatool}
\RequirePackage{tikz}
\newlength\DTLradius
\DTLradius=2cm
\newcommand*{\DTLinnerratio}{0.5}
\newcommand*{\DTLouterratio}{1.25}
\newcommand*\DTLcutawayratio{0.2}
\newcommand*{\DTLstartangle}{0}
\newlength\dtl@inneroffset
\dtl@inneroffset=\DTLinnerratio\DTLradius
\newlength\dtl@outeroffset
\dtl@outeroffset=\DTLouterratio\DTLradius
\newlength\dtl@cutawayoffset
\dtl@cutawayoffset=\DTLcutawayratio\DTLradius
\newcommand*{\dtl@piecutaways}{}
\def\dtl@innerlabel{\DTLpievariable}%
\def\dtl@outerlabel{}%
\newcounter{DTLpieroundvar}
\setcounter{DTLpieroundvar}{1}
\newcommand*{\DTLdisplayinnerlabel}[1]{#1}
\newcommand*{\DTLdisplayouterlabel}[1]{#1}
\newcommand*{\DTLpiepercent}{%
\ifnum\dtlforeachlevel=0\relax
  \PackageError{datapie}{Can't use
  \string\DTLpiepercent\space outside
  \string\DTLpiechart}{}%
\else
  \csname dtl@piepercent@\romannumeral\@dtl@seg\endcsname
\fi}
\newcommand*{\DTLpieatbegintikz}{}
\newcommand*{\DTLpieatendtikz}{}
\newcommand*{\DTLsetpiesegmentcolor}[2]{%
\expandafter\def\csname dtlpie@segcol\romannumeral#1\endcsname{#2}%
}
\newcommand*{\DTLgetpiesegmentcolor}[1]{%
\csname dtlpie@segcol\romannumeral#1\endcsname}
\newcommand*{\DTLdopiesegmentcolor}[1]{%
\expandafter\color\expandafter
{\csname dtlpie@segcol\romannumeral#1\endcsname}}
\newcommand*{\DTLdocurrentpiesegmentcolor}{%
\ifnum\dtlforeachlevel=0\relax
  \PackageError{datapie}{Can't use
  \string\DTLdocurrentpiesegmentcolor\space outside
  \string\DTLpiechart}{}%
\else
  \expandafter\DTLdopiesegmentcolor\expandafter{%
  \csname c@DTLrow\romannumeral\dtlforeachlevel\endcsname}%
\fi}
\newcommand*{\DTLpieoutlinecolor}{black}
\newlength\DTLpieoutlinewidth
\DTLpieoutlinewidth=0pt
\ifDTLcolorpiechart
 \DTLsetpiesegmentcolor{1}{red}
 \DTLsetpiesegmentcolor{2}{green}
 \DTLsetpiesegmentcolor{3}{blue}
 \DTLsetpiesegmentcolor{4}{yellow}
 \DTLsetpiesegmentcolor{5}{magenta}
 \DTLsetpiesegmentcolor{6}{cyan}
 \DTLsetpiesegmentcolor{7}{orange}
 \DTLsetpiesegmentcolor{8}{white}
\else
 \DTLsetpiesegmentcolor{1}{black!15}
 \DTLsetpiesegmentcolor{2}{black!25}
 \DTLsetpiesegmentcolor{3}{black!35}
 \DTLsetpiesegmentcolor{4}{black!45}
 \DTLsetpiesegmentcolor{5}{black!55}
 \DTLsetpiesegmentcolor{6}{black!65}
 \DTLsetpiesegmentcolor{7}{black!75}
 \DTLsetpiesegmentcolor{8}{black!85}
\fi
\define@key{datapie}{start}{\def\DTLstartangle{#1}}
\define@key{datapie}{radius}{\DTLradius=#1\relax
\dtl@inneroffset=\DTLinnerratio\DTLradius
\dtl@outeroffset=\DTLouterratio\DTLradius
\dtl@cutawayoffset=\DTLcutawayratio\DTLradius}
\define@key{datapie}{innerratio}{%
\def\DTLinnerratio{#1}%
\dtl@inneroffset=\DTLinnerratio\DTLradius}
\define@key{datapie}{outerratio}{%
\def\DTLouterratio{#1}%
\dtl@outeroffset=\DTLouterratio\DTLradius}
\define@key{datapie}{cutawayratio}{%
\def\DTLcutawayratio{#1}%
\dtl@cutawayoffset=\DTLcutawayratio\DTLradius}
\define@key{datapie}{inneroffset}{%
\dtl@inneroffset=#1}
\define@key{datapie}{outeroffset}{%
\dtl@outeroffset=#1}
\define@key{datapie}{cutawayoffset}{%
\dtl@cutawayoffset=#1}
\define@key{datapie}{cutaway}{%
\renewcommand*{\dtl@piecutaways}{#1}}
\define@key{datapie}{variable}{%
\def\DTLpievariable{#1}}
\define@key{datapie}{innerlabel}{%
\def\dtl@innerlabel{#1}}
\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
}}
\newcommand*{\dtl@computeangles}[2]{%
\FPifgt{\@dtl@start}{180}%
  \let\dtl@old=\@dtl@start
  \FPsub{\@dtl@start}{\dtl@old}{360}%
\fi
\FPiflt{\@dtl@start}{-180}%
  \let\dtl@old=\@dtl@start
  \FPadd{\@dtl@start}{\dtl@old}{360}%
\fi
\expandafter\edef\csname dtl@sang@\romannumeral#1\endcsname{%
\@dtl@start}%
\FPmul{\dtl@angle}{360}{#2}%
\let\dtl@old=\dtl@angle
\FPdiv{\dtl@angle}{\dtl@old}{\dtl@total}%
\expandafter\let\csname dtl@angle@\romannumeral#1\endcsname=\dtl@angle
\let\dtl@old=\@dtl@start
\FPadd{\@dtl@start}{\dtl@old}{\dtl@angle}%
\expandafter\def\csname dtl@cut@angle@\romannumeral#1\endcsname{0}%
\expandafter\def\csname dtl@cut@len@\romannumeral#1\endcsname{0cm}%
}
\def\@dtl@set@off#1-#2\relax{%
\ifthenelse{\equal{#2}{}}{%
\@@dtl@set@off{#1}}{%
\@@dtl@set@offr#1-#2\relax}%
}
\newcommand*{\@@dtl@set@off}[1]{%
\edef\dtl@old{\csname dtl@angle@\romannumeral#1\endcsname}%
\FPmul{\dtl@angle}{\dtl@old}{0.5}%
\let\dtl@old=\dtl@angle
\edef\dtl@sang{\csname dtl@sang@\romannumeral#1\endcsname}%
\FPadd{\dtl@angle}{\dtl@old}{\dtl@sang}%
\expandafter\edef\csname dtl@cut@angle@\romannumeral#1\endcsname{%
\dtl@angle}%
\expandafter\edef\csname dtl@cut@len@\romannumeral#1\endcsname{%
  \the\dtl@cutawayoffset}
}
\newcount\@dtl@seg
\def\@@dtl@set@offr#1-#2-\relax{%
\ifnum#1>#2\relax
 \PackageError{datapie}{Segment ranges must go in ascending order}{%
Try #2-#1 instead of #1-#2}%
\else
 \def\dtl@angle{0}%
 \@dtl@seg=#1\relax
 \whiledo{\not\(\@dtl@seg > #2\)}{%
  \let\dtl@old=\dtl@angle
  \edef\dtl@segang{\csname dtl@angle@\romannumeral\@dtl@seg\endcsname}%
  \FPadd{\dtl@angle}{\dtl@old}{\dtl@segang}%
  \advance\@dtl@seg by 1\relax
 }%
 \let\dtl@old=\dtl@angle
 \FPmul{\dtl@angle}{\dtl@old}{0.5}%
 \edef\dtl@sang{\csname dtl@sang@\romannumeral#1\endcsname}%
 \let\dtl@old=\dtl@angle
 \FPadd{\dtl@angle}{\dtl@old}{\dtl@sang}%
 \@dtl@seg=#1\relax
 \whiledo{\not\(\@dtl@seg > #2\)}{%
 \expandafter
  \let\csname dtl@cut@angle@\romannumeral\@dtl@seg\endcsname
  =\dtl@angle
 \expandafter
  \edef\csname dtl@cut@len@\romannumeral\@dtl@seg\endcsname{%
  \the\dtl@cutawayoffset}
  \advance\@dtl@seg by 1\relax
 }%
\fi
}
\endinput
%%
%% End of file `datapie.sty'.

Zerion Mini Shell 1.0