From fe752bd7396fcc8c6fb65128bcd481a5e326e7cd Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Fri, 24 Aug 2007 18:43:05 +0000 Subject: datatool 1.01 (20aug07) git-svn-id: svn://tug.org/texlive/trunk@4804 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/tex/latex/datatool/databar.sty | 803 +++++ Master/texmf-dist/tex/latex/datatool/databib.sty | 1529 ++++++++++ Master/texmf-dist/tex/latex/datatool/datapie.sty | 351 +++ Master/texmf-dist/tex/latex/datatool/dataplot.sty | 917 ++++++ Master/texmf-dist/tex/latex/datatool/datatool.sty | 3318 +++++++++++++++++++++ 5 files changed, 6918 insertions(+) create mode 100644 Master/texmf-dist/tex/latex/datatool/databar.sty create mode 100644 Master/texmf-dist/tex/latex/datatool/databib.sty create mode 100644 Master/texmf-dist/tex/latex/datatool/datapie.sty create mode 100644 Master/texmf-dist/tex/latex/datatool/dataplot.sty create mode 100644 Master/texmf-dist/tex/latex/datatool/datatool.sty (limited to 'Master/texmf-dist/tex/latex/datatool') diff --git a/Master/texmf-dist/tex/latex/datatool/databar.sty b/Master/texmf-dist/tex/latex/datatool/databar.sty new file mode 100644 index 00000000000..63b5f505912 --- /dev/null +++ b/Master/texmf-dist/tex/latex/datatool/databar.sty @@ -0,0 +1,803 @@ +%% +%% This is file `databar.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% datatool.dtx (with options: `databar.sty,package') +%% +%% datatool.dtx +%% Copyright 2007 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.sty, datapie.sty, dataplot.sty, databar.sty, databib.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{databar}[2007/08/17 v1.01 (NLCT)] +\RequirePackage{xkeyval} +\RequirePackage{dataplot} +\newif\ifDTLcolorbarchart +\DTLcolorbarcharttrue +\DeclareOption{color}{\DTLcolorbarcharttrue} +\DeclareOption{gray}{\DTLcolorbarchartfalse} +\newcommand*{\DTLbarXlabelalign}{left,rotate=-90} +\newcommand*{\DTLbarYticklabelalign}{right} +\define@boolkey{databar}[DTL]{verticalbars}[true]{% +\ifDTLverticalbars + \def\DTLbarXlabelalign{left,rotate=-90}% + \def\DTLbarYticklabelalign{right} +\else + \def\DTLbarXlabelalign{right}% + \def\DTLbarYticklabelalign{center} +\fi} +\DTLverticalbarstrue +\DeclareOption{vertical}{\DTLverticalbarstrue + \def\DTLbarXlabelalign{left,rotate=-90}% + \def\DTLbarYticklabelalign{right} +} +\DeclareOption{horizontal}{\DTLverticalbarsfalse + \def\DTLbarXlabelalign{right}% + \def\DTLbarYticklabelalign{center} +} +\ProcessOptions +\RequirePackage{datatool} +\RequirePackage{tikz} +\newlength\DTLbarchartlength +\DTLbarchartlength=3in +\newlength\DTLbarwidth +\DTLbarwidth=1cm +\newlength\DTLbarlabeloffset +\setlength\DTLbarlabeloffset{10pt} +\newcommand*{\DTLBarXAxisStyle}{-} +\newcommand*{\DTLBarYAxisStyle}{-} +\newcounter{DTLbarroundvar} +\setcounter{DTLbarroundvar}{1} +\newcommand*{\DTLbardisplayYticklabel}[1]{#1} +\newcommand*{\DTLdisplaylowerbarlabel}[1]{#1} +\newcommand*{\DTLdisplaylowermultibarlabel}[1]{#1} +\newcommand*{\DTLdisplayupperbarlabel}[1]{#1} +\newcommand*{\DTLdisplayuppermultibarlabel}[1]{#1} +\newcommand*{\DTLbaratbegintikz}{} +\newcommand*{\DTLbaratendtikz}{} +\newif\ifDTLbarxaxis +\newif\ifDTLbaryaxis +\newif\ifDTLbarytics +\newcount\@dtl@barcount +\newcommand*{\DTLsetbarcolor}[2]{% +\expandafter\def\csname dtlbar@segcol\romannumeral#1\endcsname{#2}% +} +\newcommand*{\DTLgetbarcolor}[1]{% +\csname dtlbar@segcol\romannumeral#1\endcsname} +\newcommand*{\DTLdobarcolor}[1]{% +\expandafter\color\expandafter +{\csname dtlbar@segcol\romannumeral#1\endcsname}} +\newcommand*{\DTLdocurrentbarcolor}{% +\ifnum\dtlforeachlevel=0\relax + \PackageError{databar}{Can't use + \string\DTLdocurrentbarcolor\space outside + \string\DTLbarchart}{}% +\else + \expandafter\DTLdobarcolor\expandafter{% + \csname c@DTLrow\romannumeral\dtlforeachlevel\endcsname}% +\fi} +\newcommand*{\DTLbaroutlinecolor}{black} +\newlength\DTLbaroutlinewidth +\DTLbaroutlinewidth=0pt +\ifDTLcolorbarchart + \DTLsetbarcolor{1}{red} + \DTLsetbarcolor{2}{green} + \DTLsetbarcolor{3}{blue} + \DTLsetbarcolor{4}{yellow} + \DTLsetbarcolor{5}{magenta} + \DTLsetbarcolor{6}{cyan} + \DTLsetbarcolor{7}{orange} + \DTLsetbarcolor{8}{white} +\else + \DTLsetbarcolor{1}{black!15} + \DTLsetbarcolor{2}{black!25} + \DTLsetbarcolor{3}{black!35} + \DTLsetbarcolor{4}{black!45} + \DTLsetbarcolor{5}{black!55} + \DTLsetbarcolor{6}{black!65} + \DTLsetbarcolor{7}{black!75} + \DTLsetbarcolor{8}{black!85} +\fi +\define@key{databar}{max}{\def\DTLbarmax{#1}} +\define@key{databar}{length}{\DTLbarchartlength=#1\relax +} +\define@key{databar}{maxdepth}{% +\ifnum#1>0\relax + \PackageError{databar}{depth must be zero or negative}{}% +\else + \def\DTLnegextent{#1}% +\fi} +\define@choicekey{databar}{axes}[\var\nr]{both,x,y,none}{% +\ifcase\nr\relax + % both + \DTLbarxaxistrue + \DTLbaryaxistrue + \DTLbaryticstrue +\or + % x only + \DTLbarxaxistrue + \DTLbaryaxisfalse + \DTLbaryticsfalse +\or + % y only + \DTLbarxaxisfalse + \DTLbaryaxistrue + \DTLbaryticstrue +\or + % neither + \DTLbarxaxisfalse + \DTLbaryaxisfalse + \DTLbaryticsfalse +\fi +} +\define@key{databar}{variable}{% +\def\DTLbarvariable{#1}} +\define@key{databar}{variables}{% +\def\dtlbar@variables{#1}} +\define@key{databar}{barwidth}{\setlength{\DTLbarwidth}{#1}} +\define@key{databar}{barlabel}{% +\def\dtl@barlabel{#1}} +\def\dtl@barlabel{} +\define@key{databar}{multibarlabels}{% +\def\dtl@multibarlabels{#1}} +\def\dtl@multibarlabels{} +\define@key{databar}{groupgap}{\def\dtlbar@groupgap{#1}} +\def\dtlbar@groupgap{1} +\define@key{databar}{upperbarlabel}{% +\def\dtl@upperbarlabel{#1}} +\def\dtl@upperbarlabel{} +\define@key{databar}{uppermultibarlabels}{% +\def\dtl@uppermultibarlabels{#1}} +\def\dtl@uppermultibarlabels{} +\define@key{databar}{yticpoints}{% +\def\dtlbar@yticlist{#1}\DTLbaryticstrue\DTLbaryaxistrue} +\let\dtlbar@yticlist=\relax +\define@key{databar}{yticgap}{% +\def\dtlbar@yticgap{#1}\DTLbaryticstrue\DTLbaryaxistrue} +\let\dtlbar@yticgap=\relax +\define@key{databar}{yticlabels}{% +\def\dtlbar@yticlabels{#1}\DTLbaryticstrue\DTLbaryaxistrue} +\let\dtlbar@yticlabels=\relax +\define@key{databar}{ylabel}{% +\def\dtlbar@ylabel{#1}} +\let\dtlbar@ylabel=\relax +\newcommand*{\DTLbarchart}[4][\boolean{true}]{% +{\let\DTLbarvariable=\relax +\let\DTLbarmax=\relax +\let\DTLnegextent=\relax +\disable@keys{databar}{variables,multibarlabels,% +uppermultibarlabels,groupgap}% +\setkeys{databar}{#2}% +\ifx\DTLbarvariable\relax + \PackageError{databar}{\string\DTLbarchart\space missing variable}{}% +\else + \ifx\DTLbarmax\relax + \@sDTLforeach[#1]{#3}{#4}{% + \expandafter\DTLconverttodecimal\expandafter + {\DTLbarvariable}{\dtl@barvar}% + \ifx\DTLbarmax\relax + \let\DTLbarmax=\dtl@barvar + \else + \let\dtl@old=\DTLbarmax + \FPmax{\DTLbarmax}{\dtl@old}{\dtl@barvar}% + \fi + }% + \ifx\dtlbar@yticgap\relax + \else + \let\dtl@thistick=\dtlbar@yticgap% + \whiledo{\DTLisFPopenbetween{\dtl@thistick}{0}{\DTLbarmax}}{% + \FPadd{\dtl@thistick}{\dtl@thistick}{\dtlbar@yticgap}% + }% + \let\DTLbarmax=\dtl@thistick + \fi + \fi + \ifx\DTLnegextent\relax + \def\DTLnegextent{0}% + \@sDTLforeach[#1]{#3}{#4}{% + \expandafter\DTLconverttodecimal\expandafter + {\DTLbarvariable}{\dtl@barvar}% + \let\dtl@old=\DTLnegextent + \DTLmin{\DTLnegextent}{\dtl@old}{\dtl@barvar}% + }% + \ifx\dtlbar@yticgap\relax + \else + \ifthenelse{\DTLisFPlt{\DTLnegextent}{0}}{% + \edef\dtl@thistick{0}% + \whiledo{\DTLisFPclosedbetween{\dtl@thistick}{\DTLnegextent}{0}}{% + \FPsub{\dtl@thistick}{\dtl@thistick}{\dtlbar@yticgap}% + }% + \let\DTLnegextent=\dtl@thistick + }{}% + \fi + \fi + \@dtl@tmpcount=\DTLbarchartlength + \FPsub{\dtl@extent}{\DTLbarmax}{\DTLnegextent}% + \FPdiv{\dtl@unit}{\number\@dtl@tmpcount}{\dtl@extent}% + \setlength{\dtl@yticlabelwidth}{0pt}% + \ifDTLbarytics + \ifx\dtlbar@yticlist\relax + \ifx\dtlbar@yticgap\relax + \dtl@constructticklist\DTLnegextent\DTLbarmax + \dtl@unit\dtlbar@yticlist + \else + \dtl@constructticklistwithgapz + \DTLnegextent\DTLbarmax\dtlbar@yticlist\dtlbar@yticgap + \fi + \fi + \ifx\dtlbar@ylabel\relax + \else + \ifx\dtlbar@yticlabels\relax + \@for\dtl@thislabel:=\dtlbar@yticlist\do{% + \FPround{\dtl@thislabel}{\dtl@thislabel} + {\c@DTLbarroundvar}% + \ifDTLverticalbars + \settowidth{\dtl@tmplength}{% + \DTLbardisplayYticklabel{\dtl@thislabel}}% + \else + \settoheight{\dtl@tmplength}{% + \DTLbardisplayYticklabel{\dtl@thislabel}}% + \edef\@dtl@h{\the\dtl@tmplength}% + \settodepth{\dtl@tmplength}{% + \DTLbardisplayYticklabel{\dtl@thislabel}}% + \addtolength{\dtl@tmplength}{\@dtl@h}% + \addtolength{\dtl@tmplength}{\baselineskip}% + \fi + \ifdim\dtl@tmplength>\dtl@yticlabelwidth + \setlength{\dtl@yticlabelwidth}{\dtl@tmplength}% + \fi + }% + \else + \@for\dtl@thislabel:=\dtlbar@yticlabels\do{% + \ifDTLverticalbars + \settowidth{\dtl@tmplength}{% + \DTLbardisplayYticklabel{\dtl@thislabel}}% + \else + \settoheight{\dtl@tmplength}{% + \DTLbardisplayYticklabel{\dtl@thislabel}}% + \edef\@dtl@h{\the\dtl@tmplength}% + \settodepth{\dtl@tmplength}{% + \DTLbardisplayYticklabel{\dtl@thislabel}}% + \addtolength{\dtl@tmplength}{\@dtl@h}% + \addtolength{\dtl@tmplength}{\baselineskip}% + \fi + \ifdim\dtl@tmplength>\dtl@yticlabelwidth + \setlength{\dtl@yticlabelwidth}{\dtl@tmplength}% + \fi + }% + \fi + \fi + \fi +\edef\DTLbarchartwidth{\expandafter\number\csname dtlrows@#3\endcsname} +\begin{tikzpicture} +\ifDTLverticalbars + \pgfsetyvec{\pgfpoint{0pt}{\dtl@unit sp}}% + \pgfsetxvec{\pgfpoint{\DTLbarwidth}{0pt}}% +\else + \pgfsetxvec{\pgfpoint{\dtl@unit sp}{0pt}}% + \pgfsetyvec{\pgfpoint{0pt}{\DTLbarwidth}}% +\fi +\DTLbaratbegintikz +\def\@dtl@start{0}% +\@sDTLforeach[#1]{#3}{#4}{% +\expandafter\let\expandafter\@dtl@bar + \csname c@DTLrow\romannumeral\dtlforeachlevel\endcsname% +\expandafter\DTLconverttodecimal\expandafter + {\DTLbarvariable}{\dtl@variable}% +\begin{scope} + \DTLdocurrentbarcolor + \ifDTLverticalbars + \fill (\@dtl@start,0) -- (\@dtl@start,\dtl@variable) + -- (\@dtl@bar,\dtl@variable) -- (\@dtl@bar,0) -- cycle; + \else + \fill (0,\@dtl@start) -- (\dtl@variable,\@dtl@start) + -- (\dtl@variable,\@dtl@bar) -- (0,\@dtl@bar) -- cycle; + \fi +\end{scope} +\begin{scope} +\ifdim\DTLbaroutlinewidth>0pt + \expandafter\color\expandafter{\DTLbaroutlinecolor} + \ifDTLverticalbars + \draw (\@dtl@start,0) -- (\@dtl@start,\dtl@variable) + -- (\@dtl@bar,\dtl@variable) -- (\@dtl@bar,0) -- cycle; + \else + \draw (0,\@dtl@start) -- (\dtl@variable,\@dtl@start) + -- (\dtl@variable,\@dtl@bar) -- (0,\@dtl@bar) -- cycle; + \fi +\fi +\end{scope} +\ifDTLverticalbars + \edef\dtl@textopt{% + at={\noexpand\pgfpointadd + {\noexpand\pgfpointxy{\@dtl@start.5}{0}} + {\noexpand\pgfpoint{0pt}{-\noexpand\DTLbarlabeloffset}}}, + \DTLbarXlabelalign + }% +\else + \edef\dtl@textopt{% + at={\noexpand\pgfpointadd + {\noexpand\pgfpointxy{0}{\@dtl@start.5}} + {\noexpand\pgfpoint{-\noexpand\DTLbarlabeloffset}{0pt}}}, + \DTLbarXlabelalign + }% +\fi + \expandafter\pgftext\expandafter[\dtl@textopt]{% + \DTLdisplaylowerbarlabel{\dtl@barlabel}} +\ifDTLverticalbars + \expandafter\DTLifnumlt\expandafter{\DTLbarvariable}{0} + { + \edef\dtl@textopt{% + at={\noexpand\pgfpointadd + {\noexpand\pgfpointxy{\@dtl@start.5}{\dtl@variable}} + {\noexpand\pgfpoint{0pt}{-\noexpand\DTLbarlabeloffset}}} + }% + }{% + \edef\dtl@textopt{% + at={\noexpand\pgfpointadd + {\noexpand\pgfpointxy{\@dtl@start.5}{\dtl@variable}} + {\noexpand\pgfpoint{0pt}{\noexpand\DTLbarlabeloffset}}} + }% + } +\else + \expandafter\DTLifnumlt\expandafter{\DTLbarvariable}{0} + { + \edef\dtl@textopt{right, + at={\noexpand\pgfpointadd + {\noexpand\pgfpointxy{\dtl@variable}{\@dtl@start.5}} + {\noexpand\pgfpoint{-\noexpand\DTLbarlabeloffset}{0pt}}} + }% + }{% + \edef\dtl@textopt{left, + at={\noexpand\pgfpointadd + {\noexpand\pgfpointxy{\dtl@variable}{\@dtl@start.5}} + {\noexpand\pgfpoint{\noexpand\DTLbarlabeloffset}{0pt}}} + }% + } +\fi + \expandafter\pgftext\expandafter[\dtl@textopt]{% + \DTLdisplayupperbarlabel{\dtl@upperbarlabel}} + \edef\@dtl@start{\number\@dtl@bar}% +} +\ifDTLbarxaxis + \ifDTLverticalbars + \expandafter\draw\expandafter[\DTLBarXAxisStyle] + (0,0) -- (\DTLbarchartwidth,0); + \else + \expandafter\draw\expandafter[\DTLBarXAxisStyle] + (0,0) -- (0,\DTLbarchartwidth); + \fi +\fi +\ifDTLbaryaxis + \ifDTLverticalbars + \expandafter\draw\expandafter[\DTLBarYAxisStyle] + (0,\DTLnegextent) -- (0,\DTLbarmax); + \else + \expandafter\draw\expandafter[\DTLBarYAxisStyle] + (\DTLnegextent,0) -- (\DTLbarmax,0); + \fi +\fi +\ifx\dtlbar@yticlist\relax +\else + \@for\dtl@thistick:=\dtlbar@yticlist\do{% + \ifDTLverticalbars + \pgfpathmoveto{\pgfpointxy{0}{\dtl@thistick}} + \pgfpathlineto{ + \pgfpointadd{\pgfpointxy{0}{\dtl@thistick}} + {\pgfpoint{-\DTLticklength}{0pt}}} + \else + \pgfpathmoveto{\pgfpointxy{\dtl@thistick}{0}} + \pgfpathlineto{ + \pgfpointadd{\pgfpointxy{\dtl@thistick}{0}} + {\pgfpoint{0pt}{-\DTLticklength}}} + \fi + \pgfusepath{stroke} + \ifx\dtlbar@yticlabels\relax + \FPround{\dtl@thislabel}{\dtl@thistick} + {\c@DTLbarroundvar}% + \else + \dtl@chopfirst\dtlbar@yticlabels\dtl@thislabel\dtl@rest + \let\dtlbar@yticlabels=\dtl@rest + \fi + \ifDTLverticalbars + \edef\dtl@textopt{\DTLbarYticklabelalign,% + at={\noexpand\pgfpointadd + {\noexpand\pgfpointxy{0}{\dtl@thistick}} + {\noexpand\pgfpoint{-\noexpand\DTLticklabeloffset}{0pt}}, + }}% + \else + \edef\dtl@textopt{\DTLbarYticklabelalign, + at={\noexpand\pgfpointadd + {\noexpand\pgfpointxy{\dtl@thistick}{0}} + {\noexpand\pgfpoint{0pt}{-\noexpand\DTLticklabeloffset}} + }}% + \fi + \expandafter\pgftext\expandafter[\dtl@textopt]{% + \DTLbardisplayYticklabel{\dtl@thislabel}} + }% +\fi +\ifx\dtlbar@ylabel\relax +\else + \addtolength{\dtl@yticlabelwidth}{\baselineskip}% + \setlength{\dtl@tmplength}{0.5\DTLbarchartlength} + \ifDTLverticalbars + \pgftext[bottom,center,at={\pgfpointadd + {\pgfpointxy{0}{\DTLnegextent}}% + {\pgfpoint{-\dtl@yticlabelwidth}{\dtl@tmplength}}}, + rotate=90]{% + \dtlbar@ylabel} + \else + \pgftext[bottom,center,at={\pgfpointadd + {\pgfpointxy{\DTLnegextent}{0}}% + {\pgfpoint{\dtl@tmplength}{-\dtl@yticlabelwidth}}}]{% + \dtlbar@ylabel} + \fi +\fi +\DTLbaratendtikz +\end{tikzpicture} +\fi +}} +\newcommand*{\DTLmultibarchart}[4][\boolean{true}]{% +{\let\dtlbar@variables=\relax +\let\DTLbarmax=\relax +\let\DTLnegextent=\relax +\disable@keys{databar}{variable,upperbarlabel}% +\setkeys{databar}{#2}% +\ifx\dtlbar@variables\relax + \PackageError{databar}{\string\DTLmultibarchart\space missing variables setting}{}% +\else + \ifx\DTLbarmax\relax + \@sDTLforeach[#1]{#3}{#4}{% + \@for\DTLbarvariable:=\dtlbar@variables\do{% + \expandafter\DTLconverttodecimal\expandafter + {\DTLbarvariable}{\dtl@barvar}% + \ifx\DTLbarmax\relax + \let\DTLbarmax=\dtl@barvar + \else + \let\dtl@old=\DTLbarmax + \FPmax{\DTLbarmax}{\dtl@old}{\dtl@barvar}% + \fi + }% + }% + \ifx\dtlbar@yticgap\relax + \else + \let\dtl@thistick=\dtlbar@yticgap% + \whiledo{\DTLisFPopenbetween{\dtl@thistick}{0}{\DTLbarmax}}{% + \FPadd{\dtl@thistick}{\dtl@thistick}{\dtlbar@yticgap}% + }% + \let\DTLbarmax=\dtl@thistick + \fi + \fi + \ifx\DTLnegextent\relax + \def\DTLnegextent{0}% + \@sDTLforeach[#1]{#3}{#4}{% + \@for\DTLbarvariable:=\dtlbar@variables\do{% + \expandafter\DTLconverttodecimal\expandafter + {\DTLbarvariable}{\dtl@barvar}% + \let\dtl@old=\DTLnegextent + \DTLmin{\DTLnegextent}{\dtl@old}{\dtl@barvar}% + }% + }% + \ifx\dtlbar@yticgap\relax + \else + \ifthenelse{\DTLisFPlt{\DTLnegextent}{0}}{% + \edef\dtl@thistick{0}% + \whiledo{\DTLisFPclosedbetween{\dtl@thistick}{\DTLnegextent}{0}}{% + \FPsub{\dtl@thistick}{\dtl@thistick}{\dtlbar@yticgap}% + }% + \let\DTLnegextent=\dtl@thistick + }{}% + \fi + \fi + \@dtl@tmpcount=\DTLbarchartlength + \FPsub{\dtl@extent}{\DTLbarmax}{\DTLnegextent}% + \FPdiv{\dtl@unit}{\number\@dtl@tmpcount}{\dtl@extent}% + \setlength{\dtl@yticlabelwidth}{0pt}% + \ifDTLbarytics + \ifx\dtlbar@yticlist\relax + \ifx\dtlbar@yticgap\relax + \dtl@constructticklist\DTLnegextent\DTLbarmax + \dtl@unit\dtlbar@yticlist + \else + \dtl@constructticklistwithgapz + \DTLnegextent\DTLbarmax\dtlbar@yticlist\dtlbar@yticgap + \fi + \fi + \ifx\dtlbar@ylabel\relax + \else + \ifx\dtlbar@yticlabels\relax + \@for\dtl@thislabel:=\dtlbar@yticlist\do{% + \FPround{\dtl@thislabel}{\dtl@thislabel} + {\c@DTLbarroundvar}% + \ifDTLverticalbars + \settowidth{\dtl@tmplength}{% + \DTLbardisplayYticklabel{\dtl@thislabel}}% + \else + \settoheight{\dtl@tmplength}{% + \DTLbardisplayYticklabel{\dtl@thislabel}}% + \edef\@dtl@h{\the\dtl@tmplength}% + \settodepth{\dtl@tmplength}{% + \DTLbardisplayYticklabel{\dtl@thislabel}}% + \addtolength{\dtl@tmplength}{\@dtl@h}% + \addtolength{\dtl@tmplength}{\baselineskip}% + \fi + \ifdim\dtl@tmplength>\dtl@yticlabelwidth + \setlength{\dtl@yticlabelwidth}{\dtl@tmplength}% + \fi + }% + \else + \@for\dtl@thislabel:=\dtlbar@yticlabels\do{% + \ifDTLverticalbars + \settowidth{\dtl@tmplength}{% + \DTLbardisplayYticklabel{\dtl@thislabel}}% + \else + \settoheight{\dtl@tmplength}{% + \DTLbardisplayYticklabel{\dtl@thislabel}}% + \edef\@dtl@h{\the\dtl@tmplength}% + \settodepth{\dtl@tmplength}{% + \DTLbardisplayYticklabel{\dtl@thislabel}}% + \addtolength{\dtl@tmplength}{\@dtl@h}% + \addtolength{\dtl@tmplength}{\baselineskip}% + \fi + \ifdim\dtl@tmplength>\dtl@yticlabelwidth + \setlength{\dtl@yticlabelwidth}{\dtl@tmplength}% + \fi + }% + \fi + \fi + \fi +\dtl@xticlabelheight=0pt\relax +\@dtl@tmpcount=0\relax +\@for\dtl@thislabel:=\dtl@multibarlabels\do{% + \advance\@dtl@tmpcount by 1\relax + \settoheight{\dtl@tmplength}{\tikz\expandafter\pgftext\expandafter + [\DTLbarXlabelalign]{\DTLdisplaylowerbarlabel{\dtl@thislabel}};}% + \edef\@dtl@h{\the\dtl@tmplength}% + \settodepth{\dtl@tmplength}{\tikz\expandafter\pgftext\expandafter + [\DTLbarXlabelalign]{\DTLdisplaylowerbarlabel{\dtl@thislabel}};}% + \addtolength{\dtl@tmplength}{\@dtl@h}% + \addtolength{\dtl@tmplength}{\baselineskip}% + \ifdim\dtl@tmplength>\dtl@xticlabelheight + \setlength{\dtl@xticlabelheight}{\dtl@tmplength}% + \fi +} +\@dtl@tmpcount=0\relax +\@for\dtl@this:=\dtlbar@variables\do{% + \advance\@dtl@tmpcount by 1\relax +}% +\edef\DTLbargroupwidth{\number\@dtl@tmpcount}% +\edef\dtl@n{\expandafter\number\csname dtlrows@#3\endcsname} +\FPmul{\dtl@tmpi}{\dtl@n}{\DTLbargroupwidth} +\FPsub{\dtl@tmpii}{\dtl@n}{1}% +\FPmul{\dtl@tmpii}{\dtl@tmpii}{\dtlbar@groupgap}% +\FPadd{\DTLbarchartwidth}{\dtl@tmpi}{\dtl@tmpii} +\begin{tikzpicture} +\ifDTLverticalbars + \pgfsetyvec{\pgfpoint{0pt}{\dtl@unit sp}}% + \pgfsetxvec{\pgfpoint{\DTLbarwidth}{0pt}}% +\else + \pgfsetxvec{\pgfpoint{\dtl@unit sp}{0pt}}% + \pgfsetyvec{\pgfpoint{0pt}{\DTLbarwidth}}% +\fi +\DTLbaratbegintikz +\def\@dtl@start{0}% +\@sDTLforeach[#1]{#3}{#4}{% +\@dtl@barcount = 1\relax +\let\dtl@multibar@labels=\dtl@multibarlabels +\let\dtl@uppermultibar@labels=\dtl@uppermultibarlabels +\FPmul{\dtl@multimidpt}{\DTLbargroupwidth}{0.5}% +\FPadd{\dtl@multimidpt}{\dtl@multimidpt}{\@dtl@start}% +\@for\DTLbarvariable:=\dtlbar@variables\do{% +\FPadd{\@dtl@endpt}{\@dtl@start}{1}% +\expandafter\DTLconverttodecimal\expandafter + {\DTLbarvariable}{\dtl@variable}% +\dtl@chopfirst\dtl@multibar@labels\dtl@thisbarlabel\dtl@rest +\let\dtl@multibar@labels=\dtl@rest +\dtl@chopfirst\dtl@uppermultibar@labels\dtl@thisupperbarlabel\dtl@rest +\let\dtl@uppermultibar@labels=\dtl@rest +\begin{scope} + \expandafter\color\expandafter{\DTLgetbarcolor{\@dtl@barcount}}% + \ifDTLverticalbars + \fill (\@dtl@start,0) -- (\@dtl@start,\dtl@variable) + -- (\@dtl@endpt,\dtl@variable) -- (\@dtl@endpt,0) -- cycle; + \else + \fill (0,\@dtl@start) -- (\dtl@variable,\@dtl@start) + -- (\dtl@variable,\@dtl@endpt) -- (0,\@dtl@endpt) -- cycle; + \fi +\end{scope} +\begin{scope} +\ifdim\DTLbaroutlinewidth>0pt + \expandafter\color\expandafter{\DTLbaroutlinecolor} + \ifDTLverticalbars + \draw (\@dtl@start,0) -- (\@dtl@start,\dtl@variable) + -- (\@dtl@endpt,\dtl@variable) -- (\@dtl@endpt,0) -- cycle; + \else + \draw (0,\@dtl@start) -- (\dtl@variable,\@dtl@start) + -- (\dtl@variable,\@dtl@endpt) -- (0,\@dtl@endpt) -- cycle; + \fi +\fi +\end{scope} +\FPadd{\@dtl@midpt}{\@dtl@start}{0.5}% +\ifDTLverticalbars + \edef\dtl@textopt{% + at={\noexpand\pgfpointadd + {\noexpand\pgfpointxy{\@dtl@midpt}{0}} + {\noexpand\pgfpoint{0pt}{-\noexpand\DTLbarlabeloffset}}}, + \DTLbarXlabelalign + }% +\else + \edef\dtl@textopt{% + at={\noexpand\pgfpointadd + {\noexpand\pgfpointxy{0}{\@dtl@midpt}} + {\noexpand\pgfpoint{-\noexpand\DTLbarlabeloffset}{0pt}}}, + \DTLbarXlabelalign + }% +\fi + \expandafter\pgftext\expandafter[\dtl@textopt]{% + \DTLdisplaylowermultibarlabel{\dtl@thisbarlabel}} +\ifDTLverticalbars + \expandafter\DTLifnumlt\expandafter{\DTLbarvariable}{0} + { + \edef\dtl@textopt{% + at={\noexpand\pgfpointadd + {\noexpand\pgfpointxy{\@dtl@midpt}{\dtl@variable}} + {\noexpand\pgfpoint{0pt}{-\noexpand\DTLbarlabeloffset}}} + }% + }{% + \edef\dtl@textopt{% + at={\noexpand\pgfpointadd + {\noexpand\pgfpointxy{\@dtl@midpt}{\dtl@variable}} + {\noexpand\pgfpoint{0pt}{\noexpand\DTLbarlabeloffset}}} + }% + } +\else + \expandafter\DTLifnumlt\expandafter{\DTLbarvariable}{0} + { + \edef\dtl@textopt{right, + at={\noexpand\pgfpointadd + {\noexpand\pgfpointxy{\dtl@variable}{\@dtl@midpt}} + {\noexpand\pgfpoint{-\noexpand\DTLbarlabeloffset}{0pt}}} + }% + }{% + \edef\dtl@textopt{left, + at={\noexpand\pgfpointadd + {\noexpand\pgfpointxy{\dtl@variable}{\@dtl@midpt}} + {\noexpand\pgfpoint{\noexpand\DTLbarlabeloffset}{0pt}}} + }% + } +\fi + \expandafter\pgftext\expandafter[\dtl@textopt]{% + \DTLdisplayuppermultibarlabel{\dtl@thisupperbarlabel}} + \FPadd{\@dtl@start}{\@dtl@start}{1}% + \advance\@dtl@barcount by 1\relax +}% +\setlength{\dtl@tmplength}{\DTLbarlabeloffset}% +\addtolength{\dtl@tmplength}{\dtl@xticlabelheight}% +\ifDTLverticalbars + \edef\dtl@textopt{% + at={\noexpand\pgfpointadd + {\noexpand\pgfpointxy{\dtl@multimidpt}{0}} + {\noexpand\pgfpoint{0pt}{-\noexpand\dtl@tmplength}}}, + \DTLbarXlabelalign + }% +\else + \edef\dtl@textopt{% + at={\noexpand\pgfpointadd + {\noexpand\pgfpointxy{0}{\dtl@multimidpt}} + {\noexpand\pgfpoint{-\noexpand\dtl@tmplength}{0pt}}}, + \DTLbarXlabelalign + }% +\fi + \expandafter\pgftext\expandafter[\dtl@textopt]{% + \DTLdisplaylowerbarlabel{\dtl@barlabel}} + \FPadd{\@dtl@start}{\@dtl@start}{\dtlbar@groupgap}% +} +\ifDTLbarxaxis + \ifDTLverticalbars + \expandafter\draw\expandafter[\DTLBarXAxisStyle] + (0,0) -- (\DTLbarchartwidth,0); + \else + \expandafter\draw\expandafter[\DTLBarXAxisStyle] + (0,0) -- (0,\DTLbarchartwidth); + \fi +\fi +\ifDTLbaryaxis + \ifDTLverticalbars + \expandafter\draw\expandafter[\DTLBarYAxisStyle] + (0,\DTLnegextent) -- (0,\DTLbarmax); + \else + \expandafter\draw\expandafter[\DTLBarYAxisStyle] + (\DTLnegextent,0) -- (\DTLbarmax,0); + \fi +\fi +\ifx\dtlbar@yticlist\relax +\else + \@for\dtl@thistick:=\dtlbar@yticlist\do{% + \ifDTLverticalbars + \pgfpathmoveto{\pgfpointxy{0}{\dtl@thistick}} + \pgfpathlineto{ + \pgfpointadd{\pgfpointxy{0}{\dtl@thistick}} + {\pgfpoint{-\DTLticklength}{0pt}}} + \else + \pgfpathmoveto{\pgfpointxy{\dtl@thistick}{0}} + \pgfpathlineto{ + \pgfpointadd{\pgfpointxy{\dtl@thistick}{0}} + {\pgfpoint{0pt}{-\DTLticklength}}} + \fi + \pgfusepath{stroke} + \ifx\dtlbar@yticlabels\relax + \FPround{\dtl@thislabel}{\dtl@thistick} + {\c@DTLbarroundvar}% + \else + \dtl@chopfirst\dtlbar@yticlabels\dtl@thislabel\dtl@rest + \let\dtlbar@yticlabels=\dtl@rest + \fi + \ifDTLverticalbars + \edef\dtl@textopt{\DTLbarYticklabelalign,% + at={\noexpand\pgfpointadd + {\noexpand\pgfpointxy{0}{\dtl@thistick}} + {\noexpand\pgfpoint{-\noexpand\DTLticklabeloffset}{0pt}}, + }}% + \else + \edef\dtl@textopt{\DTLbarYticklabelalign, + at={\noexpand\pgfpointadd + {\noexpand\pgfpointxy{\dtl@thistick}{0}} + {\noexpand\pgfpoint{0pt}{-\noexpand\DTLticklabeloffset}} + }}% + \fi + \expandafter\pgftext\expandafter[\dtl@textopt]{% + \DTLbardisplayYticklabel{\dtl@thislabel}} + }% +\fi +\ifx\dtlbar@ylabel\relax +\else + \addtolength{\dtl@yticlabelwidth}{\baselineskip}% + \setlength{\dtl@tmplength}{0.5\DTLbarchartlength} + \ifDTLverticalbars + \pgftext[bottom,center,at={\pgfpointadd + {\pgfpointxy{0}{\DTLnegextent}}% + {\pgfpoint{-\dtl@yticlabelwidth}{\dtl@tmplength}}}, + rotate=90]{% + \dtlbar@ylabel} + \else + \pgftext[bottom,center,at={\pgfpointadd + {\pgfpointxy{\DTLnegextent}{0}}% + {\pgfpoint{\dtl@tmplength}{-\dtl@yticlabelwidth}}}]{% + \dtlbar@ylabel} + \fi +\fi +\DTLbaratendtikz +\end{tikzpicture} +\fi +}} +\endinput +%% +%% End of file `databar.sty'. diff --git a/Master/texmf-dist/tex/latex/datatool/databib.sty b/Master/texmf-dist/tex/latex/datatool/databib.sty new file mode 100644 index 00000000000..2b168d64dd4 --- /dev/null +++ b/Master/texmf-dist/tex/latex/datatool/databib.sty @@ -0,0 +1,1529 @@ +%% +%% This is file `databib.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% datatool.dtx (with options: `databib.sty,package') +%% +%% datatool.dtx +%% Copyright 2007 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.sty, datapie.sty, dataplot.sty, databar.sty, databib.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{databib}[2007/08/17 v1.0 (NLCT)] +\RequirePackage{datatool} +\newcommand*{\dtlbib@style}{plain} +\define@choicekey{databib.sty}{style}{plain,abbrv,alpha}{% +\def\dtlbib@style{#1}} +\ProcessOptionsX +\newcommand*{\DTLloadbbl}[3][\jobname.bbl]{% +\bibliographystyle{databib}% +\if@filesw + \immediate\write\@auxout{\string\bibdata{#3}}% +\fi +\DTLnewdb{#2}% +\edef\DTLBIBdbname{#2}% +\@input@{#1}} +\newcommand*{\DTLnewbibrow}{\DTLnewrow{\DTLBIBdbname}} +\newcommand*{\DTLnewbibitem}[2]{% +\DTLnewdbentry{\DTLBIBdbname}{#1}{#2}} +\providecommand*{\andname}{and} +\providecommand*{\ofname}{of} +\providecommand*{\inname}{in} +\providecommand*{\etalname}{et al.} +\providecommand*{\editorname}{editor} +\providecommand*{\editorsname}{editors} +\providecommand*{\volumename}{volume} +\providecommand*{\numbername}{number} +\providecommand*{\pagesname}{pages} +\providecommand*{\pagename}{page} +\providecommand*{\editionname}{edition} +\providecommand*{\techreportname}{Technical report} +\providecommand*{\mscthesisname}{Master's thesis} +\providecommand*{\phdthesisname}{PhD thesis} +\newcommand*{\DTLbibliography}[2][\boolean{true}]{% +\begin{DTLthebibliography}[#1]{#2}% +\DTLforeachbibentry[#1]{#2}{% +\DTLbibitem \DTLformatbibentry \DTLendbibitem +}% +\end{DTLthebibliography}% +} +\newcommand*{\DTLformatbibentry}{% +\@ifundefined{DTLformat\DBIBentrytype}{% +\PackageError{databib}{Don't know how to format bibliography entries +of type `\DBIBentrytype'}{}}{% +\dtl@message{[\DBIBcitekey]}% +\DTLstartsentencefalse\DTLmidsentencefalse\DTLperiodfalse +\csname DTLformat\DBIBentrytype\endcsname}% +} +\newcommand*{\DTLendbibitem}{} +\newlength\dtl@widest +\newcommand*{\DTLcomputewidestbibentry}[4]{% +\dtl@widest=0pt\relax +\let#4=\@empty +\DTLforeachbibentry[#1]{#2}{% +\settowidth{\dtl@tmplength}{#3}% +\ifdim\dtl@tmplength>\dtl@widest\relax + \dtl@widest=\dtl@tmplength + \protected@edef#4{#3}% +\fi +}% +} +\newcommand*{\DTLforeachbibentry}{% +\@ifstar\@DTLforeachbibentry\@DTLforeachbibentry} +\newcommand*{\@DTLforeachbibentry}[3][\boolean{true}]{% +\edef\DBIBname{#2}\setcounter{DTLbibrow}{0}% +\@DTLforeach{#2}{\DBIBcitekey=CiteKey,\DBIBentrytype +=EntryType}{\dtl@gathervalues{#2}{\@dtl@currentrow}% +\ifthenelse{#1}{\refstepcounter{DTLbibrow}#3}{}}} +\newcommand*{\@sDTLforeachbibentry}[3][\boolean{true}]{% +\edef\DBIBname{#2}\setcounter{DTLbibrow}{0}% +\@sDTLforeach{#2}{\DBIBcitekey=CiteKey,\DBIBentrytype +=EntryType}{\dtl@gathervalues{#2}{\@dtl@currentrow}% +\ifthenelse{#1}{\refstepcounter{DTLbibrow}#3}{}}} +\newcounter{DTLbibrow} +\def\theHDTLbibrow{\theHDTLrow.bib.\arabic{DTLbibrow}}% +\newcommand*{\DTLbibfield}[1]{\csname @dtl@key@#1\endcsname} +\newcommand*{\DTLifbibfieldexists}[3]{% +\@ifundefined{@dtl@key@#1}{#3}{% +\expandafter\DTLifnull\csname @dtl@key@#1\endcsname +{#3}{#2}}} +\newcommand*{\DTLifanybibfieldexists}[3]{% +\@for\dtl@thisfield:=#1\do{% +\@ifundefined{@dtl@key@\dtl@thisfield}{}{% +\expandafter\DTLifnull\csname @dtl@key@\dtl@thisfield\endcsname +{}{% +\@endfortrue}}}% +\if@endfor + #2% +\else + #3% +\fi +\@endforfalse +} +\newif\ifDTLperiod +\newcommand*{\DTLcheckendsperiod}[1]{% +\dtl@checkendsperiod#1\@nil\relax} +\def\dtl@checkendsperiod#1#2{% +\def\@dtl@argi{#1}\def\@dtl@argii{#2}% +\def\@dtl@period{.}% +\ifx\@dtl@argi\@nnil + \global\DTLperiodfalse + \let\@dtl@donext=\relax +\else + \ifx\@dtl@argii\@nnil + \ifx\@dtl@argi\@dtl@period + \global\DTLperiodtrue + \else + \global\DTLperiodfalse + \fi + \let\@dtl@donext=\@gobble + \else + \let\@dtl@donext=\dtl@checkendsperiod + \fi +\fi +\@dtl@donext{#2}% +} +\newcommand*{\DTLcheckbibfieldendsperiod}[1]{% +\protected@edef\@dtl@tmp{\DTLbibfield{#1}}% +\expandafter\DTLcheckendsperiod\expandafter{\@dtl@tmp}} +\newif\ifDTLmidsentence +\newif\ifDTLstartsentence +\newcommand*{\DTLaddperiod}{\DTLmidsentencefalse\DTLperiodfalse +\DTLstartsentencetrue +\ifDTLperiod\else.\fi} +\newcommand*{\DTLaddcomma}{, \DTLmidsentencetrue +\DTLperiodfalse\DTLstartsentencefalse} +\newcommand*{\DTLstartsentencespace}{% +\ifDTLstartsentence\spacefactor=\sfcode`\.\relax\space +\fi\DTLstartsentencefalse} +\newcommand*{\DTLtwoand}{\ \andname\ } +\newcommand*{\DTLandlast}{, \andname\ } +\newcommand*{\DTLandnotlast}{, } +\newcount\@dtl@authorcount +\newcounter{DTLmaxauthors} +\setcounter{DTLmaxauthors}{10} +\newcommand*{\DTLformatauthorlist}{% +\DTLifbibfieldexists{Author}{% +\DTLstartsentencespace +\@dtl@authorcount=0\relax +\@for\@dtl@author:=\@dtl@key@Author\do{% +\advance\@dtl@authorcount by 1\relax}% +\@dtl@tmpcount=0\relax +\ifnum\@dtl@authorcount>\c@DTLmaxauthors +{% + \@for\@dtl@author:=\@dtl@key@Author\do{% + \advance\@dtl@tmpcount by 1\relax + \ifnum\@dtl@tmpcount=1\relax + \expandafter\DTLformatauthor\@dtl@author + \else + \ifnum\@dtl@tmpcount>\c@DTLmaxauthors + \DTLandnotlast \etalname + \expandafter\DTLcheckendsperiod\expandafter{\etalname}% + \@endfortrue + \else + \DTLandnotlast \expandafter\DTLformatauthor\@dtl@author + \fi + \fi + }% +}% +\else + \@for\@dtl@author:=\@dtl@key@Author\do{% + \advance\@dtl@tmpcount by 1\relax + \ifnum\@dtl@tmpcount=1\relax + \expandafter\DTLformatauthor\@dtl@author + \else + \ifnum\@dtl@tmpcount=\@dtl@authorcount + \ifnum\@dtl@authorcount=2\relax + \DTLtwoand + \else + \DTLandlast + \fi + \expandafter\DTLformatauthor\@dtl@author + \else + \DTLandnotlast \expandafter\DTLformatauthor\@dtl@author + \fi + \fi + }% +\fi +}{}% +} +\newcounter{DTLmaxeditors} +\setcounter{DTLmaxeditors}{10} +\newcommand*{\DTLformateditorlist}{% +\DTLifbibfieldexists{Editor}{% +\DTLstartsentencespace +\@dtl@authorcount=0\relax +\@for\@dtl@author:=\@dtl@key@Editor\do{% +\advance\@dtl@authorcount by 1\relax}% +\@dtl@tmpcount=0\relax +\ifnum\@dtl@authorcount>\c@DTLmaxeditors +{% + \@for\@dtl@author:=\@dtl@key@Editor\do{% + \advance\@dtl@tmpcount by 1\relax + \ifnum\@dtl@tmpcount=1\relax + \expandafter\DTLformateditor\@dtl@author + \else + \ifnum\@dtl@tmpcount>\c@DTLmaxeditors + \DTLandnotlast \etalname + \expandafter\DTLcheckendsperiod\expandafter{\etalname}% + \@endfortrue + \else + \DTLandnotlast \expandafter\DTLformateditor\@dtl@author + \fi + \fi + }% +}% +\else +\@for\@dtl@author:=\@dtl@key@Editor\do{% + \advance\@dtl@tmpcount by 1\relax + \ifnum\@dtl@tmpcount=1\relax + \expandafter\DTLformateditor\@dtl@author + \else + \ifnum\@dtl@tmpcount=\@dtl@authorcount + \ifnum\@dtl@authorcount=2\relax + \DTLtwoand + \else + \DTLandlast + \fi + \expandafter\DTLformateditor\@dtl@author + \else + \DTLandnotlast \expandafter\DTLformateditor\@dtl@author + \fi + \fi + }% +\fi +, +\ifnum\@dtl@authorcount=1\relax + \editorname + \expandafter\DTLcheckendsperiod\expandafter{\editorname}% +\else + \editorsname + \expandafter\DTLcheckendsperiod\expandafter{\editorsname}% +\fi +}{}% +} +\newcommand*{\DTLformatsurnameonly}[4]{% +\DTLstartsentencespace +\def\@dtl@tmp{#1}% +\ifx\@dtl@tmp\@empty\else#1~\fi +#2% +\def\@dtl@tmp{#3}% +\ifx\@dtl@tmp\@empty + \DTLcheckendsperiod{#2}% +\else + , #3% + \DTLcheckendsperiod{#3}% +\fi +} +\newcommand*{\DTLformatforenames}[1]{% +\DTLstartsentencespace +#1% +\DTLcheckendsperiod{#1}} +\newcommand*{\DTLformatabbrvforenames}[1]{% +\DTLstartsentencespace +\DTLstoreinitials{#1}{\@dtl@tmp}\@dtl@tmp +\expandafter\DTLcheckendsperiod\expandafter{\@dtl@tmp}} +\newcommand*{\DTLformatvon}[1]{% +\DTLstartsentencespace +\def\@dtl@tmp{#1}% +\ifx\@dtl@tmp\@empty +\else + #1~% +\fi +} +\newcommand*{\DTLformatsurname}[1]{% +\DTLstartsentencespace +#1\DTLcheckendsperiod{#1}} +\newcommand*{\DTLformatjr}[1]{% +\DTLstartsentencespace +\def\@dtl@tmp{#1}% +\ifx\@dtl@tmp\@empty +\else + , #1\DTLcheckendsperiod{#1}% +\fi +} +\newcommand*{\DTLformatcrossrefeditor}{% +\DTLifbibfieldexists{Editor}{% +\DTLstartsentencespace +\@dtl@authorcount=0\relax +\@for\@dtl@author:=\@dtl@key@Editor\do{% +\advance\@dtl@authorcount by 1\relax}% +{\@dtl@tmpcount=0\relax +\@for\@dtl@author:=\@dtl@key@Editor\do{% +\ifnum\@dtl@authorcount=1\relax + \expandafter\DTLformatsurnameonly\@dtl@author +\else + \advance\@dtl@tmpcount by 1\relax + \ifnum\@dtl@tmpcount=1\relax + \expandafter\DTLformatsurnameonly\@dtl@author + \else + \ifnum\@dtl@authorcount=2\relax + \ \andname\ \expandafter\DTLformatsurnameonly\@dtl@author + \else + \ \etalname + \expandafter\DTLcheckendsperiod\expandafter{\etalname} + \fi + \@endfortrue + \fi +\fi +}}% +}{}% +} +\newcommand*{\DTLformatvolnumpages}{% +\DTLifbibfieldexists{Volume}{% +\DTLstartsentencespace +\DTLbibfield{Volume}\DTLperiodfalse}{}% +\DTLifbibfieldexists{Number}{% +\DTLstartsentencespace +(\DTLbibfield{Number})\DTLperiodfalse}{}% +\DTLifbibfieldexists{Pages}{% +\DTLifanybibfieldexists{Volume,Number}{:}{% +\DTLstartsentencespace +\protected@edef\@dtl@pages{0\DTLbibfield{Pages}}% +\DTLifnumerical{\@dtl@pages}{\pagename}{\pagesname}~}% +\DTLbibfield{Pages}\DTLperiodfalse}{}% +} +\newcommand*{\DTLformatbvolume}{% +\DTLifbibfieldexists{Volume}{% +\ifDTLmidsentence + \volumename +\else + \DTLstartsentencespace + \expandafter\MakeUppercase\volumename +\fi +~\DTLbibfield{Volume}% +\DTLifbibfieldexists{Series}{\ \ofname\ +{\em\DTLbibfield{Series}}\DTLcheckbibfieldendsperiod{Series}}{% +\DTLcheckbibfieldendsperiod{Volume}}% +}{}} +\newcommand*{\DTLformatchapterpages}{% +\DTLifbibfieldexists{Chapter}{% +\DTLifbibfieldexists{Type}{% +\DTLstartsentencespace +\DTLbibfield{Type}}{% +\DTLstartsentencespace +\chaptername}~\DTLbibfield{Chapter}% +\DTLifbibfieldexists{Pages}{\DTLaddcomma}{% +\DTLcheckbibfieldendsperiod{Chapter}}}{}% +\DTLstartsentencespace +\DTLformatpages} +\newcommand*{\DTLformatpages}{% +\DTLifbibfieldexists{Pages}{% +\DTLstartsentencespace +\protected@edef\@dtl@pages{0\DTLbibfield{Pages}}% +\DTLifnumerical{\@dtl@pages}{\pagename}{\pagesname}~% +\DTLbibfield{Pages}\DTLcheckbibfieldendsperiod{Pages}}{}% +} +\newcommand*{\DTLformatnumberseries}{% +\DTLifbibfieldexists{Volume}{}{% +\DTLifbibfieldexists{Number}{% +\ifDTLmidsentence + \numbername +\else + \DTLstartsentencespace + \expandafter\MakeUppercase\numbername +\fi~\DTLbibfield{Number}% +\DTLifbibfieldexists{Series}{\ \inname\ \DTLbibfield{Series}% +\DTLcheckbibfieldendsperiod{Series}}{% +\DTLcheckbibfieldendsperiod{Number}}% +}{% +\DTLifbibfieldexists{Series}{% +\DTLstartsentencespace +\DTLbibfield{Series}% +\DTLcheckbibfieldendsperiod{Series}}{}}% +}% +} +\newcommand*{\DTLformatbookcrossref}{% +\DTLifbibfieldexists{Volume}{% +\ifDTLmidsentence + \volumename +\else + \DTLstartsentencespace + \expandafter\MakeUppercase\volumename +\fi +~\DTLbibfield{Volume}\ \ofname\ +}{% +\ifDTLmidsentence + \inname +\else + \DTLstartsentencespace + \expandafter\MakeUppercase\inname +\fi\ }% +\DTLifbibfieldexists{Editor}{\DTLformatcrossrefeditor}{% +\DTLifbibfieldexists{Key}{% +\DTLbibfield{Key}}{% +\DTLifbibfieldexists{Series}{% +{\em\DTLbibfield{Series}}}{}% +}% +}% +\edef\@dtl@tmp{\DTLbibfield{CrossRef}}% +~\cite{\@dtl@tmp}% +} +\newcommand*{\DTLformatincollproccrossref}{% +\DTLifbibfieldexists{Editor}{% +\ifDTLmidsentence + \inname +\else + \DTLstartsentencespace + \expandafter\MakeUppercase\inname +\fi\ +\DTLformatcrossrefeditor +}{% +\DTLifbibfieldexists{Key}{% +\ifDTLmidsentence + \inname +\else + \DTLstartsentencespace + \expandafter\MakeUppercase\inname +\fi\ \DTLbibfield{Key}% +}{% +\DTLifbibfieldexists{BookTitle}{% +\ifDTLmidsentence + \inname +\else + \DTLstartsentencespace + \expandafter\MakeUppercase\inname +\fi\ {\em\DTLbibfield{BookTitle}}}{}% +}}% +\edef\@dtl@tmp{\DTLbibfield{CrossRef}}% +~\cite{\@dtl@tmp}% +} +\newcommand*{\DTLformatinedbooktitle}{% +\DTLifbibfieldexists{BookTitle}{% +\ifDTLmidsentence + \inname +\else + \DTLstartsentencespace + \expandafter\MakeUppercase\inname +\fi\ +\DTLifbibfieldexists{Editor}{% +\DTLformateditorlist\DTLaddcomma {\em\DTLbibfield{BookTitle}}% +\DTLcheckbibfieldendsperiod{BookTitle}% +}{{\em\DTLbibfield{BookTitle}}% +\DTLcheckbibfieldendsperiod{BookTitle}% +}}{}} +\newcommand*{\DTLformatdate}{% +\DTLifbibfieldexists{Year}{% +\DTLifbibfieldexists{Month}{% +\protected@edef\@dtl@tmp{\DTLbibfield{Month}}% +\ifDTLmidsentence + \@dtl@tmp +\else + \DTLstartsentencespace + \expandafter\MakeUppercase\@dtl@tmp +\fi\ +\DTLmidsentencefalse}{}% +\DTLstartsentencespace +\DTLbibfield{Year}}{% +\DTLifbibfieldexists{Month}{% +\protected@edef\@dtl@tmp{\DTLbibfield{Month}}% +\ifDTLmidsentence + \@dtl@tmp +\else + \DTLstartsentencespace + \expandafter\MakeUppercase\@dtl@tmp +\fi +\DTLcheckbibfieldendsperiod{Month}% +}{}}} +\newcommand*{\DTLformatarticlecrossref}{% +\DTLifbibfieldexists{Key}{% +\ifDTLmidsentence + \inname +\else + \DTLstartsentencespace + \expandafter\MakeUppercase\inname +\fi +\ {\em\DTLbibfield{Key}}}{% +\DTLifbibfieldexists{Journal}{% +\ifDTLmidsentence + \inname +\else + \DTLstartsentencespace + \expandafter\MakeUppercase\inname +\fi +\ {\em\DTLbibfield{Journal}}}{}}% +\edef\@dtl@tmp{\DTLbibfield{CrossRef}}% +~\cite{\@dtl@tmp}% +} +\newcommand*{\DTLbibfieldexists}[1]{% +\TE@throw\noexpand\dtl@testbibfieldexists{#1}% +\noexpand\if@dtl@condition} +\newcommand*{\dtl@testbibfieldexists}[1]{% +\DTLifbibfieldexists{#1}{\@dtl@conditiontrue}{\@dtl@conditionfalse}} +\newcommand*{\DTLbibfieldiseq}[2]{% +\TE@throw\noexpand\dtl@testbibfieldiseq{#1}{#2}% +\noexpand\if@dtl@condition} +\newcommand*{\dtl@testbibfieldiseq}[2]{% +\DTLifbibfieldexists{#1}{% +\expandafter\let\expandafter\@dtl@tmp\expandafter + =\csname @dtl@key@#1\endcsname +\expandafter\toks@\expandafter{\@dtl@tmp}% +\@dtl@toks{#2}% +\edef\@dtl@docompare{\noexpand\dtlcompare{\noexpand\@dtl@tmpcount}% +{\the\toks@}{\the\@dtl@toks}}% +\@dtl@docompare +\ifnum\@dtl@tmpcount=0\relax + \@dtl@conditiontrue +\else + \@dtl@conditionfalse +\fi +}{% +\@dtl@conditionfalse}% +} +\newcommand*{\DTLbibfieldislt}[2]{% +\TE@throw\noexpand\dtl@testbibfieldislt{#1}{#2}% +\noexpand\if@dtl@condition} +\newcommand*{\dtl@testbibfieldislt}[2]{% +\DTLifbibfieldexists{#1}{% +\expandafter\let\expandafter\@dtl@tmp\expandafter + =\csname @dtl@key@#1\endcsname +\expandafter\toks@\expandafter{\@dtl@tmp}% +\@dtl@toks{#2}% +\edef\@dtl@docompare{\noexpand\dtlcompare{\noexpand\@dtl@tmpcount}% +{\the\toks@}{\the\@dtl@toks}}% +\@dtl@docompare +\ifnum\@dtl@tmpcount=-1\relax + \@dtl@conditiontrue +\else + \@dtl@conditionfalse +\fi +}{% +\@dtl@conditionfalse}% +} +\newcommand*{\DTLbibfieldisle}[2]{% +\TE@throw\noexpand\dtl@testbibfieldisle{#1}{#2}% +\noexpand\if@dtl@condition} +\newcommand*{\dtl@testbibfieldisle}[2]{% +\DTLifbibfieldexists{#1}{% +\expandafter\let\expandafter\@dtl@tmp\expandafter + =\csname @dtl@key@#1\endcsname +\expandafter\toks@\expandafter{\@dtl@tmp}% +\@dtl@toks{#2}% +\edef\@dtl@docompare{\noexpand\dtlcompare{\noexpand\@dtl@tmpcount}% +{\the\toks@}{\the\@dtl@toks}}% +\@dtl@docompare +\ifnum\@dtl@tmpcount<1\relax + \@dtl@conditiontrue +\else + \@dtl@conditionfalse +\fi +}{% +\@dtl@conditionfalse}% +} +\newcommand*{\DTLbibfieldisgt}[2]{% +\TE@throw\noexpand\dtl@testbibfieldisgt{#1}{#2}% +\noexpand\if@dtl@condition} +\newcommand*{\dtl@testbibfieldisgt}[2]{% +\DTLifbibfieldexists{#1}{% +\expandafter\let\expandafter\@dtl@tmp\expandafter + =\csname @dtl@key@#1\endcsname +\expandafter\toks@\expandafter{\@dtl@tmp}% +\@dtl@toks{#2}% +\edef\@dtl@docompare{\noexpand\dtlcompare{\noexpand\@dtl@tmpcount}% +{\the\toks@}{\the\@dtl@toks}}% +\@dtl@docompare +\ifnum\@dtl@tmpcount=1\relax + \@dtl@conditiontrue +\else + \@dtl@conditionfalse +\fi +}{% +\@dtl@conditionfalse}% +} +\newcommand*{\DTLbibfieldisge}[2]{% +\TE@throw\noexpand\dtl@testbibfieldisge{#1}{#2}% +\noexpand\if@dtl@condition} +\newcommand*{\dtl@testbibfieldisge}[2]{% +\DTLifbibfieldexists{#1}{% +\expandafter\let\expandafter\@dtl@tmp\expandafter + =\csname @dtl@key@#1\endcsname +\expandafter\toks@\expandafter{\@dtl@tmp}% +\@dtl@toks{#2}% +\edef\@dtl@docompare{\noexpand\dtlcompare{\noexpand\@dtl@tmpcount}% +{\the\toks@}{\the\@dtl@toks}}% +\@dtl@docompare +\ifnum\@dtl@tmpcount>-1\relax + \@dtl@conditiontrue +\else + \@dtl@conditionfalse +\fi +}{% +\@dtl@conditionfalse}% +} +\newcommand*{\DTLbibfieldcontains}[2]{% +\TE@throw\noexpand\dtl@testbibfieldcontains{#1}{#2}% +\noexpand\if@dtl@condition} +\newcommand*{\dtl@testbibfieldcontains}[2]{% +\DTLifbibfieldexists{#1}{% +\expandafter\let\expandafter\@dtl@tmp\expandafter + =\csname @dtl@key@#1\endcsname +\expandafter\dtl@testifsubstring\expandafter{\@dtl@tmp}{#2}% +}{\@dtl@conditionfalse}} +\newenvironment{DTLthebibliography}[2][\boolean{true}]{% +\@dtl@tmpcount=0\relax +\@sDTLforeach[#1]{#2}{}{\advance\@dtl@tmpcount by 1\relax}% +\begin{thebibliography}{\number\@dtl@tmpcount} +}{\end{thebibliography}} +\newcommand*{\DTLmonthname}[1]{% +\dtl@monthname{#1}} +\newcommand*{\dtl@monthname}[1]{% +\ifcase#1% +\or January% +\or February% +\or March% +\or April% +\or May% +\or June% +\or July% +\or August% +\or September% +\or October% +\or November% +\or December% +\fi} +\newcommand*{\dtl@abbrvmonthname}[1]{% +\ifcase#1% +\or Jan.% +\or Feb.% +\or Mar.% +\or Apr.% +\or May% +\or June% +\or July% +\or Aug.% +\or Sept.% +\or Oct.% +\or Nov.% +\or Dec.% +\fi} +\newcommand*{\DTLbibitem}{\bibitem{\DBIBcitekey}} +\newcommand*{\DTLformatauthor}[4]{% +\DTLformatforenames{#4} +\DTLformatvon{#1}% +\DTLformatsurname{#2}% +\DTLformatjr{#3}} +\newcommand*{\DTLformateditor}[4]{% +\DTLformatforenames{#4} +\DTLformatvon{#1}% +\DTLformatsurname{#2}% +\DTLformatjr{#3}} +\newcommand*{\DTLformatedition}[1]{#1 \editionname} +\newcommand{\DTLformatarticle}{} +\newcommand{\DTLformatbook}{} +\newcommand{\DTLformatbooklet}{} +\newcommand{\DTLformatinbook}{} +\newcommand{\DTLformatincollection}{} +\newcommand{\DTLformatinproceedings}{} +\newcommand{\DTLformatmanual}{} +\newcommand{\DTLformatmastersthesis}{} +\newcommand{\DTLformatmisc}{} +\newcommand{\DTLformatphdthesis}{} +\newcommand{\DTLformatproceedings}{} +\newcommand{\DTLformattechreport}{} +\newcommand{\DTLformatunpublished}{} +\newcommand*{\DTLacmcs}{ACM Computing Surveys} +\newcommand*{\DTLacta}{Acta Informatica} +\newcommand*{\DTLcacm}{Communications of the ACM} +\newcommand*{\DTLibmjrd}{IBM Journal of Research and Development} +\newcommand*{\DTLibmsj}{IBM Systems Journal} +\newcommand*{\DTLieeese}{IEEE Transactions on Software Engineering} +\newcommand*{\DTLieeetc}{IEEE Transactions on Computers} +\newcommand*{\DTLieeetcad}{IEEE Transactions on Computer-Aided Design +of Integrated Circuits} +\newcommand*{\DTLipl}{Information Processing Letters} +\newcommand*{\DTLjacm}{Journal of the ACM} +\newcommand*{\DTLjcss}{Journal of Computer and System Sciences} +\newcommand*{\DTLscp}{Science of Computer Programming} +\newcommand*{\DTLsicomp}{SIAM Journal on Computing} +\newcommand*{\DTLtocs}{ACM Transactions on Computer Systems} +\newcommand*{\DTLtods}{ACM Transactions on Database Systems} +\newcommand*{\DTLtog}{ACM Transactions on Graphics} +\newcommand*{\DTLtoms}{ACM Transactions on Mathematical Software} +\newcommand*{\DTLtoois}{ACM Transactions on Office Information +Systems} +\newcommand*{\DTLtoplas}{ACM Transactions on Programming Languages +and Systems} +\newcommand*{\DTLtcs}{Theoretical Computer Science} +\newcommand{\dtlbst@plain}{% +\renewenvironment{DTLthebibliography}[2][\boolean{true}]{% +\@dtl@tmpcount=0\relax +\@sDTLforeach[##1]{##2}{}{\advance\@dtl@tmpcount by 1\relax}% +\begin{thebibliography}{\number\@dtl@tmpcount}% +}{\end{thebibliography}}% +\renewcommand*{\DTLbibitem}{\bibitem{\DBIBcitekey}}% +\renewcommand*{\DTLformatauthor}[4]{% +\DTLformatforenames{##4} +\DTLformatvon{##1}% +\DTLformatsurname{##2}% +\DTLformatjr{##3}} +\renewcommand*{\DTLformateditor}[4]{% +\DTLformatforenames{##4} +\DTLformatvon{##1}% +\DTLformatsurname{##2}% +\DTLformatjr{##3}} +\renewcommand*{\DTLformatedition}[1]{##1 \editionname}% +\let\DTLmonthname\dtl@monthname +\renewcommand*{\DTLacmcs}{ACM Computing Surveys} +\renewcommand*{\DTLacta}{Acta Informatica} +\renewcommand*{\DTLcacm}{Communications of the ACM} +\renewcommand*{\DTLibmjrd}{IBM Journal of Research and Development} +\renewcommand*{\DTLibmsj}{IBM Systems Journal} +\renewcommand*{\DTLieeese}{IEEE Transactions on Software Engineering} +\renewcommand*{\DTLieeetc}{IEEE Transactions on Computers} +\renewcommand*{\DTLieeetcad}{IEEE Transactions on Computer-Aided Design +of Integrated Circuits} +\renewcommand*{\DTLipl}{Information Processing Letters} +\renewcommand*{\DTLjacm}{Journal of the ACM} +\renewcommand*{\DTLjcss}{Journal of Computer and System Sciences} +\renewcommand*{\DTLscp}{Science of Computer Programming} +\renewcommand*{\DTLsicomp}{SIAM Journal on Computing} +\renewcommand*{\DTLtocs}{ACM Transactions on Computer Systems} +\renewcommand*{\DTLtods}{ACM Transactions on Database Systems} +\renewcommand*{\DTLtog}{ACM Transactions on Graphics} +\renewcommand*{\DTLtoms}{ACM Transactions on Mathematical Software} +\renewcommand*{\DTLtoois}{ACM Transactions on Office Information +Systems} +\renewcommand*{\DTLtoplas}{ACM Transactions on Programming Languages +and Systems} +\renewcommand*{\DTLtcs}{Theoretical Computer Science} +\renewcommand*{\DTLformatarticle}{% +\DTLformatauthorlist +\DTLifbibfieldexists{Author}{\DTLaddperiod}{}% +\DTLifbibfieldexists{Title}{% +\DTLstartsentencespace\DTLbibfield{Title}% +\DTLcheckbibfieldendsperiod{Title}% +\DTLaddperiod}{}% +\DTLifbibfieldexists{CrossRef}{% +\DTLformatarticlecrossref +\DTLifbibfieldexists{Pages}{\DTLaddcomma}{}% +\DTLformatpages +\DTLaddperiod +}{% no cross ref field +\DTLifbibfieldexists{Journal}{\DTLstartsentencespace +{\em\DTLbibfield{Journal}}% +\DTLcheckbibfieldendsperiod{Journal}% +\DTLifanybibfieldexists{Number,Volume,Pages,Month,Year}{% +\DTLaddcomma}{\DTLaddperiod}}{}% +\DTLformatvolnumpages +\DTLifanybibfieldexists{Volume,Number,Pages}{% +\DTLifanybibfieldexists{Year,Month}{\DTLaddcomma}{% +\DTLaddperiod}% +\DTLmidsentencefalse}{}% +\DTLformatdate +\DTLifanybibfieldexists{Year,Month}{\DTLaddperiod}{}% +}% +\DTLifbibfieldexists{Note}{\DTLstartsentencespace\DTLbibfield{Note}% +\DTLcheckbibfieldendsperiod{Note}% +\DTLaddperiod}{}% +} +\renewcommand*{\DTLformatbook}{% +\DTLifbibfieldexists{Author}{% +\DTLformatauthorlist\DTLaddperiod +}{\DTLformateditorlist\DTLifbibfieldexists{Editor}{% +\DTLaddperiod}{}}% +\DTLifbibfieldexists{Title}{\DTLstartsentencespace +{\em\DTLbibfield{Title}}% +\DTLcheckbibfieldendsperiod{Title}}{}% +\DTLifbibfieldexists{CrossRef}{% +\DTLifbibfieldexists{Title}{\DTLaddperiod}{}% +\DTLformatbookcrossref +\DTLifanybibfieldexists{Edition,Month,Year}{\DTLaddcomma +}{\DTLaddperiod}% +}{% no cross ref field +\DTLifbibfieldexists{Title}{% +\DTLifbibfieldexists{Volume}{\DTLaddcomma}{\DTLaddperiod}}{}% +\DTLformatbvolume +\DTLformatnumberseries +\DTLifanybibfieldexists{Number,Series,Volume}{\DTLaddperiod}{}% +\DTLifbibfieldexists{Publisher}{\DTLstartsentencespace +\DTLbibfield{Publisher}% +\DTLcheckbibfieldendsperiod{Publisher}% +\DTLifbibfieldexists{Address}{\DTLaddcomma}{% +\DTLifanybibfieldexists{Month,Year}{\DTLaddcomma +}{\DTLaddperiod}% +}}{}% +\DTLifbibfieldexists{Address}{\DTLstartsentencespace +\DTLbibfield{Address}% +\DTLcheckbibfieldendsperiod{Address}% +\DTLifanybibfieldexists{Month,Year}{\DTLaddcomma}{\DTLaddperiod}}{}% +}% +\DTLifbibfieldexists{Edition}{% +\protected@edef\@dtl@tmp{\DTLformatedition{\DTLbibfield{Edition}}}% +\ifDTLmidsentence + \@dtl@tmp +\else + \DTLstartsentencespace\expandafter\MakeUppercase\@dtl@tmp +\fi +\expandafter\DTLcheckendsperiod\expandafter{\@dtl@tmp}% +\DTLifanybibfieldexists{Month,Year}{\DTLaddcomma}{\DTLaddperiod}% +}{}% +\DTLformatdate +\DTLifanybibfieldexists{Year,Month}{\DTLaddperiod}{}% +\DTLifbibfieldexists{Note}{\DTLstartsentencespace +\DTLbibfield{Note}% +\DTLcheckbibfieldendsperiod{Note}% +\DTLaddperiod}{}% +}% +\renewcommand*{\DTLformatbooklet}{% +\DTLifbibfieldexists{Author}{% +\DTLformatauthorlist\DTLaddperiod}{}% +\DTLifbibfieldexists{Title}{\DTLstartsentencespace +\DTLbibfield{Title}% +\DTLcheckbibfieldendsperiod{Title}% +\DTLaddperiod}{}% +\DTLifbibfieldexists{HowPublished}{% +\DTLstartsentencespace\DTLbibfield{HowPublished}% +\DTLcheckbibfieldendsperiod{HowPublished}% +\DTLifanybibfieldexists{Address,Month,Year}{\DTLaddcomma +}{\DTLaddperiod}}{}% +\DTLifbibfieldexists{Address}{\DTLstartsentencespace +\DTLbibfield{Address}% +\DTLcheckbibfieldendsperiod{Address}% +\DTLifanybibfieldexists{Month,Year}{\DTLaddcomma}{\DTLaddperiod}}{}% +\DTLformatdate +\DTLifanybibfieldexists{Year,Month}{\DTLaddperiod}{}% +\DTLifbibfieldexists{Note}{\DTLstartsentencespace\DTLbibfield{Note}% +\DTLcheckbibfieldendsperiod{Note}% +\DTLaddperiod}{}% +}% +\renewcommand*{\DTLformatinbook}{% +\DTLifbibfieldexists{Author}{% +\DTLformatauthorlist\DTLaddperiod}{% +\DTLifbibfieldexists{Editor}{\DTLformateditorlist\DTLaddperiod}{}}% +\DTLifbibfieldexists{Title}{% +\DTLstartsentencespace +{\em\DTLbibfield{Title}}% +\DTLcheckbibfieldendsperiod{Title}% +}{}% +\DTLifbibfieldexists{CrossRef}{% +\DTLifbibfieldexists{Title}{% +\DTLifbibfieldexists{Chapter}{\DTLaddcomma}{\DTLaddperiod}}{}% +\DTLformatchapterpages +\DTLifanybibfieldexists{Chapter,Pages}{\DTLaddperiod}{}% +\DTLformatbookcrossref +}{% no cross ref +\DTLifbibfieldexists{Title}{% +\DTLifanybibfieldexists{Chapter,Volume}{\DTLaddcomma +}{\DTLaddperiod}}{}% +\DTLformatbvolume +\DTLifanybibfieldexists{Volume,Series}{% +\DTLifanybibfieldexists{Chapter,Pages}{% +\DTLaddcomma}{\DTLaddperiod}}{}% +\DTLformatchapterpages +\DTLifanybibfieldexists{Chapter,Pages}{\DTLaddperiod}{}% +\DTLifbibfieldexists{Publisher}{% +\DTLstartsentencespace +\DTLbibfield{Publisher}% +\DTLcheckbibfieldendsperiod{Publisher}% +\DTLifbibfieldexists{Address}{\DTLaddcomma}{}}{}% +\DTLifbibfieldexists{Address}{% +\DTLstartsentencespace +\DTLbibfield{Address}% +\DTLcheckbibfieldendsperiod{Address}}{}% +}% +\DTLifanybibfieldexists{Edition,Month,Year}{\DTLaddcomma +}{\DTLaddperiod}% +\DTLifbibfieldexists{Edition}{% +\protected@edef\@dtl@tmp{\DTLformatedition{\DTLbibfield{Edition}}}% +\ifDTLmidsentence + \@dtl@tmp +\else + \DTLstartsentencespace + \expandafter\MakeUppercase\@dtl@tmp +\fi +\expandafter\DTLcheckendsperiod\expandafter{\@dtl@tmp}% +\DTLifanybibfieldexists{Month,Year}{\DTLaddcomma +}{\DTLaddperiod}% +}{}% +\DTLformatdate +\DTLifanybibfieldexists{Month,Year}{\DTLaddperiod}{}% +\DTLifbibfieldexists{Note}{% +\DTLstartsentencespace +\DTLbibfield{Note}% +\DTLcheckbibfieldendsperiod{Note}% +\DTLaddperiod}{}% +}% +\renewcommand*{\DTLformatincollection}{% +\DTLifbibfieldexists{Author}{\DTLformatauthorlist\DTLaddperiod}{}% +\DTLifbibfieldexists{Title}{% +\DTLstartsentencespace +\DTLbibfield{Title}% +\DTLcheckbibfieldendsperiod{Title}% +\DTLaddperiod}{}% +\DTLifbibfieldexists{CrossRef}{% +\DTLformatincollproccrossref +\DTLifanybibfieldexists{Chapter,Pages}{\DTLaddcomma}{}% +\DTLformatchapterpages\DTLaddperiod +}{% no cross ref entry +\DTLformatinedbooktitle +\DTLifbibfieldexists{BookTitle}{% +\DTLifanybibfieldexists{Volume,Series,Chapter,Pages,Number}{% +\DTLaddcomma}{\DTLaddperiod}}{}% +\DTLformatbvolume +\DTLifbibfieldexists{Volume}{% +\DTLifanybibfieldexists{Number,Series,Chapter,Pages}{% +\DTLaddcomma}{\DTLaddperiod}}{}% +\DTLformatnumberseries +\DTLifanybibfieldexists{Number,Series}{% +\DTLifanybibfieldexists{Chapter,Pages}{\DTLaddcomma +}{\DTLaddperiod}}{}% +\DTLformatchapterpages +\DTLifanybibfieldexists{Chapter,Pages}{\DTLaddperiod}{}% +\DTLifbibfieldexists{Publisher}{% +\DTLstartsentencespace +\DTLbibfield{Publisher}% +\DTLcheckbibfieldendsperiod{Publisher}% +\DTLifanybibfieldexists{Address,Edition,Month,Year}{% +\DTLaddcomma}{\DTLaddperiod}}{}% +\DTLifbibfieldexists{Address}{% +\DTLstartsentencespace +\DTLbibfield{Address}% +\DTLcheckbibfieldendsperiod{Address}% +\DTLifanybibfieldexists{Edition,Month,Year}{% +\DTLaddcomma}{\DTLaddperiod}}{}% +\DTLifbibfieldexists{Edition}{% +\protected@edef\@dtl@tmp{\DTLformatedition{\DTLbibfield{Edition}}}% +\ifDTLmidsentence + \@dtl@tmp +\else + \DTLstartsentencespace + \expandafter\MakeUppercase\@dtl@tmp +\fi +\expandafter\DTLcheckendsperiod\expandafter{\@dtl@tmp}% +\DTLifanybibfieldexists{Month,Year}{\DTLaddcomma +}{\DTLaddperiod}% +}{}% +\DTLformatdate +\DTLifanybibfieldexists{Month,Year}{\DTLaddperiod}{}% +}% +\DTLifbibfieldexists{Note}{% +\DTLstartsentencespace +\DTLbibfield{Note}% +\DTLcheckbibfieldendsperiod{Note}% +\DTLaddperiod}{}% +}% +\renewcommand*{\DTLformatinproceedings}{% +\DTLifbibfieldexists{Author}{\DTLformatauthorlist +\DTLaddperiod}{}% +\DTLifbibfieldexists{Title}{% +\DTLstartsentencespace +\DTLbibfield{Title}% +\DTLcheckbibfieldendsperiod{Title}% +\DTLaddperiod}{}% +\DTLifbibfieldexists{CrossRef}{% +\DTLformatincollproccrossref +\DTLifbibfieldexists{Pages}{\DTLaddcomma}{% +\DTLaddperiod}% +\DTLformatpages +\DTLifbibfieldexists{Pages}{\DTLaddperiod}{}% +}{% no cross ref +\DTLformatinedbooktitle +\DTLifbibfieldexists{BookTitle}{% +\DTLifanybibfieldexists{Volume,Series,Pages,Number,Address,% +Month,Year}{% +\DTLaddcomma}{\DTLaddperiod}}{}% +\DTLformatbvolume +\DTLifbibfieldexists{Volume}{% +\DTLifanybibfieldexists{Number,Series,Pages,Address,Month,Year}{% +\DTLaddcomma}{\DTLaddperiod}}{}% +\DTLformatnumberseries +\DTLifanybibfieldexists{Number,Series}{% +\DTLifanybibfieldexists{Pages,Address,Month,Year}{% +\DTLaddcomma}{\DTLaddperiod}}{}% +\DTLformatpages +\DTLifbibfieldexists{Pages}{% +\DTLifanybibfieldexists{Address,Month,Year}{% +\DTLaddcomma}{\DTLaddperiod}}{}% +\DTLifbibfieldexists{Address}{% +\DTLstartsentencespace +\DTLbibfield{Address}% +\DTLcheckbibfieldendsperiod{Address}% +\DTLifanybibfieldexists{Month,Year}{\DTLaddcomma}{% +\DTLaddperiod}% +\DTLformatdate +\DTLifanybibfieldexists{Month,Year}{\DTLaddperiod}{}% +\DTLifbibfieldexists{Organization}{% +\DTLstartsentencespace +\DTLbibfield{Organization}% +\DTLcheckbibfieldendsperiod{Organization}% +\DTLifbibfieldexists{Publisher}{\DTLaddcomma}{% +\DTLaddperiod}}{}% +\DTLifbibfieldexists{Publisher}{% +\DTLstartsentencespace +\DTLbibfield{Publisher}% +\DTLcheckbibfieldendsperiod{Publisher}% +\DTLaddperiod}{}% +}{% +\DTLifanybibfieldexists{Publisher,Organization}{% +\DTLaddperiod}{}% +\DTLifbibfieldexists{Organization}{% +\DTLstartsentencespace +\DTLbibfield{Organization}% +\DTLcheckbibfieldendsperiod{Organization}% +\DTLifanybibfieldexists{Publisher,Month,Year}{% +\DTLaddcomma}{}}{}% +\DTLifbibfieldexists{Publisher}{% +\DTLstartsentencespace +\DTLbibfield{Publisher}% +\DTLcheckbibfieldendsperiod{Publisher}% +\DTLifanybibfieldexists{Month,Year}{\DTLaddcomma}{% +\DTLaddperiod}}{}% +\DTLformatdate +\DTLifanybibfieldexists{Month,Year}{\DTLaddperiod}{}% +}% +}% +\DTLifbibfieldexists{Note}{% +\DTLstartsentencespace +\DTLbibfield{Note}% +\DTLcheckbibfieldendsperiod{Note}% +\DTLaddperiod}{}% +}% +\renewcommand*{\DTLformatmanual}{% +\DTLifbibfieldexists{Author}{\DTLformatauthorlist +\DTLaddperiod}{% +\DTLifbibfieldexists{Organization}{% +\DTLstartsentencespace +\DTLbibfield{Organization}% +\DTLcheckbibfieldendsperiod{Organization}% +\DTLifbibfieldexists{Address}{\DTLaddcomma \DTLbibfield{Address}% +\DTLcheckbibfieldendsperiod{Address}% +}{}% +\DTLaddperiod}{}% +}% +\DTLifbibfieldexists{Title}{% +\DTLstartsentencespace +{\em\DTLbibfield{Title}}% +\DTLcheckbibfieldendsperiod{Title}% +\DTLifbibfieldexists{Author}{% +\DTLifanybibfieldexists{Organization,Address}{% +\DTLaddperiod}{\DTLaddcomma}}{% +\DTLifanybibfieldexists{Organization,Address,Edition,Month,Year}{% +\DTLaddcomma}{\DTLaddperiod}}}{}% +\DTLifbibfieldexists{Author}{% +\DTLifbibfieldexists{Organization}{% +\DTLstartsentencespace +\DTLbibfield{Organization}% +\DTLcheckbibfieldendsperiod{Organization}% +\DTLifanybibfieldexists{Address,Edition,Month,Year}{% +\DTLaddcomma}{\DTLaddperiod}}{}% +\DTLifbibfieldexists{Address}{% +\DTLstartsentencespace +\DTLbibfield{Address}% +\DTLcheckbibfieldendsperiod{Address}% +\DTLifanybibfieldexists{Edition,Month,Year}{% +\DTLaddcomma}{\DTLaddperiod}}{}% +}{% +\DTLifbibfieldexists{Organization}{}{% +\DTLifbibfieldexists{Address}{% +\DTLstartsentencespace +\DTLbibfield{Address}% +\DTLcheckbibfieldendsperiod{Address}% +\DTLifanybibfieldexists{Edition,Month,Year}{\DTLaddcomma}{% +\DTLaddperiod}}{}}% +}% +\DTLifbibfieldexists{Edition}{% +\protected@edef\@dtl@tmp{\DTLformatedition{\DTLbibfield{Edition}}}% +\ifDTLmidsentence + \@dtl@tmp +\else + \DTLstartsentencespace + \expandafter\MakeUppercase\@dtl@tmp +\fi +\expandafter\DTLcheckendsperiod\expandafter{\@dtl@tmp}% +\DTLifanybibfieldexists{Month,Year}{\DTLaddcomma}{% +\DTLaddperiod}}{}% +\DTLformatdate +\DTLifanybibfieldexists{Month,Year}{\DTLaddperiod}{}% +\DTLifbibfieldexists{Note}{% +\DTLstartsentencespace +\DTLbibfield{Note}% +\DTLcheckbibfieldendsperiod{Note}% +\DTLaddperiod}{}% +}% +\renewcommand*{\DTLformatmastersthesis}{% +\DTLifbibfieldexists{Author}{\DTLformatauthorlist\DTLaddperiod}{}% +\DTLifbibfieldexists{Title}{% +\DTLstartsentencespace +\DTLbibfield{Title}% +\DTLcheckbibfieldendsperiod{Title}% +\DTLaddperiod}{}% +\DTLifbibfieldexists{Type}{% +\DTLstartsentencespace +\DTLbibfield{Type}% +\DTLcheckbibfieldendsperiod{Type}% +\DTLifanybibfieldexists{School,Address,Month,Year}{% +\DTLaddcomma}{\DTLaddperiod}}{}% +\DTLifbibfieldexists{School}{% +\DTLstartsentencespace +\DTLbibfield{School}% +\DTLcheckbibfieldendsperiod{School}% +\DTLifanybibfieldexists{Address,Month,Year}{% +\DTLaddcomma}{\DTLaddperiod}}{}% +\DTLifbibfieldexists{Address}{% +\DTLstartsentencespace +\DTLbibfield{Address}% +\DTLcheckbibfieldendsperiod{Address}% +\DTLifanybibfieldexists{Month,Year}{% +\DTLaddcomma}{\DTLaddperiod}}{}% +\DTLformatdate +\DTLifanybibfieldexists{Month,Year}{\DTLaddperiod}{}% +\DTLifbibfieldexists{Note}{% +\DTLstartsentencespace +\DTLbibfield{Note}% +\DTLcheckbibfieldendsperiod{Note}% +\DTLaddperiod}{}% +}% +\renewcommand*{\DTLformatmisc}{% +\DTLifbibfieldexists{Author}{\DTLformatauthorlist\DTLaddperiod}{}% +\DTLifbibfieldexists{Title}{% +\DTLstartsentencespace +\DTLbibfield{Title}% +\DTLcheckbibfieldendsperiod{Title}% +\DTLifbibfieldexists{HowPublished}{\DTLaddperiod}{% +\DTLifanybibfieldexists{Month,Year}{\DTLaddcomma}{% +\DTLaddperiod}% +}% +\DTLmidsentencefalse}{}% +\DTLifbibfieldexists{HowPublished}{% +\DTLstartsentencespace +\DTLbibfield{HowPublished}% +\DTLcheckbibfieldendsperiod{HowPublished}% +\DTLifanybibfieldexists{Month,Year}{\DTLaddcomma}{% +\DTLaddperiod}}{}% +\DTLformatdate +\DTLifanybibfieldexists{Month,Year}{\DTLaddperiod}{}% +\DTLifbibfieldexists{Note}{% +\DTLstartsentencespace +\DTLbibfield{Note}% +\DTLcheckbibfieldendsperiod{Note}% +\DTLaddperiod}{}% +}% +\renewcommand*{\DTLformatphdthesis}{% +\DTLifbibfieldexists{Author}{\DTLformatauthorlist\DTLaddperiod}{}% +\DTLifbibfieldexists{Title}{% +\DTLstartsentencespace +{\em\DTLbibfield{Title}}% +\DTLcheckbibfieldendsperiod{Title}% +\DTLaddperiod}{}% +\DTLifbibfieldexists{Type}{% +\DTLstartsentencespace +\DTLbibfield{Type}% +\DTLcheckbibfieldendsperiod{Type}% +\DTLifanybibfieldexists{School,Address,Month,Year}{% +\DTLaddcomma}{\DTLaddperiod}}{}% +\DTLifbibfieldexists{School}{% +\DTLstartsentencespace +\DTLbibfield{School}% +\DTLcheckbibfieldendsperiod{School}% +\DTLifanybibfieldexists{Address,Month,Year}{% +\DTLaddcomma}{\DTLaddperiod}}{}% +\DTLifbibfieldexists{Address}{% +\DTLstartsentencespace +\DTLbibfield{Address}% +\DTLcheckbibfieldendsperiod{Address}% +\DTLifanybibfieldexists{Month,Year}{% +\DTLaddcomma}{\DTLaddperiod}}{}% +\DTLformatdate +\DTLifanybibfieldexists{Month,Year}{\DTLaddperiod}{}% +\DTLifbibfieldexists{Note}{% +\DTLstartsentencespace +\DTLbibfield{Note}% +\DTLcheckbibfieldendsperiod{Note}% +\DTLaddperiod}{}% +}% +\renewcommand*{\DTLformatproceedings}{% +\DTLifbibfieldexists{Editor}{% +\DTLformateditorlist\DTLaddperiod}{% +\DTLifbibfieldexists{Organization}{% +\DTLstartsentencespace +\DTLbibfield{Organization}% +\DTLcheckbibfieldendsperiod{Organization}% +\DTLaddperiod}{}}% +\DTLifbibfieldexists{Title}{% +\DTLstartsentencespace +{\em\DTLbibfield{Title}}% +\DTLcheckbibfieldendsperiod{Title}% +\DTLifanybibfieldexists{Volume,Number,Address,Editor,Publisher,% +Month,Year}{\DTLaddcomma}{\DTLaddperiod}% +}{}% +\DTLformatbvolume +\DTLifbibfieldexists{Volume}{% +\DTLifanybibfieldexists{Number,Address,Editor,Publisher,% +Month,Year}{\DTLaddcomma}{\DTLaddperiod}}{}% +\DTLformatnumberseries +\DTLifbibfieldexists{Number}{% +\DTLifanybibfieldexists{Address,Editor,Publisher,% +Month,Year}{\DTLaddcomma}{\DTLaddperiod}}{}% +\DTLifbibfieldexists{Address}{% +\DTLstartsentencespace +\DTLbibfield{Address}% +\DTLcheckbibfieldendsperiod{Address}% +\DTLifanybibfieldexists{Month,Year}{\DTLaddcomma}{\DTLaddperiod}% +\DTLformatdate +\DTLifanybibfieldexists{Month,Year}{\DTLaddperiod}{}% +\DTLifbibfieldexists{Editor}{\DTLifbibfieldexists{Organization}{% +\DTLstartsentencespace +\DTLbibfield{Organization}% +\DTLcheckbibfieldendsperiod{Organization}% +\DTLifbibfieldexists{Publisher}{% +\DTLaddcomma}{\DTLaddperiod}}{}}{}% +\DTLifbibfieldexists{Publisher}{% +\DTLstartsentencespace +\DTLbibfield{Publisher}% +\DTLcheckbibfieldendsperiod{Publisher}% +\DTLaddperiod +}{}% +}{% no address +\DTLifbibfieldexists{Editor}{% +\DTLifbibfieldexists{Organization}{% +\DTLstartsentencespace +\DTLbibfield{Organization}% +\DTLcheckbibfieldendsperiod{Organization}% +\DTLifanybibfieldexists{Publisher,Month,Year}{% +\DTLaddcomma}{\DTLaddperiod}}{}% +}{}% +\DTLifbibfieldexists{Publisher}{% +\DTLstartsentencespace +\DTLbibfield{Publisher}% +\DTLcheckbibfieldendsperiod{Publisher}% +\DTLifanybibfieldexists{Month,Year}{\DTLaddcomma}{\DTLaddperiod}}{}% +\DTLformatdate +\DTLifanybibfieldexists{Month,Year}{\DTLaddperiod}{}% +}% +\DTLifbibfieldexists{Note}{% +\DTLstartsentencespace +\DTLbibfield{Note}% +\DTLcheckbibfieldendsperiod{Note}% +\DTLaddperiod}{}% +}% +\renewcommand*{\DTLformattechreport}{% +\DTLifbibfieldexists{Author}{\DTLformatauthorlist\DTLaddperiod}{}% +\DTLifbibfieldexists{Title}{% +\DTLstartsentencespace +\DTLbibfield{Title}% +\DTLcheckbibfieldendsperiod{Title}% +\DTLaddperiod}{}% +\DTLifbibfieldexists{Type}{% +\DTLstartsentencespace +\DTLbibfield{Type}% +\DTLcheckbibfieldendsperiod{Type}% +\DTLifbibfieldexists{Number}{~}{}}{}% +\DTLifbibfieldexists{Number}{% +\DTLstartsentencespace +\DTLbibfield{Number}% +\DTLcheckbibfieldendsperiod{Number}% +}{}% +\DTLifanybibfieldexists{Type,Number}{% +\DTLifanybibfieldexists{Institution,Address,Month,Year}{\DTLaddcomma +}{\DTLaddperiod}}{}% +\DTLifbibfieldexists{Institution}{% +\DTLstartsentencespace +\DTLbibfield{Institution}% +\DTLcheckbibfieldendsperiod{Institution}% +\DTLifanybibfieldexists{Address,Month,Year}{\DTLaddcomma +}{\DTLaddperiod}}{}% +\DTLifbibfieldexists{Address}{% +\DTLstartsentencespace +\DTLbibfield{Address}% +\DTLcheckbibfieldendsperiod{Address}% +\DTLifanybibfieldexists{Month,Year}{\DTLaddcomma +}{\DTLaddperiod}}{}% +\DTLformatdate +\DTLifanybibfieldexists{Month,Year}{\DTLaddperiod}{}% +\DTLifbibfieldexists{Note}{% +\DTLstartsentencespace +\DTLbibfield{Note}% +\DTLcheckbibfieldendsperiod{Note}% +\DTLaddperiod}{}% +}% +\renewcommand*{\DTLformatunpublished}{% +\DTLifbibfieldexists{Author}{\DTLformatauthorlist\DTLaddperiod}{}% +\DTLifbibfieldexists{Title}{% +\DTLstartsentencespace +\DTLbibfield{Title}% +\DTLcheckbibfieldendsperiod{Title}% +\DTLaddperiod}{}% +\DTLifbibfieldexists{Note}{% +\DTLstartsentencespace +\DTLbibfield{Note}% +\DTLcheckbibfieldendsperiod{Note}% +\DTLifanybibfieldexists{Month,Year}{\DTLaddcomma}{\DTLaddperiod}}{}% +\DTLformatdate +\DTLifanybibfieldexists{Month,Year}{\DTLaddperiod}{}% +}% +} +\newcommand{\dtlbst@abbrv}{% +\dtlbst@plain +\renewcommand*{\DTLformatauthor}[4]{% +\DTLformatabbrvforenames{##4} +\DTLformatvon{##1}% +\DTLformatsurname{##2}% +\DTLformatjr{##3}} +\renewcommand*{\DTLformateditor}[4]{% +\DTLformatabbrvforenames{##4} +\DTLformatvon{##1}% +\DTLformatsurname{##2}% +\DTLformatjr{##3}} +\let\DTLmonthname\dtl@abbrvmonthname +\renewcommand*{\DTLacmcs}{ACM Comput.\ Surv.} +\renewcommand*{\DTLacta}{Acta Inf.} +\renewcommand*{\DTLcacm}{Commun.\ ACM} +\renewcommand*{\DTLibmjrd}{IBM J.\ Res.\ Dev.} +\renewcommand*{\DTLibmsj}{IBM Syst.~J.} +\renewcommand*{\DTLieeese}{IEEE Trans. Softw.\ Eng.} +\renewcommand*{\DTLieeetc}{IEEE Trans.\ Comput.} +\renewcommand*{\DTLieeetcad}{IEEE Trans.\ Comput.-Aided Design +Integrated Circuits} +\renewcommand*{\DTLipl}{Inf.\ Process.\ Lett.} +\renewcommand*{\DTLjacm}{J.~ACM} +\renewcommand*{\DTLjcss}{J.~Comput.\ Syst.\ Sci.} +\renewcommand*{\DTLscp}{Sci.\ Comput.\ Programming} +\renewcommand*{\DTLsicomp}{SIAM J.~Comput.} +\renewcommand*{\DTLtocs}{ACM Trans.\ Comput.\ Syst.} +\renewcommand*{\DTLtods}{ACM Trans.\ Database Syst.} +\renewcommand*{\DTLtog}{ACM Trans.\ Gr.} +\renewcommand*{\DTLtoms}{ACM Trans.\ Math. Softw.} +\renewcommand*{\DTLtoois}{ACM Trans. Office Inf.\ Syst.} +\renewcommand*{\DTLtoplas}{ACM Trans.\ Prog. Lang.\ Syst.} +\renewcommand*{\DTLtcs}{Theoretical Comput.\ Sci.} +} +\newcommand{\dtlbst@alpha}{% +\dtlbst@plain +\renewenvironment{DTLthebibliography}[2][\boolean{true}]{% +\dtl@createalphabiblabels{##1}{##2}% +\begin{thebibliography}{\@dtl@widestlabel}% +}{\end{thebibliography}}% +\renewcommand*{\DTLbibitem}{% +\expandafter\bibitem\expandafter + [\csname dtl@biblabel@\DBIBcitekey\endcsname]{\DBIBcitekey}}% +} +\newcommand*{\dtl@createalphabiblabels}[2]{% +\dtl@message{Creating bib labels}% +\begingroup +\gdef\@dtl@widestlabel{}% +\dtl@widest=0pt\relax +\DTLforeachbibentry[#1]{#2}{% +\dtl@message{\DBIBcitekey}% +\DTLifbibfieldexists{Author}{% + \dtl@listgetalphalabel{\@dtl@thislabel}{\@dtl@key@Author}% +}{% +\DTLifbibfieldexists{Editor}{% + \dtl@listgetalphalabel{\@dtl@thislabel}{\@dtl@key@Editor}% + }{% + \DTLifbibfieldexists{Key}{% + \expandafter\dtl@get@firstthree\expandafter + {\@dtl@key@Key}{\@dtl@thislabel}% + }{% + \DTLifbibfieldexists{Organization}{% + \expandafter\dtl@get@firstthree\expandafter + {\@dtl@key@Organization}{\@dtl@thislabel}% + }{% + \expandafter\dtl@get@firstthree\expandafter + {\DBIBentrytype}{\@dtl@thislabel}% + }% + }}}% +\DTLifbibfieldexists{Year}{}{\DTLifbibfieldexists{CrossRef}{% +\DTLgetvalueforkey{\@dtl@key@Year}{Year}{#2}{CiteKey}{% +\@dtl@key@CrossRef}}{}}% +\DTLifbibfieldexists{Year}{% +\expandafter\dtl@get@yearsuffix\expandafter{\@dtl@key@Year}% +\expandafter\toks@\expandafter{\@dtl@thislabel}% +\expandafter\@dtl@toks\expandafter{\@dtl@year}% +\edef\@dtl@thislabel{\the\toks@\the\@dtl@toks}% +}{}% +\let\@dtl@s@thislabel=\@dtl@thislabel +\@onelevel@sanitize\@dtl@s@thislabel +\@ifundefined{c@biblabel@\@dtl@s@thislabel}{% +\newcounter{biblabel@\@dtl@s@thislabel}% +\setcounter{biblabel@\@dtl@s@thislabel}{1}% +\expandafter\edef\csname @dtl@bibfirst@\@dtl@s@thislabel\endcsname{% +\DBIBcitekey}% +\expandafter\global +\expandafter\let\csname dtl@biblabel@\DBIBcitekey\endcsname= + \@dtl@thislabel +}{% +\expandafter\ifnum\csname c@biblabel@\@dtl@s@thislabel\endcsname=1\relax + \expandafter\let\expandafter\@dtl@tmp + \csname @dtl@bibfirst@\@dtl@s@thislabel\endcsname + \expandafter\protected@xdef\csname dtl@biblabel@\@dtl@tmp\endcsname{% + \@dtl@thislabel a}% +\fi +\stepcounter{biblabel@\@dtl@s@thislabel}% +\expandafter\protected@xdef\csname dtl@biblabel@\DBIBcitekey\endcsname{% + \@dtl@thislabel\alph{biblabel@\@dtl@s@thislabel}}% +}% +\settowidth{\dtl@tmplength}{% + \csname dtl@biblabel@\DBIBcitekey\endcsname}% +\ifdim\dtl@tmplength>\dtl@widest + \dtl@widest=\dtl@tmplength + \expandafter\global\expandafter\let\expandafter\@dtl@widestlabel + \expandafter=\csname dtl@biblabel@\DBIBcitekey\endcsname +\fi +}% +\endgroup +} +\newcommand*{\dtl@listgetalphalabel}[2]{% +\@dtl@authorcount=0\relax +\@for\@dtl@author:=#2\do{% +\advance\@dtl@authorcount by 1\relax}% +\ifnum\@dtl@authorcount=1\relax + \expandafter\dtl@getsinglealphalabel#2{#1}\relax +\else + {% + \xdef#1{}% + \@dtl@tmpcount=0\relax + \def\DTLafterinitials{}\def\DTLbetweeninitials{}% + \def\DTLafterinitialbeforehyphen{}\def\DTLinitialhyphen{}% + \@for\@dtl@author:=#2\do{% + \expandafter\dtl@getauthorinitial\@dtl@author + \expandafter\toks@\expandafter{\@dtl@tmp}% + \expandafter\@dtl@toks\expandafter{#1}% + \xdef#1{\the\@dtl@toks\the\toks@}% + \advance\@dtl@tmpcount by 1\relax + \ifnum\@dtl@tmpcount>2\relax\@endfortrue\fi + }}% +\fi +} +\newcommand*{\dtl@getauthorinitial}[4]{% +\def\@dtl@vonpart{#1}% +\ifx\@dtl@vonpart\@empty + \DTLstoreinitials{#2}{\@dtl@tmp}% +\else + \DTLstoreinitials{#1 #2}{\@dtl@tmp}% +\fi} +\newcommand*{\dtl@getsinglealphalabel}[5]{% +\def\@dtl@vonpart{#1}% +\ifx\@dtl@vonpart\@empty + \DTLifSubString{#2}{-}{% + {\def\DTLafterinitials{}\def\DTLbetweeninitials{}% + \def\DTLafterinitialbeforehyphen{}% + \def\DTLinitialhyphen{}% + \DTLstoreinitials{#2}{\@dtl@tmp}\global\let#5=\@dtl@tmp}% + }{% + \dtl@getfirstthree{#5}#2{}{}{}{}\@nil + } +\else + {\def\DTLafterinitials{}\def\DTLbetweeninitials{}% + \def\DTLafterinitialbeforehyphen{}% + \def\DTLinitialhyphen{}% + \DTLstoreinitials{#1 #2}{\@dtl@tmp}\global\let#5=\@dtl@tmp}% +\fi +} +\def\dtl@getfirstthree#1#2#3#4#5\@nil{% + \def#1{#2#3#4}% +} +\newcommand*{\dtl@get@firstthree}[2]{% +\dtl@getfirstthree#2#1{}{}{}{}{}\@nil} +\newcommand*{\dtl@get@yearsuffix}[1]{% +\dtl@getyearsuffix#1\@nil\relax\relax} + +\def\dtl@getyearsuffix#1#2#3{% +\def\@dtl@argi{#1}\def\@dtl@argii{#2}% +\def\@dtl@argiii{#3}% +\ifx\@dtl@argi\@nnil + \def\@dtl@year{}% + \let\@dtl@donext=\relax +\else + \ifx\@dtl@argii\@nnil + \dtl@ifsingle{#1}{% + \def\@dtl@year{#1}% + \let\@dtl@donext=\relax + }{% + \def\@dtl@donext{\dtl@getyearsuffix#1#2#3}% + }% + \else + \ifx\@dtl@argiii\@nnil + \dtl@ifsingle{#1}{% + \dtl@ifsingle{#2}{% + \def\@dtl@year{#1#2}% + \let\@dtl@donext=\relax + }{% + \def\@dtl@donext{\dtl@getyearsuffix#2#3}% + }% + }{% + \def\@dtl@donext{\dtl@getyearsuffix#2#3}% + }% + \else + \def\@dtl@donext{\dtl@getyearsuffix{#2}{#3}}% + \fi + \fi +\fi +\@dtl@donext +} +\newcommand*{\DTLbibliographystyle}[1]{% +\@ifundefined{dtlbst@#1}{\PackageError{databib}{Unknown +bibliography style `#1'}{}}{\csname dtlbst@#1\endcsname}} +\DTLbibliographystyle{\dtlbib@style} +\endinput +%% +%% End of file `databib.sty'. diff --git a/Master/texmf-dist/tex/latex/datatool/datapie.sty b/Master/texmf-dist/tex/latex/datatool/datapie.sty new file mode 100644 index 00000000000..418f8a045a2 --- /dev/null +++ b/Master/texmf-dist/tex/latex/datatool/datapie.sty @@ -0,0 +1,351 @@ +%% +%% 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 2007 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.sty, datapie.sty, dataplot.sty, databar.sty, databib.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}[2007/08/17 v1.01 (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'. diff --git a/Master/texmf-dist/tex/latex/datatool/dataplot.sty b/Master/texmf-dist/tex/latex/datatool/dataplot.sty new file mode 100644 index 00000000000..83eaef56ebb --- /dev/null +++ b/Master/texmf-dist/tex/latex/datatool/dataplot.sty @@ -0,0 +1,917 @@ +%% +%% This is file `dataplot.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% datatool.dtx (with options: `dataplot.sty,package') +%% +%% datatool.dtx +%% Copyright 2007 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.sty, datapie.sty, dataplot.sty, databar.sty, databib.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{dataplot}[2007/08/17 v1.01 (NLCT)] +\RequirePackage{xkeyval} +\RequirePackage{tikz} +\RequirePackage{datatool} +\usetikzlibrary{plotmarks} +\usetikzlibrary{plothandlers} +\newcommand*{\DTLplotstream}[4][\boolean{true}]{% +\@sDTLforeach[#1]{#2}{\dtl@x=#3,\dtl@y=#4}{% +\DTLconverttodecimal{\dtl@x}{\dtl@decx}% +\DTLconverttodecimal{\dtl@y}{\dtl@decy}% +\pgfplotstreampoint{\pgfpointxy{\dtl@decx}{\dtl@decy}}}} +\newcommand*{\DTLplotmarks}{% +\pgfuseplotmark{o},% +\pgfuseplotmark{x},% +\pgfuseplotmark{+},% +\pgfuseplotmark{square},% +\pgfuseplotmark{triangle},% +\pgfuseplotmark{diamond},% +\pgfuseplotmark{pentagon},% +\pgfuseplotmark{asterisk},% +\pgfuseplotmark{star}} +\newcommand*{\DTLplotmarkcolors}{% +red,% +green,% +blue,% +yellow,% +magenta,% +cyan,% +orange,% +black,% +gray} +\newcommand*{\DTLplotlines}{% +\pgfsetdash{}{{0pt}},% solid line +\pgfsetdash{{10pt}{5pt}}{0pt},% +\pgfsetdash{{5pt}{5pt}}{0pt},% +\pgfsetdash{{1pt}{5pt}}{0pt},% +\pgfsetdash{{5pt}{5pt}{1pt}{5pt}}{0pt},% +\pgfsetdash{{1pt}{3pt}}{0pt},% +} +\newcommand*{\DTLplotlinecolors}{% +red,% +green,% +blue,% +yellow,% +magenta,% +cyan,% +orange,% +black,% +gray} +\newlength\DTLplotwidth +\setlength\DTLplotwidth{4in} +\newlength\DTLplotheight +\setlength\DTLplotheight{4in} +\newlength\DTLticklength +\setlength\DTLticklength{5pt} +\newlength\DTLminorticklength +\setlength\DTLminorticklength{2pt} +\newlength\DTLticklabeloffset +\setlength\DTLticklabeloffset{8pt} +\newlength\dtl@xticlabelheight +\newlength\dtl@yticlabelwidth +\newlength\DTLmintickgap +\setlength\DTLmintickgap{20pt} +\newlength\DTLminminortickgap +\setlength\DTLminminortickgap{5pt} +\newcounter{DTLplotroundXvar} +\setcounter{DTLplotroundXvar}{2} +\newcounter{DTLplotroundYvar} +\setcounter{DTLplotroundYvar}{2} +\newif\ifDTLxaxis +\DTLxaxistrue +\newcommand*{\DTLXAxisStyle}{-} +\newif\ifDTLyaxis +\DTLyaxistrue +\newcommand*{\DTLYAxisStyle}{-} +\newcommand*{\DTLmajorgridstyle}{color=gray,-} +\newcommand*{\DTLminorgridstyle}{color=gray,loosely dotted} +\newif\ifDTLxticsin +\DTLxticsintrue +\newif\ifDTLyticsin +\DTLyticsintrue +\newcount\dtl@legendsetting +\newlength\DTLlegendxoffset +\setlength\DTLlegendxoffset{10pt} +\newlength\DTLlegendyoffset +\setlength\DTLlegendyoffset{10pt} +\newcommand*{\DTLformatlegend}[1]{% +\setlength{\fboxrule}{1.1pt}% +\fcolorbox{black}{white}{#1}} +\newif\ifDTLshowmarkers +\DTLshowmarkerstrue +\newif\ifDTLshowlines +\DTLshowlinesfalse +\newcommand*{\DTLplotatbegintikz}{} +\newcommand*{\DTLplotatendtikz}{} +\define@key{dataplot}{x}{% +\def\dtl@xkey{#1}} +\define@key{dataplot}{y}{% +\def\dtl@ykey{#1}} +\define@key{dataplot}{markcolors}{% +\def\DTLplotmarkcolors{#1}} +\define@key{dataplot}{linecolors}{% +\def\DTLplotlinecolors{#1}} +\define@key{dataplot}{colors}{% +\def\DTLplotmarkcolors{#1}% +\def\DTLplotlinecolors{#1}} +\define@key{dataplot}{marks}{% +\def\DTLplotmarks{#1}} +\define@key{dataplot}{lines}{% +\def\DTLplotlines{#1}} +\define@key{dataplot}{width}{% +\setlength\DTLplotwidth{#1}} +\define@key{dataplot}{height}{% +\setlength\DTLplotheight{#1}} +\define@choicekey{dataplot}{style}[\val\nr]{both,lines,markers}{% +\ifcase\nr\relax + \DTLshowlinestrue + \DTLshowmarkerstrue +\or + \DTLshowlinestrue + \DTLshowmarkersfalse +\or + \DTLshowmarkerstrue + \DTLshowlinesfalse +\fi} +\define@choicekey{dataplot}{axes}[\val\nr]{both,x,y,none}[both]{% +\ifcase\nr\relax + % both + \DTLxaxistrue + \DTLxticstrue + \DTLyaxistrue + \DTLyticstrue +\or % x + \DTLxaxistrue + \DTLxticstrue + \DTLyaxisfalse + \DTLyticsfalse +\or % y + \DTLxaxisfalse + \DTLxticsfalse + \DTLyaxistrue + \DTLyticstrue +\or % none + \DTLxaxisfalse + \DTLxticsfalse + \DTLyaxisfalse + \DTLyticsfalse +\fi +} +\define@boolkey{dataplot}[DTL]{box}[true]{} +\DTLboxfalse +\define@boolkey{dataplot}[DTL]{xtics}[true]{} +\DTLxticstrue +\define@boolkey{dataplot}[DTL]{ytics}[true]{} +\DTLyticstrue +\define@boolkey{dataplot}[DTL]{xminortics}[true]{% +\ifDTLxminortics \DTLxticstrue\fi} +\DTLxminorticsfalse +\define@boolkey{dataplot}[DTL]{yminortics}[true]{% +\ifDTLyminortics \DTLyticstrue\fi} +\DTLyminorticsfalse +\define@boolkey{dataplot}[DTL]{grid}[true]{} +\define@choicekey{dataplot}{xticdir}[\val\nr]{in,out}{% +\ifcase\nr\relax + \DTLxticsintrue +\or + \DTLxticsinfalse +\fi +} +\define@choicekey{dataplot}{yticdir}[\val\nr]{in,out}{% +\ifcase\nr\relax + \DTLyticsintrue +\or + \DTLyticsinfalse +\fi +} +\define@choicekey{dataplot}{ticdir}[\val\nr]{in,out}{% +\ifcase\nr\relax + \DTLxticsintrue + \DTLyticsintrue +\or + \DTLxticsinfalse + \DTLyticsinfalse +\fi +} +\define@key{dataplot}{bounds}{% +\def\dtl@bounds{#1}} +\let\dtl@bounds=\relax +\define@key{dataplot}{minx}{% +\def\dtl@minx{#1}} +\let\dtl@minx=\relax +\define@key{dataplot}{maxx}{% +\def\dtl@maxx{#1}} +\let\dtl@maxx=\relax +\define@key{dataplot}{miny}{% +\def\dtl@miny{#1}} +\let\dtl@miny=\relax +\define@key{dataplot}{maxy}{% +\def\dtl@maxy{#1}} +\let\dtl@maxy=\relax +\define@key{dataplot}{xticpoints}{% +\def\dtl@xticlist{#1}\DTLxticstrue\DTLxaxistrue} +\let\dtl@xticlist=\relax +\define@key{dataplot}{yticpoints}{% +\def\dtl@yticlist{#1}\DTLyticstrue\DTLyaxistrue} +\let\dtl@yticlist=\relax +\define@key{dataplot}{xticgap}{\def\dtl@xticgap{#1}% +\DTLxticstrue\DTLxaxistrue} +\let\dtl@xticgap=\relax +\define@key{dataplot}{yticgap}{\def\dtl@yticgap{#1}% +\DTLyticstrue\DTLyaxistrue} +\let\dtl@yticgap=\relax +\define@key{dataplot}{xticlabels}{% +\def\dtl@xticlabels{#1}\DTLxticstrue\DTLxaxistrue} +\let\dtl@xticlabels=\relax +\define@key{dataplot}{yticlabels}{% +\def\dtl@yticlabels{#1}\DTLyticstrue\DTLyaxistrue} +\let\dtl@yticlabels=\relax +\define@key{dataplot}{xlabel}{% +\def\dtl@xlabel{#1}} +\let\dtl@xlabel=\relax +\define@key{dataplot}{ylabel}{% +\def\dtl@ylabel{#1}} +\let\dtl@ylabel=\relax +\define@choicekey{dataplot}{legend}[\val\nr]{none,north,northeast,% +east,southeast,south,southwest,west,northwest}[northeast]{% +\dtl@legendsetting=\nr\relax +} +\define@key{dataplot}{legendlabels}{\def\dtl@legendlabels{#1}} +\newcommand*{\DTLplot}[3][\boolean{true}]{{% +\let\dtl@xkey=\relax +\let\dtl@ykey=\relax +\let\dtl@legendlabels=\relax +\setkeys{dataplot}{#3}% +\let\dtl@plotmarklist=\DTLplotmarks +\let\dtl@plotlinelist=\DTLplotlines +\let\dtl@plotmarkcolorlist=\DTLplotmarkcolors +\let\dtl@plotlinecolorlist=\DTLplotlinecolors +\def\dtl@legend{}% +\ifx\dtl@legendlabels\relax + \edef\dtl@legendlabels{#2}% +\fi +\ifx\dtl@xkey\relax + \PackageError{dataplot}{Missing x setting for + \string\DTLplot}{}% +\else + \ifx\dtl@ykey\relax + \PackageError{dataplot}{Missing y setting for + \string\DTLplot}{}% + \else + \ifx\dtl@bounds\relax + \DTLcomputebounds[#1]{#2}{\dtl@xkey}{\dtl@ykey} + {\DTLminX}{\DTLminY}{\DTLmaxX}{\DTLmaxY}% + \ifx\dtl@minx\relax + \else + \let\DTLminX=\dtl@minx + \fi + \ifx\dtl@maxx\relax + \else + \let\DTLmaxX=\dtl@maxx + \fi + \ifx\dtl@miny\relax + \else + \let\DTLminY=\dtl@miny + \fi + \ifx\dtl@maxy\relax + \else + \let\DTLmaxY=\dtl@maxy + \fi + \else + \expandafter\dtl@getbounds\dtl@bounds\@nil + \fi + \@dtl@tmpcount=\DTLplotwidth + \FPsub{\dtl@dx}{\DTLmaxX}{\DTLminX}% + \FPdiv{\dtl@unit@x}{\number\@dtl@tmpcount}{\dtl@dx}% + \@dtl@tmpcount=\DTLplotheight + \FPsub{\dtl@dy}{\DTLmaxY}{\DTLminY}% + \FPdiv{\dtl@unit@y}{\number\@dtl@tmpcount}{\dtl@dy}% + \ifDTLxtics + \ifx\dtl@xticlist\relax + \ifx\dtl@xticgap\relax + \dtl@constructticklist\DTLminX\DTLmaxX + \dtl@unit@x\dtl@xticlist + \else + \DTLifFPopenbetween{0}{\DTLminX}{\DTLmaxX}{% + \dtl@constructticklistwithgapz + \DTLminX\DTLmaxX\dtl@xticlist\dtl@xticgap}{% + \dtl@constructticklistwithgap + \DTLminX\DTLmaxX\dtl@xticlist\dtl@xticgap}% + \fi + \fi + \let\dtl@xminorticlist\@empty + \ifDTLxminortics + \let\dtl@prevtick=\relax + \@for\dtl@nexttick:=\dtl@xticlist\do{% + \ifx\dtl@prevtick\relax + \else + \dtl@constructminorticklist + \dtl@prevtick\dtl@nexttick\dtl@unit@x\dtl@xminorticlist + \fi + \let\dtl@prevtick=\dtl@nexttick + }% + \fi + \ifx\dtl@xticlabels\relax + \settoheight{\dtl@xticlabelheight}{\dtl@xticlist}% + \else + \settoheight{\dtl@xticlabelheight}{\dtl@xticlabels}% + \fi + \else + \setlength{\dtl@xticlabelheight}{0pt}% + \fi + \setlength{\dtl@yticlabelwidth}{0pt}% + \ifDTLytics + \ifx\dtl@yticlist\relax + \ifx\dtl@yticgap\relax + \dtl@constructticklist\DTLminY\DTLmaxY + \dtl@unit@y\dtl@yticlist + \else + \DTLifFPopenbetween{0}{\DTLminY}{\DTLmaxY}{% + \dtl@constructticklistwithgapz + \DTLminY\DTLmaxY\dtl@yticlist\dtl@yticgap}{% + \dtl@constructticklistwithgap + \DTLminY\DTLmaxY\dtl@yticlist\dtl@yticgap}% + \fi + \fi + \let\dtl@yminorticlist\@empty + \ifDTLyminortics + \let\dtl@prevtick=\relax + \@for\dtl@nexttick:=\dtl@yticlist\do{% + \ifx\dtl@prevtick\relax + \else + \dtl@constructminorticklist + \dtl@prevtick\dtl@nexttick\dtl@unit@y\dtl@yminorticlist + \fi + \let\dtl@prevtick=\dtl@nexttick + }% + \fi + \ifx\dtl@ylabel\relax + \else + \ifx\dtl@yticlabels\relax + \@for\dtl@thislabel:=\dtl@yticlist\do{% + \FPround{\dtl@thislabel}{\dtl@thislabel} + {\c@DTLplotroundYvar}% + \settowidth{\dtl@tmplength}{\dtl@thislabel}% + \ifdim\dtl@tmplength>\dtl@yticlabelwidth + \setlength{\dtl@yticlabelwidth}{\dtl@tmplength}% + \fi + }% + \else + \@for\dtl@thislabel:=\dtl@yticlabels\do{% + \settowidth{\dtl@tmplength}{\dtl@thislabel}% + \ifdim\dtl@tmplength>\dtl@yticlabelwidth + \setlength{\dtl@yticlabelwidth}{\dtl@tmplength}% + \fi + }% + \fi + \fi + \begin{tikzpicture} + \pgfsetxvec{\pgfpoint{\dtl@unit@x sp}{0pt}}% + \pgfsetyvec{\pgfpoint{0pt}{\dtl@unit@y sp}}% + \DTLplotatbegintikz + \ifDTLbox + \draw (\DTLminX,\DTLminY) -- (\DTLmaxX,\DTLminY) -- + (\DTLmaxX,\DTLmaxY) -- (\DTLminX,\DTLmaxY) -- + cycle; + \else + \ifDTLxaxis + \expandafter\draw\expandafter[\DTLXAxisStyle] + (\DTLminX,\DTLminY) -- (\DTLmaxX,\DTLminY); + \fi + \ifDTLyaxis + \expandafter\draw\expandafter[\DTLYAxisStyle] + (\DTLminX,\DTLminY) -- (\DTLminX,\DTLmaxY); + \fi + \fi + \ifDTLgrid + \ifDTLxminortics + \@for\dtl@thistick:=\dtl@xminorticlist\do{% + \expandafter\draw\expandafter[\DTLminorgridstyle] + (\dtl@thistick,\DTLminY) -- (\dtl@thistick,\DTLmaxY); + }% + \fi + \ifDTLyminortics + \@for\dtl@thistick:=\dtl@yminorticlist\do{% + \expandafter\draw\expandafter[\DTLminorgridstyle] + (\DTLminX,\dtl@thistick) -- (\DTLmaxX,\dtl@thistick); + }% + \fi + \@for\dtl@thistick:=\dtl@xticlist\do{% + \expandafter\draw\expandafter[\DTLmajorgridstyle] + (\dtl@thistick,\DTLminY) -- (\dtl@thistick,\DTLmaxY); + }% + \@for\dtl@thistick:=\dtl@yticlist\do{% + \expandafter\draw\expandafter[\DTLmajorgridstyle] + (\DTLminX,\dtl@thistick) -- (\DTLmaxX,\dtl@thistick); + }% + \fi + \ifDTLxtics + \addtolength\dtl@xticlabelheight{\DTLticklabeloffset}% + \@for\dtl@thistick:=\dtl@xticlist\do{% + \pgfpathmoveto{\pgfpointxy{\dtl@thistick}{\DTLminY}} + \ifDTLxticsin + \pgfpathlineto{ + \pgfpointadd{\pgfpointxy{\dtl@thistick}{\DTLminY}} + {\pgfpoint{0pt}{\DTLticklength}}} + \else + \pgfpathlineto{ + \pgfpointadd{\pgfpointxy{\dtl@thistick}{\DTLminY}} + {\pgfpoint{0pt}{-\DTLticklength}}} + \fi + \ifDTLbox + \pgfpathmoveto{\pgfpointxy{\dtl@thistick}{\DTLmaxY}} + \ifDTLxticsin + \pgfpathlineto{ + \pgfpointadd{\pgfpointxy{\dtl@thistick}{\DTLmaxY}} + {\pgfpoint{0pt}{-\DTLticklength}}} + \else + \pgfpathlineto{ + \pgfpointadd{\pgfpointxy{\dtl@thistick}{\DTLmaxY}} + {\pgfpoint{0pt}{\DTLticklength}}} + \fi + \fi + \pgfusepath{stroke}% + \ifx\dtl@xticlabels\relax + \FPround{\dtl@thislabel}{\dtl@thistick} + {\c@DTLplotroundXvar}% + \else + \dtl@chopfirst\dtl@xticlabels\dtl@thislabel\dtl@rest + \let\dtl@xticlabels=\dtl@rest + \fi + \pgftext[base,center,at={\pgfpointadd + {\pgfpointxy{\dtl@thistick}{\DTLminY}} + {\pgfpoint{0pt}{-\dtl@xticlabelheight}}}] + {\dtl@thislabel} + }% + \fi + \ifx\dtl@xlabel\relax + \else + \addtolength{\dtl@xticlabelheight}{\baselineskip}% + \setlength{\dtl@tmplength}{0.5\DTLplotwidth} + \pgftext[base,center,at={\pgfpointadd + {\pgfpointxy{\DTLminX}{\DTLminY}}% + {\pgfpoint{\dtl@tmplength}{-\dtl@xticlabelheight}}}]{% + \dtl@xlabel} + \fi + \ifDTLxminortics + \@for\dtl@thistick:=\dtl@xminorticlist\do{% + \pgfpathmoveto{\pgfpointxy{\dtl@thistick}{\DTLminY}} + \ifDTLxticsin + \pgfpathlineto{ + \pgfpointadd{\pgfpointxy{\dtl@thistick}{\DTLminY}} + {\pgfpoint{0pt}{\DTLminorticklength}}} + \else + \pgfpathlineto{ + \pgfpointadd{\pgfpointxy{\dtl@thistick}{\DTLminY}} + {\pgfpoint{0pt}{-\DTLminorticklength}}} + \fi + \ifDTLbox + \pgfpathmoveto{\pgfpointxy{\dtl@thistick}{\DTLmaxY}} + \ifDTLxticsin + \pgfpathlineto{ + \pgfpointadd{\pgfpointxy{\dtl@thistick}{\DTLmaxY}} + {\pgfpoint{0pt}{-\DTLminorticklength}}} + \else + \pgfpathlineto{ + \pgfpointadd{\pgfpointxy{\dtl@thistick}{\DTLmaxY}} + {\pgfpoint{0pt}{\DTLminorticklength}}} + \fi + \fi + }% + \fi + \ifDTLytics + \@for\dtl@thistick:=\dtl@yticlist\do{% + \pgfpathmoveto{\pgfpointxy{\DTLminX}{\dtl@thistick}} + \ifDTLyticsin + \pgfpathlineto{ + \pgfpointadd{\pgfpointxy{\DTLminX}{\dtl@thistick}} + {\pgfpoint{\DTLticklength}{0pt}}} + \else + \pgfpathlineto{ + \pgfpointadd{\pgfpointxy{\DTLminX}{\dtl@thistick}} + {\pgfpoint{-\DTLticklength}{0pt}}} + \fi + \ifDTLbox + \pgfpathmoveto{\pgfpointxy{\DTLmaxX}{\dtl@thistick}} + \ifDTLyticsin + \pgfpathlineto{ + \pgfpointadd{\pgfpointxy{\DTLmaxX}{\dtl@thistick}} + {\pgfpoint{-\DTLticklength}{0pt}}} + \else + \pgfpathlineto{ + \pgfpointadd{\pgfpointxy{\DTLmaxX}{\dtl@thistick}} + {\pgfpoint{\DTLticklength}{0pt}}} + \fi + \fi + \pgfusepath{stroke} + \ifx\dtl@yticlabels\relax + \FPround{\dtl@thislabel}{\dtl@thistick} + {\c@DTLplotroundYvar}% + \else + \dtl@chopfirst\dtl@yticlabels\dtl@thislabel\dtl@rest + \let\dtl@yticlabels=\dtl@rest + \fi + \pgftext[right,at={\pgfpointadd + {\pgfpointxy{\DTLminX}{\dtl@thistick}} + {\pgfpoint{-\DTLticklabeloffset}{0pt}}}] + {\dtl@thislabel} + }% + \fi + \ifx\dtl@ylabel\relax + \else + \addtolength{\dtl@yticlabelwidth}{\baselineskip}% + \setlength{\dtl@tmplength}{0.5\DTLplotheight} + \pgftext[bottom,center,at={\pgfpointadd + {\pgfpointxy{\DTLminX}{\DTLminY}}% + {\pgfpoint{-\dtl@yticlabelwidth}{\dtl@tmplength}}}, + rotate=90]{% + \dtl@ylabel} + \fi + \ifDTLyminortics + \@for\dtl@thistick:=\dtl@yminorticlist\do{% + \pgfpathmoveto{\pgfpointxy{\DTLminX}{\dtl@thistick}} + \ifDTLyticsin + \pgfpathlineto{ + \pgfpointadd{\pgfpointxy{\DTLminX}{\dtl@thistick}} + {\pgfpoint{\DTLminorticklength}{0pt}}} + \else + \pgfpathlineto{ + \pgfpointadd{\pgfpointxy{\DTLminX}{\dtl@thistick}} + {\pgfpoint{-\DTLminorticklength}{0pt}}} + \fi + \ifDTLbox + \pgfpathmoveto{\pgfpointxy{\DTLmaxX}{\dtl@thistick}} + \ifDTLyticsin + \pgfpathlineto{ + \pgfpointadd{\pgfpointxy{\DTLmaxX}{\dtl@thistick}} + {\pgfpoint{-\DTLminorticklength}{0pt}}} + \else + \pgfpathlineto{ + \pgfpointadd{\pgfpointxy{\DTLmaxX}{\dtl@thistick}} + {\pgfpoint{\DTLminorticklength}{0pt}}} + \fi + \fi + \pgfusepath{stroke} + }% + \fi + \@for\dtl@thisdb:=#2\do{% + \ifx\dtl@plotmarkcolorlist\@empty + \let\dtl@plotmarkcolorlist=\DTLplotmarkcolors + \fi + \dtl@chopfirst\dtl@plotmarkcolorlist\dtl@thisplotmarkcolor + \dtl@remainder + \let\dtl@plotmarkcolorlist=\dtl@remainder + \ifDTLshowmarkers + \ifx\dtl@plotmarklist\@empty + \let\dtl@plotmarklist=\DTLplotmarks + \fi + \dtl@chopfirst\dtl@plotmarklist\dtl@thisplotmark + \dtl@remainder + \let\dtl@plotmarklist=\dtl@remainder + \ifx\dtl@thisplotmark\relax + \let\dtl@mark=\relax + \else + \expandafter\toks@\expandafter{\dtl@thisplotmark}% + \ifx\dtl@thisplotmarkcolor\@empty + \edef\dtl@mark{\the\toks@}% + \else + \edef\dtl@mark{% + \noexpand\color{\dtl@thisplotmarkcolor}% + \the\toks@}% + \fi + \fi + \else + \let\dtl@mark=\relax + \fi + \ifx\dtl@plotlinecolorlist\@empty + \let\dtl@plotlinecolorlist=\DTLplotlinecolors + \fi + \dtl@chopfirst\dtl@plotlinecolorlist\dtl@thisplotlinecolor + \dtl@remainder + \let\dtl@plotlinecolorlist=\dtl@remainder + \ifDTLshowlines + \ifx\dtl@plotlinelist\@empty + \let\dtl@plotlinelist=\DTLplotlines + \fi + \dtl@chopfirst\dtl@plotlinelist\dtl@thisplotline + \dtl@remainder + \let\dtl@plotlinelist=\dtl@remainder + \expandafter\ifx\dtl@thisplotline\relax + \let\dtl@linestyle=\relax + \else + \expandafter\toks@\expandafter{\dtl@thisplotline}% + \ifx\dtl@thisplotlinecolor\@empty + \edef\dtl@linestyle{\the\toks@}% + \else + \edef\dtl@linestyle{% + \noexpand\color{\dtl@thisplotlinecolor}% + \the\toks@}% + \fi + \fi + \else + \let\dtl@linestyle=\relax + \fi + \ifnum\dtl@legendsetting>0\relax + \dtl@chopfirst\dtl@legendlabels\dtl@thislabel\dtl@rest + \let\dtl@legendlabels=\dtl@rest + \expandafter\toks@\expandafter{\dtl@mark}% + \expandafter\@dtl@toks\expandafter{\dtl@linestyle}% + \edef\dtl@addtolegend{\noexpand\DTLaddtoplotlegend + {\the\toks@}{\the\@dtl@toks}{\dtl@thislabel}}% + \dtl@addtolegend + \fi + \def\dtl@stream{\pgfplotstreamstart}% + \@sDTLforeach[#1]{\dtl@thisdb}{\dtl@x=\dtl@xkey,% + \dtl@y=\dtl@ykey}{% + \DTLconverttodecimal{\dtl@x}{\dtl@decx}% + \DTLconverttodecimal{\dtl@y}{\dtl@decy}% + \ifthenelse{% + \DTLisclosedbetween{\dtl@x}{\DTLminX}{\DTLmaxX}% + \and + \DTLisclosedbetween{\dtl@y}{\DTLminY}{\DTLmaxY}% + }{% + \expandafter\toks@\expandafter{\dtl@stream}% + \edef\dtl@stream{\the\toks@ + \noexpand\pgfplotstreampoint + {\noexpand\pgfpointxy{\dtl@decx}{\dtl@decy}}}% + }{}% + }% + \expandafter\toks@\expandafter{\dtl@stream}% + \edef\dtl@stream{\the\toks@\noexpand\pgfplotstreamend}% + \ifx\dtl@linestyle\relax + \else + \begin{scope} + \dtl@linestyle + \pgfplothandlerlineto + \dtl@stream + \pgfusepath{stroke} + \end{scope} + \fi + \ifx\dtl@mark\relax + \else + \begin{scope} + \pgfplothandlermark{\dtl@mark}% + \dtl@stream + \pgfusepath{stroke} + \end{scope} + \fi + }% + \ifcase\dtl@legendsetting + % none + \or % north + \pgftext[top,center,at={\pgfpointadd + {\pgfpointxy{\DTLminX}{\DTLmaxY}} + {\pgfpoint{0.5\DTLplotwidth}{-\DTLlegendyoffset}}}] + {\DTLformatlegend + {\begin{tabular}{cl}\dtl@legend\end{tabular}}} + \or % north east + \pgftext[top,right,at={\pgfpointadd + {\pgfpointxy{\DTLmaxX}{\DTLmaxY}} + {\pgfpoint{-\DTLlegendxoffset}{-\DTLlegendyoffset}}}] + {\DTLformatlegend + {\begin{tabular}{cl}\dtl@legend\end{tabular}}} + \or % east + \pgftext[center,right,at={\pgfpointadd + {\pgfpointxy{\DTLmaxX}{\DTLminY}} + {\pgfpoint{-\DTLlegendxoffset}{0.5\DTLplotheight}}}] + {\DTLformatlegend + {\begin{tabular}{cl}\dtl@legend\end{tabular}}} + \or % south east + \pgftext[bottom,right,at={\pgfpointadd + {\pgfpointxy{\DTLmaxX}{\DTLminY}} + {\pgfpoint{-\DTLlegendxoffset}{\DTLlegendyoffset}}}] + {\DTLformatlegend + {\begin{tabular}{cl}\dtl@legend\end{tabular}}} + \or % south + \pgftext[center,bottom,at={\pgfpointadd + {\pgfpointxy{\DTLminX}{\DTLminY}} + {\pgfpoint{0.5\DTLplotwidth}{\DTLlegendyoffset}}}] + {\DTLformatlegend + {\begin{tabular}{cl}\dtl@legend\end{tabular}}} + \or % south west + \pgftext[bottom,left,at={\pgfpointadd + {\pgfpointxy{\DTLminX}{\DTLminY}} + {\pgfpoint{\DTLlegendxoffset}{\DTLlegendyoffset}}}] + {\DTLformatlegend + {\begin{tabular}{cl}\dtl@legend\end{tabular}}} + \or % west + \pgftext[center,left,at={\pgfpointadd + {\pgfpointxy{\DTLminX}{\DTLminY}} + {\pgfpoint{\DTLlegendxoffset}{0.5\DTLplotheight}}}] + {\DTLformatlegend + {\begin{tabular}{cl}\dtl@legend\end{tabular}}} + \or % north west + \pgftext[top,left,at={\pgfpointadd + {\pgfpointxy{\DTLminX}{\DTLmaxY}} + {\pgfpoint{\DTLlegendxoffset}{-\DTLlegendyoffset}}}] + {\DTLformatlegend + {\begin{tabular}{cl}\dtl@legend\end{tabular}}} + \fi + \DTLplotatendtikz + \end{tikzpicture} + \fi + \fi +\fi +}} +\def\dtl@getbounds#1,#2,#3,#4\@nil{% +\def\DTLminX{#1}% +\def\DTLminY{#2}% +\def\DTLmaxX{#3}% +\def\DTLmaxY{#4}% +\FPifgt{\DTLminX}{\DTLmaxX} + \PackageError{dataplot}{Min X > Max X in bounds #1,#2,#3,#4}{% + The bounds must be specified as minX,minY,maxX,maxY}% +\fi +\FPifgt{\DTLminY}{\DTLmaxY} + \PackageError{dataplot}{Min Y > Max Y in bounds #1,#2,#3,#4}{% + The bounds must be specified as minX,minY,maxX,maxY}% +\fi +} +\newcommand*{\dtl@constructticklist}[4]{% +\DTLifFPopenbetween{0}{#1}{#2}{% + \FPsub{\@dtl@width}{0}{#1}% + \FPmul{\@dtl@width}{\@dtl@width}{#3}% + \FPdiv{\@dtl@neggap}{\@dtl@width}{10}% + \setlength\dtl@tmplength{\@dtl@neggap sp}% + \ifdim\dtl@tmplength<\DTLmintickgap + \FPdiv{\@dtl@neggap}{\@dtl@width}{4}% + \setlength\dtl@tmplength{\@dtl@neggap sp}% + \ifdim\dtl@tmplength<\DTLmintickgap + \FPdiv{\@dtl@neggap}{\@dtl@width}{2}% + \setlength\dtl@tmplength{\@dtl@neggap sp}% + \ifdim\dtl@tmplength<\DTLmintickgap + \let\@dtl@neggap=\@dtl@width + \fi + \fi + \fi + \FPmul{\@dtl@width}{#2}{#3}% + \FPdiv{\@dtl@posgap}{\@dtl@width}{10}% + \setlength\dtl@tmplength{\@dtl@posgap sp}% + \ifdim\dtl@tmplength<\DTLmintickgap + \FPdiv{\@dtl@posgap}{\@dtl@width}{4}% + \setlength\dtl@tmplength{\@dtl@posgap sp}% + \ifdim\dtl@tmplength<\DTLmintickgap + \FPdiv{\@dtl@posgap}{\@dtl@width}{2}% + \setlength\dtl@tmplength{\@dtl@posgap sp}% + \ifdim\dtl@tmplength<\DTLmintickgap + \let\@dtl@posgap=\@dtl@width + \fi + \fi + \fi + \FPmax{\@dtl@gap}{\@dtl@neggap}{\@dtl@posgap}% + \FPdiv{\@dtl@gap}{\@dtl@gap}{#3}% + \dtl@constructticklistwithgapz{#1}{#2}{#4}{\@dtl@gap}% +}{% + \FPsub{\@dtl@width}{#2}{#1}% + \FPmul{\@dtl@width}{\@dtl@width}{#3}% + \FPdiv{\@dtl@gap}{\@dtl@width}{10}% + \setlength\dtl@tmplength{\@dtl@gap sp}% + \ifdim\dtl@tmplength<\DTLmintickgap + \FPdiv{\@dtl@gap}{\@dtl@width}{4}% + \setlength\dtl@tmplength{\@dtl@gap sp}% + \ifdim\dtl@tmplength<\DTLmintickgap + \FPdiv{\@dtl@gap}{\@dtl@width}{2}% + \setlength\dtl@tmplength{\@dtl@gap sp}% + \ifdim\dtl@tmplength<\DTLmintickgap + \let\@dtl@gap=\@dtl@width + \fi + \fi + \fi + \FPdiv{\@dtl@gap}{\@dtl@gap}{#3}% + \dtl@constructticklistwithgap{#1}{#2}{#4}{\@dtl@gap}% +}% +} +\newcommand*{\dtl@constructticklistwithgap}[4]{% +\edef\@dtl@thistick{#1}% +\edef#3{#1}% +\FPadd{\@dtl@thistick}{\@dtl@thistick}{#4}% +\whiledo{\DTLisFPopenbetween{\@dtl@thistick}{#1}{#2}}{% + \expandafter\toks@\expandafter{\@dtl@thistick}% + \edef#3{#3,\the\toks@}% + \FPadd{\@dtl@thistick}{\@dtl@thistick}{#4}% +}% +\expandafter\toks@\expandafter{#2}% +\edef#3{#3,\the\toks@}% +} +\newcommand*{\dtl@constructticklistwithgapz}[4]{% +\edef\@dtl@thistick{0}% +\edef#3{0}% +\FPadd{\@dtl@thistick}{\@dtl@thistick}{#4}% +\whiledo{\DTLisFPopenbetween{\@dtl@thistick}{0}{#2}}{% + \expandafter\toks@\expandafter{\@dtl@thistick}% + \edef#3{#3,\the\toks@}% + \FPadd{\@dtl@thistick}{\@dtl@thistick}{#4}% +}% +\expandafter\toks@\expandafter{#2}% +\edef#3{#3,\the\toks@}% +\FPifeq{#1}{0}% +\else +\edef\@dtl@thistick{0}% + \FPsub{\@dtl@thistick}{\@dtl@thistick}{#4}% + \whiledo{\DTLisFPopenbetween{\@dtl@thistick}{#1}{0}}{% + \expandafter\toks@\expandafter{\@dtl@thistick}% + \edef#3{\the\toks@,#3}% + \FPsub{\@dtl@thistick}{\@dtl@thistick}{#4}% + }% + \expandafter\toks@\expandafter{#1}% + \edef#3{\the\toks@,#3}% +\fi +} +\newcommand*{\dtl@constructminorticklist}[4]{% + \FPsub{\@dtl@width}{#2}{#1}% + \FPmul{\@dtl@width}{\@dtl@width}{#3}% + \FPdiv{\@dtl@gap}{\@dtl@width}{10}% + \setlength\dtl@tmplength{\@dtl@gap sp}% + \ifdim\dtl@tmplength<\DTLminminortickgap + \FPdiv{\@dtl@gap}{\@dtl@width}{4}% + \setlength\dtl@tmplength{\@dtl@gap sp}% + \ifdim\dtl@tmplength<\DTLminminortickgap + \FPdiv{\@dtl@gap}{\@dtl@width}{2}% + \setlength\dtl@tmplength{\@dtl@gap sp}% + \ifdim\dtl@tmplength<\DTLminminortickgap + \let\@dtl@gap=\@dtl@width + \fi + \fi + \fi + \FPdiv{\@dtl@gap}{\@dtl@gap}{#3}% + \dtl@constructticklistwithgapex{#1}{#2}{\dtl@tmp}{\@dtl@gap}% + \ifx#4\@empty + \let#4=\dtl@tmp + \else + \expandafter\toks@\expandafter{#4}% + \edef#4{#4,\dtl@tmp}% + \fi +} +\newcommand*{\dtl@constructticklistwithgapex}[4]{% +\edef\@dtl@thistick{#1}% +\let#3=\@empty +\FPadd{\@dtl@thistick}{\@dtl@thistick}{#4}% +\whiledo{\DTLisFPopenbetween{\@dtl@thistick}{#1}{#2}}{% + \expandafter\toks@\expandafter{\@dtl@thistick}% + \ifx#3\@empty + \edef#3{\the\toks@}% + \else + \edef#3{#3,\the\toks@}% + \fi + \FPadd{\@dtl@thistick}{\@dtl@thistick}{#4}% +}% +} +\newcommand*{\DTLaddtoplotlegend}[3]{% +\def\dtl@legendline{}% +\ifx\relax#2\relax +\else + \toks@{#2% + \pgfpathmoveto{\pgfpoint{-10pt}{0pt}}% + \pgfpathlineto{\pgfpoint{10pt}{0pt}}% + \pgfusepath{stroke}}% + \edef\dtl@legendline{\the\toks@}% +\fi +\ifx\relax#1\relax +\else + \toks@{#1}% + \expandafter\@dtl@toks\expandafter{\dtl@legendline}% + \edef\dtl@legendline{\the\@dtl@toks\the\toks@}% +\fi +\expandafter\toks@\expandafter{\dtl@legendline}% +\ifx\dtl@legend\@empty + \edef\dtl@legend{\noexpand\tikz\the\toks@; \noexpand& #3}% +\else + \expandafter\@dtl@toks\expandafter{\dtl@legend}% + \edef\dtl@legend{\the\@dtl@toks\noexpand\\% + \noexpand\tikz\the\toks@; \noexpand& #3}% +\fi +} +\endinput +%% +%% End of file `dataplot.sty'. diff --git a/Master/texmf-dist/tex/latex/datatool/datatool.sty b/Master/texmf-dist/tex/latex/datatool/datatool.sty new file mode 100644 index 00000000000..099417295be --- /dev/null +++ b/Master/texmf-dist/tex/latex/datatool/datatool.sty @@ -0,0 +1,3318 @@ +%% +%% This is file `datatool.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% datatool.dtx (with options: `datatool.sty,package') +%% +%% datatool.dtx +%% Copyright 2007 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.sty, datapie.sty, dataplot.sty, databar.sty, databib.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{datatool}[2007/08/17 v1.01 (NLCT)] +\RequirePackage{xkeyval} +\RequirePackage{ifthen} +\RequirePackage{xfor} +\RequirePackage{fp} +\RequirePackage{substr} +\newcommand*{\@dtl@separator}{,} +\newcommand*{\DTLsetseparator}[1]{% +\renewcommand*{\@dtl@separator}{#1}% +\@dtl@construct@lopoffs +} +\begingroup +\catcode`\ 12 +\gdef\DTLsettabseparator{% + \catcode`\ 12 + \DTLsetseparator{ }% +} +\endgroup +\begingroup +\catcode`\"12\relax +\gdef\@dtl@delimiter{"} +\endgroup +\newcommand*\DTLsetdelimiter[1]{% +\renewcommand*{\@dtl@delimiter}{#1}% +\@dtl@construct@lopoffs} +\edef\@dtl@construct@lopoff#1#2{% +\noexpand\long\noexpand\def\noexpand\@dtl@lopoff#1##1##2\noexpand +\to##3##4{% +\noexpand\ifx#2##1\noexpand\relax +\noexpand\@dtl@qlopoff#1##1##2\noexpand\to##3##4\relax +\noexpand\else +\noexpand\@dtl@lop@ff#1##1##2\noexpand\to##3##4\relax +\noexpand\fi +}} +\edef\@dtl@construct@qlopoff#1#2{% +\noexpand\long\noexpand\def\noexpand\@dtl@qlopoff#1#2##1#2#1##2\noexpand +\to##3##4{% +\noexpand\def##4{##1}\noexpand\def##3{#1##2}% +}} +\edef\@dtl@construct@lop@ff#1{% +\noexpand\long\noexpand\def\noexpand\@dtl@lop@ff#1##1#1##2\noexpand +\to##3##4{% +\noexpand\def##4{##1}\noexpand\def##3{#1##2}% +}} +\newcommand{\@dtl@construct@lopoffs}{% +\edef\@dtl@chars{{\@dtl@separator}{\@dtl@delimiter}}% +\expandafter\@dtl@construct@lopoff\@dtl@chars +\expandafter\@dtl@construct@qlopoff\@dtl@chars +\expandafter\@dtl@construct@lop@ff\expandafter{\@dtl@separator}% +} +\newcommand*{\@dtl@decimal}{.} +\newcommand*{\@dtl@numbergroupchar}{,} +\newcommand*{\DTLsetnumberchars}[2]{% +\renewcommand*{\@dtl@numbergroupchar}{#1}% +\renewcommand*{\@dtl@decimal}{#2}% +\@dtl@construct@getnums +\@dtl@construct@stripnumgrpchar{#1}} +\edef\@dtl@construct@getintfrac#1{% +\noexpand\def\noexpand\@dtl@getintfrac##1#1##2\noexpand\relax{% +\noexpand\@dtl@get@intpart{##1}% +\noexpand\def\noexpand\@dtl@fracpart{##2}% +\noexpand\ifx\noexpand\@empty\noexpand\@dtl@fracpart + \noexpand\def\noexpand\@dtl@fracpart{0}% +\noexpand\else + \noexpand\@dtl@getfracpart##2\noexpand\relax + \noexpand\@dtl@choptrailingzeroes{\noexpand\@dtl@fracpart}% +\noexpand\fi +}% +\noexpand\def\noexpand\@dtl@getfracpart##1#1\noexpand\relax{% +\noexpand\def\noexpand\@dtl@fracpart{##1}% +}% +\noexpand\def\noexpand\DTLconverttodecimal##1##2{% +\noexpand\dtl@ifsingle{##1}% +{\noexpand\expandafter\noexpand\toks@\noexpand\expandafter{##1}% +\noexpand\edef\noexpand\@dtl@tmp{\noexpand\the\noexpand\toks@}}% +{\noexpand\def\noexpand\@dtl@tmp{##1}}% + \noexpand\@dtl@standardize@currency\noexpand\@dtl@tmp + \noexpand\ifx\noexpand\@dtl@org@currency\noexpand\@empty + \noexpand\else + \noexpand\let\noexpand\@dtl@currency\noexpand\@dtl@org@currency + \noexpand\fi +\noexpand\expandafter +\noexpand\@dtl@getintfrac\noexpand\@dtl@tmp#1\noexpand\relax +\noexpand\edef##2{\noexpand\@dtl@intpart.\noexpand\@dtl@fracpart}}% +} +\newcommand*{\@dtl@construct@getnums}{% +\expandafter\@dtl@construct@getintfrac\expandafter{\@dtl@decimal}} +\newcommand*{\@dtl@get@intpart}[1]{% +\@dtl@tmpcount=1\relax +\def\@dtl@intpart{#1}% +\ifx\@dtl@intpart\@empty + \def\@dtl@intpart{0}% +\else + \def\@dtl@intpart{}% + \@dtl@get@int@part#1.\relax% +\fi +\ifnum\@dtl@tmpcount<0\relax + \edef\@dtl@intpart{-\@dtl@intpart}% +\fi +\@dtl@strip@numgrpchar{\@dtl@intpart}% +} +\def\@dtl@get@int@part#1#2\relax{% +\def\@dtl@argi{#1}% +\def\@dtl@argii{#2}% +\ifx\protect#1\relax% + \let\@dtl@get@nextintpart=\@dtl@get@int@part +\else + \expandafter\ifx\@dtl@argi\$% + \let\@dtl@get@nextintpart=\@dtl@get@int@part + \else + \ifx-#1% + \multiply\@dtl@tmpcount by -1\relax + \let\@dtl@get@nextintpart=\@dtl@get@int@part + \else + \if\@dtl@argi+% + \let\@dtl@get@nextintpart=\@dtl@get@int@part + \else + \def\@dtl@intpart{#1}% + \ifx.\@dtl@argii + \let\@dtl@get@nextintpart=\@gobble + \else + \let\@dtl@get@nextintpart=\@dtl@get@next@intpart + \fi + \fi + \fi + \fi +\fi +\@dtl@get@nextintpart#2\relax +} +\def\@dtl@get@next@intpart#1.\relax{% +\edef\@dtl@intpart{\@dtl@intpart#1}% +} +\newcommand*{\@dtl@choptrailingzeroes}[1]{% +\def\@dtl@tmpcpz{}% +\expandafter\@dtl@chop@trailingzeroes#1\@nil% +\let#1=\@dtl@tmpcpz +} +\def\@dtl@chop@trailingzeroes#1#2\@nil{% +\FPifeq{#2}{0}% + \edef\@dtl@tmpcpz{\@dtl@tmpcpz#1}% + \let\@dtl@chopzeroesnext=\@dtl@gobbletonil +\else + \edef\@dtl@tmpcpz{\@dtl@tmpcpz#1}% + \let\@dtl@chopzeroesnext=\@dtl@chop@trailingzeroes +\fi +\@dtl@chopzeroesnext#2\@nil +} +\def\@dtl@gobbletonil#1\@nil{} +\newcommand*{\dtl@truncatedecimal}[1]{% +\expandafter\@dtl@truncatedecimal#1.\@nil#1} +\def\@dtl@truncatedecimal#1.#2\@nil#3{% +\def#3{#1}} +\newcommand*{\@dtl@strip@numgrpchar}[1]{% +\def\@dtl@stripped{}% +\edef\@dtl@do@stripnumgrpchar{% +\noexpand\@@dtl@strip@numgrpchar#1\@dtl@numbergroupchar +\noexpand\relax}% +\@dtl@do@stripnumgrpchar +\let#1=\@dtl@stripped +} +\edef\@dtl@construct@stripnumgrpchar#1{% +\noexpand\def\noexpand\@@dtl@strip@numgrpchar##1#1##2\noexpand\relax{% +\noexpand\expandafter\noexpand\toks@\noexpand\expandafter +{\noexpand\@dtl@stripped}% +\noexpand\edef\noexpand\@dtl@stripped{\noexpand\the\noexpand\toks@ +##1}% +\noexpand\def\noexpand\@dtl@tmp{##2}% +\noexpand\ifx\noexpand\@dtl@tmp\noexpand\@empty + \noexpand\let\noexpand\@dtl@next=\noexpand\relax +\noexpand\else + \noexpand\let\noexpand\@dtl@next=\noexpand\@@dtl@strip@numgrpchar +\noexpand\fi +\noexpand\@dtl@next##2\noexpand\relax +}% +} +\newcommand*{\DTLdecimaltolocale}[2]{% +\edef\@dtl@tmpdtl{#1}% +\expandafter\@dtl@decimaltolocale\@dtl@tmpdtl.\relax +\FPifeq{\@dtl@fracpart}{0}% + \edef#2{\@dtl@intpart}% +\else + \edef#2{\@dtl@intpart\@dtl@decimal\@dtl@fracpart}% +\fi +} +\def\@dtl@decimaltolocale#1.#2\relax{% +\@dtl@decimaltolocaleint{#1}% +\def\@dtl@fracpart{#2}% +\ifx\@dtl@fracpart\@empty + \def\@dtl@fracpart{0}% +\else + \@dtl@decimaltolocalefrac#2\relax +\fi +} +\def\@dtl@decimaltolocaleint#1{% +\@dtl@tmpcount=0\relax +\@dtl@countdigits#1.\relax +\@dtl@numgrpsepcount=\@dtl@tmpcount\relax +\divide\@dtl@numgrpsepcount by 3\relax +\multiply\@dtl@numgrpsepcount by 3\relax +\advance\@dtl@numgrpsepcount by -\@dtl@tmpcount\relax +\ifnum\@dtl@numgrpsepcount<0\relax + \advance\@dtl@numgrpsepcount by 3\relax +\fi +\def\@dtl@intpart{}% +\@dtl@decimal@to@localeint#1.\relax +} +\def\@dtl@countdigits#1#2\relax{% +\advance\@dtl@tmpcount by 1\relax +\ifx.#2\relax + \let\@dtl@countnext=\@gobble +\else + \let\@dtl@countnext=\@dtl@countdigits +\fi +\@dtl@countnext#2\relax +} +\def\@dtl@decimal@to@localeint#1#2\relax{% +\advance\@dtl@numgrpsepcount by 1\relax +\ifx.#2\relax + \edef\@dtl@intpart{\@dtl@intpart#1}% + \let\@dtl@localeintnext=\@gobble +\else + \ifnum\@dtl@numgrpsepcount=3\relax + \edef\@dtl@intpart{\@dtl@intpart#1\@dtl@numbergroupchar}% + \@dtl@numgrpsepcount=0\relax + \else + \ifnum\@dtl@numgrpsepcount>3\relax + \@dtl@numgrpsepcount=0\relax + \fi + \edef\@dtl@intpart{\@dtl@intpart#1}% + \fi + \let\@dtl@localeintnext=\@dtl@decimal@to@localeint +\fi +\@dtl@localeintnext#2\relax +} +\def\@dtl@decimaltolocalefrac#1.\relax{% +\def\@dtl@fracpart{#1}% +\@dtl@choptrailingzeroes{\@dtl@fracpart}% +} +\newcommand*{\DTLdecimaltocurrency}[2]{% +\edef\@dtl@tmpdtl{#1}% +\expandafter\@dtl@decimaltolocale\@dtl@tmpdtl.\relax +\dtl@truncatedecimal\@dtl@tmpdtl +\@dtl@tmpcount=\@dtl@tmpdtl\relax +\expandafter\@dtl@toks\expandafter{\@dtl@currency}% +\FPifeq{\@dtl@fracpart}{0}% + \ifnum\@dtl@tmpcount<0\relax + \@dtl@tmpcount = -\@dtl@tmpcount\relax + \edef#2{-\the\@dtl@toks\the\@dtl@tmpcount\@dtl@decimal00}% + \else + \edef#2{\the\@dtl@toks\@dtl@intpart\@dtl@decimal00}% + \fi +\else + \ifnum\@dtl@tmpcount<0\relax + \@dtl@tmpcount = -\@dtl@tmpcount\relax + \ifnum\@dtl@fracpart<10\relax + \edef#2{-\the\@dtl@toks\number\@dtl@tmpcount + \@dtl@decimal\@dtl@fracpart0}% + \else + \edef#2{-\the\@dtl@toks\number\@dtl@tmpcount + \@dtl@decimal\@dtl@fracpart}% + \fi + \else + \ifnum\@dtl@fracpart<10\relax + \edef#2{\the\@dtl@toks\@dtl@intpart\@dtl@decimal\@dtl@fracpart0}% + \else + \edef#2{\the\@dtl@toks\@dtl@intpart\@dtl@decimal\@dtl@fracpart}% + \fi + \fi +\fi +} +\@dtl@construct@lopoffs +\@dtl@construct@getnums +\expandafter\@dtl@construct@stripnumgrpchar\expandafter +{\@dtl@numbergroupchar} +\define@key{datatool.sty}{separator}{% +\DTLsetseparator{#1}} +\define@key{datatool.sty}{delimiter}{% +\DTLsetdelimiter{#1}} +\define@boolkey{datatool.sty}[dtl]{verbose}[true]{% +\ifdtlverbose \FPmessagestrue\else \FPmessagesfalse\fi} +\newcommand*{\dtl@message}[1]{% +\ifdtlverbose\typeout{#1}\fi} +\ProcessOptionsX +\DeclareRobustCommand\DTLpar{\@par} +\newcount\@dtl@datatype +\newcount\@dtl@tmpcount +\newlength\dtl@tmplength +\newcount\@dtl@numgrpsepcount +\newcommand{\@dtl@checknumerical}[1]{% +\@dtl@numgrpsepfalse +\def\@dtl@tmp{#1}% +\ifx\@empty#1\@empty + \@dtl@datatype=0\relax +\else + \dtl@ifsingle{#1}% + {\expandafter\toks@\expandafter{#1}% + \edef\@dtl@tmp{\the\toks@}}% + {\def\@dtl@tmp{#1}}% + \@dtl@tmpcount=0\relax + \@dtl@datatype=0\relax + \@dtl@numgrpsepcount=2\relax + \@dtl@standardize@currency\@dtl@tmp + \ifx\@dtl@org@currency\@empty + \else + \let\@dtl@currency\@dtl@org@currency + \fi + \expandafter\@dtl@checknumericalstart\@dtl@tmp\@nil\@nil +\fi +\ifnum\@dtl@numgrpsepcount>-1\relax + \if@dtl@numgrpsep + \ifnum\@dtl@numgrpsepcount=3\relax + \else + \@dtl@datatype=0\relax + \fi + \fi +\fi +} +\def\@dtl@checknumericalstart#1#2\@nil\@nil{% +\ifx#1\protect + \@dtl@checknumericalstart#2\@nil\@nil\relax +\else + \ifx-#1\relax + \def\@dtl@tmp{#2}% + \ifx\@empty\@dtl@tmp + \@dtl@datatype=0\relax + \else + \ifnum\@dtl@datatype=0\relax + \@dtl@datatype=1\relax + \fi + \@dtl@checknumericalstart#2\@nil\@nil\relax + \fi + \else + \ifx+#1\relax + \def\@dtl@tmp{#2}% + \ifx\@empty\@dtl@tmp + \@dtl@datatype=0\relax + \else + \ifnum\@dtl@datatype=0\relax + \@dtl@datatype=1\relax + \fi + \@dtl@checknumericalstart#2\@nil\@nil\relax + \fi + \else + \def\@dtl@tmp{#1}% + \ifx#1\$\relax + \@dtl@datatype=3\relax + \@dtl@checknumericalstart#2\@nil\@nil\relax + \else + \ifx\@empty\@dtl@tmp + \@dtl@datatype=0\relax + \else + \ifnum\@dtl@datatype=0\relax + \@dtl@datatype=1\relax + \fi + \@dtl@checknumericalloop#1#2\@nil\@nil\relax + \fi + \fi + \fi + \fi +\fi +} +\newif\if@dtl@numgrpsep +\newcommand*{\@dtl@ifDigitOrDecimalSep}[3]{% +\ifx0#1\relax + #2% +\else + \ifx1#1\relax + #2% + \else + \ifx2#1\relax + #2% + \else + \ifx3#1\relax + #2% + \else + \ifx4#1\relax + #2% + \else + \ifx5#1\relax + #2% + \else + \ifx6#1\relax + #2% + \else + \ifx7#1\relax + #2% + \else + \ifx8#1\relax + #2% + \else + \ifx9#1\relax + #2% + \else + \expandafter\ifx\@dtl@decimal#1\relax + #2% + \else + #3% + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi +\fi +} +\def\@dtl@checknumericalloop#1#2\@nil{% +\def\@dtl@tmp{#1}% +\ifx\@nnil\@dtl@tmp\relax + \let\@dtl@chcknumnext=\@dtl@checknumericalnoop% +\else + \@dtl@ifDigitOrDecimalSep{#1}{% + \let\@dtl@chcknumnext=\@dtl@checknumericalloop% + \expandafter\ifx\@dtl@decimal#1\relax + \if@dtl@numgrpsep + \ifnum\@dtl@numgrpsepcount=3\relax + \@dtl@numgrpsepcount=-1\relax + \else + \@dtl@datatype=0\relax + \let\@dtl@chcknumnext=\@dtl@checknumericalnoop + \fi + \else + \@dtl@numgrpsepcount=-1\relax + \fi + \else + \ifnum\@dtl@numgrpsepcount=-1\relax + \else + \advance\@dtl@numgrpsepcount by 1\relax + \fi + \fi +}{% +\ifx\@dtl@numbergroupchar\@dtl@tmp\relax + \@dtl@numgrpseptrue + \ifnum\@dtl@numgrpsepcount<3\relax + \@dtl@datatype=0\relax + \let\@dtl@chcknumnext=\@dtl@checknumericalnoop + \else + \@dtl@numgrpsepcount=0\relax + \fi +\else + \@dtl@datatype=0\relax + \let\@dtl@chcknumnext=\@dtl@checknumericalnoop +\fi +}% + \ifx\@dtl@decimal\@dtl@tmp\relax + \ifnum\@dtl@datatype<3\relax + \@dtl@datatype=2\relax + \fi + \advance\@dtl@tmpcount by 1\relax + \ifnum\@dtl@tmpcount>1\relax + \@dtl@datatype=0\relax + \let\@dtl@chcknumnext=\@dtl@checknumericalnoop% + \fi + \fi +\fi +\@dtl@chcknumnext#2\@nil +} +\def\@dtl@checknumericalnoop#1\@nil#2{} +\newcommand{\DTLifnumerical}[3]{% +\@dtl@checknumerical{#1}% +\ifnum\@dtl@datatype=0\relax#3\else#2\fi +} +\newcommand{\DTLifreal}[3]{% +\@dtl@checknumerical{#1}% +\ifnum\@dtl@datatype=2\relax #2\else #3\fi +} +\newcommand{\DTLifint}[3]{% +\@dtl@checknumerical{#1}% +\ifnum\@dtl@datatype=1\relax #2\else #3\fi +} +\newcommand{\DTLifstring}[3]{% +\@dtl@checknumerical{#1}% +\ifnum\@dtl@datatype=0\relax #2\else #3\fi +} +\newcommand{\DTLifcurrency}[3]{% +\@dtl@checknumerical{#1}% +\ifnum\@dtl@datatype=3\relax #2\else #3\fi +} +\newcommand*{\DTLifcurrencyunit}[4]{% +\@dtl@checknumerical{#1}% +\ifnum\@dtl@datatype=3\relax + \ifthenelse{\equal{\@dtl@org@currency}{#2}}{#3}{#4}% +\else + #4% +\fi +} +\newcommand{\DTLifcasedatatype}[5]{% +\@dtl@checknumerical{#1}% +\ifcase\@dtl@datatype + #2% string +\or + #3% integer +\or + #4% number +\or + #5% currency +\fi +} +\newcommand*{\dtl@testbothnumerical}[2]{% +\dtl@ifsingle{#1}{% + \edef\@dtl@tmp{#1}}{% + \def\@dtl@tmp{#1}}% +\expandafter\@dtl@checknumerical\expandafter{\@dtl@tmp}% +\edef\@dtl@firsttype{\number\@dtl@datatype}% +\dtl@ifsingle{#2}{% + \edef\@dtl@tmp{#2}}{% + \def\@dtl@tmp{#2}}% +\expandafter\@dtl@checknumerical\expandafter{\@dtl@tmp}% +\multiply\@dtl@datatype by \@dtl@firsttype\relax +\ifnum\@dtl@datatype>0\relax + \@dtl@conditiontrue +\else + \@dtl@conditionfalse +\fi +} +\newcommand*{\DTLifnumlt}[4]{% + \DTLconverttodecimal{#1}{\@dtl@numi}% + \DTLconverttodecimal{#2}{\@dtl@numii}% + \FPiflt{\@dtl@numi}{\@dtl@numii}% + #3% + \else + #4% + \fi +} +\newcommand*{\dtlcompare}[3]{% +\dtl@subnobrsp{#2}{\@dtl@argA}% +\dtl@subnobrsp{#3}{\@dtl@argB}% +\ifx\@dtl@argA\@empty + \ifx\@dtl@argB\@empty + #1=0\relax + \else + #1=-1\relax + \fi +\else + \ifx\@dtl@argB\@empty + #1=1\relax + \else + \DTLsubstituteall{\@dtl@argA}{ }{\space }% + \DTLsubstituteall{\@dtl@argB}{ }{\space }% + \expandafter\dtl@getfirst\@dtl@argA\end + \let\dtl@firstA=\dtl@first + \let\dtl@restA=\dtl@rest + \expandafter\dtl@getfirst\@dtl@argB\end + \let\dtl@firstB=\dtl@first + \let\dtl@restB=\dtl@rest + \expandafter\dtl@ifsingle\expandafter{\dtl@firstA}{% + \expandafter\dtl@ifsingle\expandafter{\dtl@firstB}{% + \expandafter\dtl@setcharcode\expandafter{\dtl@firstA}{\dtl@codeA}% + \expandafter\dtl@setcharcode\expandafter{\dtl@firstB}{\dtl@codeB}% + \ifnum\dtl@codeA=-1\relax + \ifnum\dtl@codeB=-1\relax + \protected@edef\dtl@donext{% + \noexpand\dtlcompare{\noexpand#1}{\dtl@restA}{\dtl@restB}}% + \dtl@donext + \else + \protected@edef\dtl@donext{% + \noexpand\dtlcompare + {\noexpand#1}{\dtl@restA}{\dtl@firstB\dtl@restB}}% + \dtl@donext + \fi + \else + \ifnum\dtl@codeB=-1\relax + \protected@edef\dtl@donext{% + \noexpand\dtlcompare + {\noexpand#1}{\dtl@firstA\dtl@restA}{\dtl@restB}}% + \dtl@donext + \else + \ifnum\dtl@codeA<\dtl@codeB + #1=-1\relax + \else + \ifnum\dtl@codeA>\dtl@codeB + #1=1\relax + \else + \ifx\dtl@restA\@empty + \ifx\dtl@restB\@empty + #1=0\relax + \else + #1=-1\relax + \fi + \else + \ifx\restB\@empty + #1=1\relax + \else + \protected@edef\dtl@donext{% + \noexpand\dtlcompare + {\noexpand#1}{\dtl@restA}{\dtl@restB}}% + \dtl@donext + \fi + \fi + \fi + \fi + \fi + \fi + }{% + \protected@edef\dtl@donext{% + \noexpand\dtlcompare + {\noexpand#1}{\dtl@firstA\dtl@restA}{\dtl@firstB\dtl@restB}}% + \dtl@donext + }}{% + \protected@edef\dtl@donext{% + \noexpand\dtlcompare + {\noexpand#1}{\dtl@firstA\dtl@restA}{\dtl@firstB\dtl@restB}}% + \dtl@donext + }% + \fi +\fi +} +\def\dtl@getfirst#1#2\end{% +\def\dtl@first{#1}% +\ifx\dtl@first\@empty + \def\dtl@rest{#2}% +\else + \dtl@ifsingle{#1}{\def\dtl@rest{#2}}{\dtl@getfirst#1#2\end}% +\fi +} +\newcount\dtl@codeA +\newcount\dtl@codeB +\newcommand*{\dtl@setcharcode}[2]{% +\def\@dtl@tmp{#1}% +\ifx\@dtl@tmp\@empty + #2=-1\relax +\else + \ifx#1\space\relax + #2=`\ \relax + \else + \ifx#1~\relax + #2=`\ \relax + \else + \ifcat\noexpand#1\relax% + #2=-1\relax + \else + #2=`#1\relax + \fi + \fi + \fi +\fi +} +\newcommand*{\dtl@setlccharcode}[2]{% +\def\@dtl@tmp{#1}% +\ifx\@dtl@tmp\@empty + #2=-1\relax +\else + \ifx#1\space\relax + #2=`\ \relax + \else + \ifx#1~\relax + #2=`\ \relax + \else + \ifcat\noexpand#1\relax% + #2=-1\relax + \else + #2=\lccode`#1\relax + \fi + \fi + \fi +\fi +} +\newcommand*{\dtlicompare}[3]{% +\dtl@subnobrsp{#2}{\@dtl@argA}% +\dtl@subnobrsp{#3}{\@dtl@argB}% +\ifx\@dtl@argA\@empty + \ifx\@dtl@argB\@empty + #1=0\relax + \else + #1=-1\relax + \fi +\else + \ifx\@dtl@argB\@empty + #1=1\relax + \else + \DTLsubstituteall{\@dtl@argA}{ }{\space }% + \DTLsubstituteall{\@dtl@argB}{ }{\space }% + \expandafter\dtl@getfirst\@dtl@argA\end + \let\dtl@firstA=\dtl@first + \let\dtl@restA=\dtl@rest + \expandafter\dtl@getfirst\@dtl@argB\end + \let\dtl@firstB=\dtl@first + \let\dtl@restB=\dtl@rest + \expandafter\dtl@ifsingle\expandafter{\dtl@firstA}{% + \expandafter\dtl@ifsingle\expandafter{\dtl@firstB}{% + \expandafter\dtl@setlccharcode\expandafter{\dtl@firstA}{\dtl@codeA}% + \expandafter\dtl@setlccharcode\expandafter{\dtl@firstB}{\dtl@codeB}% + \ifnum\dtl@codeA=-1\relax + \ifnum\dtl@codeB=-1\relax + \protected@edef\dtl@donext{% + \noexpand\dtlicompare{\noexpand#1}{\dtl@restA}{\dtl@restB}}% + \dtl@donext + \else + \protected@edef\dtl@donext{% + \noexpand\dtlicompare + {\noexpand#1}{\dtl@restA}{\dtl@firstB\dtl@restB}}% + \dtl@donext + \fi + \else + \ifnum\dtl@codeB=-1\relax + \protected@edef\dtl@donext{% + \noexpand\dtlicompare + {\noexpand#1}{\dtl@firstA\dtl@restA}{\dtl@restB}}% + \dtl@donext + \else + \ifnum\dtl@codeA<\dtl@codeB + #1=-1\relax + \else + \ifnum\dtl@codeA>\dtl@codeB + #1=1\relax + \else + \ifx\dtl@restA\@empty + \ifx\dtl@restB\@empty + #1=0\relax + \else + #1=-1\relax + \fi + \else + \ifx\restB\@empty + #1=1\relax + \else + \protected@edef\dtl@donext{% + \noexpand\dtlicompare + {\noexpand#1}{\dtl@restA}{\dtl@restB}}% + \dtl@donext + \fi + \fi + \fi + \fi + \fi + \fi + }{% + \protected@edef\dtl@donext{% + \noexpand\dtlicompare + {\noexpand#1}{\dtl@firstA\dtl@restA}{\dtl@firstB\dtl@restB}}% + \dtl@donext + }}{% + \protected@edef\dtl@donext{% + \noexpand\dtlicompare + {\noexpand#1}{\dtl@firstA\dtl@restA}{\dtl@firstB\dtl@restB}}% + \dtl@donext + }% + \fi +\fi +} +\newcommand*{\DTLifstringlt}{\@ifstar\@sDTLifstringlt\@DTLifstringlt} +\newcommand*{\@DTLifstringlt}[4]{% +\protected@edef\@dtl@tmpcmp{% + \noexpand\dtlcompare{\noexpand\@dtl@tmpcount}{#1}{#2}}% +\@dtl@tmpcmp +\ifnum\@dtl@tmpcount<0\relax + #3% +\else + #4% +\fi +} +\newcommand*{\@sDTLifstringlt}[4]{% +\protected@edef\@dtl@tmpcmp{% + \noexpand\dtlicompare{\noexpand\@dtl@tmpcount}{#1}{#2}}% +\@dtl@tmpcmp +\ifnum\@dtl@tmpcount<0\relax + #3% +\else + #4% +\fi +} +\newcommand*{\DTLiflt}{\@ifstar\@sDTLiflt\@DTLiflt} +\newcommand*{\@DTLiflt}[4]{% +\dtl@testbothnumerical{#1}{#2}% +\if@dtl@condition + \DTLifnumlt{#1}{#2}{#3}{#4}% +\else + \@DTLifstringlt{#1}{#2}{#3}{#4}% +\fi +} +\newcommand*{\@sDTLiflt}[4]{% +\dtl@testbothnumerical{#1}{#2}% +\if@dtl@condition + \DTLifnumlt{#1}{#2}{#3}{#4}% +\else + \@sDTLifstringlt{#1}{#2}{#3}{#4}% +\fi +} +\newcommand*{\DTLifnumgt}[4]{% + \DTLconverttodecimal{#1}{\@dtl@numi}% + \DTLconverttodecimal{#2}{\@dtl@numii}% + \FPifgt{\@dtl@numi}{\@dtl@numii}% + #3% + \else + #4% + \fi +} +\newcommand*{\DTLifstringgt}{\@ifstar\@sDTLifstringgt\@DTLifstringgt} +\newcommand*{\@DTLifstringgt}[4]{% +\protected@edef\@dtl@tmpcmp{% + \noexpand\dtlcompare{\noexpand\@dtl@tmpcount}{#1}{#2}}% +\@dtl@tmpcmp +\ifnum\@dtl@tmpcount>0\relax + #3% +\else + #4% +\fi +} +\newcommand*{\@sDTLifstringgt}[4]{% +\protected@edef\@dtl@tmpcmp{% + \noexpand\dtlicompare{\noexpand\@dtl@tmpcount}{#1}{#2}}% +\@dtl@tmpcmp +\ifnum\@dtl@tmpcount>0\relax + #3% +\else + #4% +\fi +} +\newcommand*{\DTLifgt}{\@ifstar\@sDTLifgt\@DTLifgt} +\newcommand*{\@DTLifgt}[4]{% +\dtl@testbothnumerical{#1}{#2}% +\if@dtl@condition + \DTLifnumgt{#1}{#2}{#3}{#4}% +\else + \@DTLifstringgt{#1}{#2}{#3}{#4}% +\fi +} +\newcommand*{\@sDTLifgt}[4]{% +\dtl@testbothnumerical{#1}{#2}% +\if@dtl@condition + \DTLifnumgt{#1}{#2}{#3}{#4}% +\else + \@sDTLifstringgt{#1}{#2}{#3}{#4}% +\fi +} +\newcommand*{\DTLifnumeq}[4]{% + \DTLconverttodecimal{#1}{\@dtl@numi}% + \DTLconverttodecimal{#2}{\@dtl@numii}% + \FPifeq{\@dtl@numi}{\@dtl@numii}% + #3% + \else + #4% + \fi +} +\newcommand*{\DTLifstringeq}{\@ifstar\@sDTLifstringeq\@DTLifstringeq} +\newcommand*{\@DTLifstringeq}[4]{% +\protected@edef\@dtl@tmpcmp{% + \noexpand\dtlcompare{\noexpand\@dtl@tmpcount}{#1}{#2}}% +\@dtl@tmpcmp +\ifnum\@dtl@tmpcount=0\relax + #3% +\else + #4% +\fi +} +\newcommand*{\@sDTLifstringeq}[4]{% +\protected@edef\@dtl@tmpcmp{% + \noexpand\dtlicompare{\noexpand\@dtl@tmpcount}{#1}{#2}}% +\@dtl@tmpcmp +\ifnum\@dtl@tmpcount=0\relax + #3% +\else + #4% +\fi +} +\newcommand*{\DTLifeq}{\@ifstar\@sDTLifeq\@DTLifeq} +\newcommand*{\@DTLifeq}[4]{% +\dtl@testbothnumerical{#1}{#2}% +\if@dtl@condition + \DTLifnumeq{#1}{#2}{#3}{#4}% +\else + \@DTLifstringeq{#1}{#2}{#3}{#4}% +\fi +} +\newcommand*{\@sDTLifeq}[4]{% +\dtl@testbothnumerical{#1}{#2}% +\if@dtl@condition + \DTLifnumeq{#1}{#2}{#3}{#4}% +\else + \@sDTLifstringeq{#1}{#2}{#3}{#4}% +\fi +} +\newcommand*{\DTLifSubString}[4]{% +\protected@edef\@dtl@tmp{\noexpand\dtl@testifsubstring +{#1}{#2}}% +\@dtl@tmp +\if@dtl@condition + #3% +\else + #4% +\fi +} +\newcommand*{\dtl@testifsubstring}[2]{% +\dtl@subnobrsp{#1}{\@dtl@argA}% +\dtl@subnobrsp{#2}{\@dtl@argB}% +\ifx\@dtl@argB\@empty + \@dtl@conditiontrue +\else + \ifx\@dtl@argA\@empty + \@dtl@conditionfalse + \else + \dtl@teststartswith{#1}{#2}% + \if@dtl@condition + \else + \DTLsubstituteall{\@dtl@argA}{ }{\space }% + \expandafter\dtl@getfirst\@dtl@argA\end + \expandafter\dtl@ifsingle\expandafter{\dtl@first}{% + \expandafter\dtl@testifsubstring\expandafter{\dtl@rest}{#2}% + }{% + \protected@edef\@dtl@donext{\noexpand\dtl@testifsubstring + {\dtl@first\dtl@rest}{\@dtl@argB}}% + \@dtl@donext + }% + \fi + \fi +\fi +} +\newcommand*{\DTLifStartsWith}[4]{% +\@dtl@conditionfalse +\protected@edef\@dtl@tmp{\noexpand\dtl@teststartswith{#1}{#2}}% +\@dtl@tmp +\if@dtl@condition + #3% +\else + #4% +\fi +} +\newcommand*{\dtl@teststartswith}[2]{% +\dtl@subnobrsp{#1}{\@dtl@argA}% +\dtl@subnobrsp{#2}{\@dtl@argB}% +\ifx\@dtl@argA\@empty + \ifx\@dtl@argB\@empty + \@dtl@conditiontrue + \else + \@dtl@conditionfalse + \fi +\else + \ifx\@dtl@argB\@empty + \@dtl@conditiontrue + \else + \DTLsubstituteall{\@dtl@argA}{ }{\space }% + \DTLsubstituteall{\@dtl@argB}{ }{\space }% + \expandafter\dtl@getfirst\@dtl@argA\end + \let\dtl@firstA=\dtl@first + \let\dtl@restA=\dtl@rest + \expandafter\dtl@getfirst\@dtl@argB\end + \let\dtl@firstB=\dtl@first + \let\dtl@restB=\dtl@rest + \expandafter\dtl@ifsingle\expandafter{\dtl@firstA}{% + \expandafter\dtl@ifsingle\expandafter{\dtl@firstB}{% + \expandafter\dtl@setcharcode\expandafter{\dtl@firstA}{\dtl@codeA}% + \expandafter\dtl@setcharcode\expandafter{\dtl@firstB}{\dtl@codeB}% + \ifnum\dtl@codeA=-1\relax + \ifnum\dtl@codeB=-1\relax + \protected@edef\dtl@donext{% + \noexpand\dtl@teststartswith{\dtl@restA}{\dtl@restB}}% + \dtl@donext + \else + \protected@edef\dtl@donext{% + \noexpand\dtl@teststartswith + {\dtl@restA}{\dtl@firstB\dtl@restB}}% + \dtl@donext + \fi + \else + \ifnum\dtl@codeB=-1\relax + \protected@edef\dtl@donext{% + \noexpand\dtl@teststartswith + {\dtl@firstA\dtl@restA}{\dtl@restB}}% + \dtl@donext + \else + \ifnum\dtl@codeA=\dtl@codeB + \protected@edef\dtl@donext{% + \noexpand\dtl@teststartswith{\dtl@restA}{\dtl@restB}}% + \dtl@donext + \else + \@dtl@conditionfalse + \fi + \fi + \fi + }{% + \protected@edef\dtl@donext{% + \noexpand\dtl@teststartswith + {\dtl@firstA\dtl@restA}{\dtl@firstB\dtl@restB}}% + \dtl@donext + }}{% + \protected@edef\dtl@donext{% + \noexpand\dtl@teststartswith + {\dtl@firstA\dtl@restA}{\dtl@firstB\dtl@restB}}% + }% + \fi +\fi +} +\newcommand*{\DTLifnumclosedbetween}[5]{% +\DTLconverttodecimal{#1}{\@dtl@numi}% +\DTLconverttodecimal{#2}{\@dtl@numii}% +\DTLconverttodecimal{#3}{\@dtl@numiii}% +\DTLifFPclosedbetween{\@dtl@numi}{\@dtl@numii}{\@dtl@numiii}{#4}{#5}% +} +\newcommand*{\DTLifstringclosedbetween}{% +\@ifstar\@sDTLifstringclosedbetween\@DTLifstringclosedbetween} +\newcommand*{\@DTLifstringclosedbetween}[5]{% +\protected@edef\@dtl@tmpcmp{% + \noexpand\dtlcompare{\noexpand\@dtl@tmpcount}{#1}{#2}}% +\@dtl@tmpcmp +\let\@dtl@dovalue\relax +\ifnum\@dtl@tmpcount<0\relax + \def\@dtl@dovalue{#5}% +\fi +\ifx\@dtl@dovalue\relax + \protected@edef\@dtl@tmpcmp{% + \noexpand\dtlcompare{\noexpand\@dtl@tmpcount}{#1}{#3}}% + \@dtl@tmpcmp + \ifnum\@dtl@tmpcount>0\relax + \def\@dtl@dovalue{#5}% + \else + \def\@dtl@dovalue{#4}% + \fi +\fi +\@dtl@dovalue +} +\newcommand*{\@sDTLifstringclosedbetween}[5]{% +\protected@edef\@dtl@tmpcmp{% + \noexpand\dtlicompare{\noexpand\@dtl@tmpcount}{#1}{#2}}% +\@dtl@tmpcmp +\let\@dtl@dovalue\relax +\ifnum\@dtl@tmpcount<0\relax + \def\@dtl@dovalue{#5}% +\fi +\ifx\@dtl@dovalue\relax + \protected@edef\@dtl@tmpcmp{% + \noexpand\dtlicompare{\noexpand\@dtl@tmpcount}{#1}{#3}}% + \@dtl@tmpcmp + \ifnum\@dtl@tmpcount>0\relax + \def\@dtl@dovalue{#5}% + \else + \def\@dtl@dovalue{#4}% + \fi +\fi +\@dtl@dovalue +} +\newcommand*{\DTLifclosedbetween}{% +\@ifstar\@sDTLifclosedbetween\@DTLifclosedbetween} +\newcommand*{\@DTLifclosedbetween}[5]{% +\dtl@testbothnumerical{#2}{#3}% +\if@dtl@condition + \dtl@ifsingle{#1}{% + \edef\@dtl@tmp{#1}}{% + \def\@dtl@tmp{#1}}% + \expandafter\@dtl@checknumerical\expandafter{\@dtl@tmp}% + \ifnum\@dtl@datatype>0\relax + \DTLifnumclosedbetween{#1}{#2}{#3}{#4}{#5}% + \else + \@DTLifstringclosedbetween{#1}{#2}{#3}{#4}{#5}% + \fi +\else + \@DTLifstringclosedbetween{#1}{#2}{#3}{#4}{#5}% +\fi +} +\newcommand*{\@sDTLifclosedbetween}[5]{% +\dtl@testbothnumerical{#2}{#3}% +\if@dtl@condition + \dtl@ifsingle{#1}{% + \edef\@dtl@tmp{#1}}{% + \def\@dtl@tmp{#1}}% + \expandafter\@dtl@checknumerical\expandafter{\@dtl@tmp}% + \ifnum\@dtl@datatype>0\relax + \DTLifnumclosedbetween{#1}{#2}{#3}{#4}{#5}% + \else + \@sDTLifstringclosedbetween{#1}{#2}{#3}{#4}{#5}% + \fi +\else + \@sDTLifstringclosedbetween{#1}{#2}{#3}{#4}{#5}% +\fi +} +\newcommand*{\DTLifnumopenbetween}[5]{% +\DTLconverttodecimal{#1}{\@dtl@numi}% +\DTLconverttodecimal{#2}{\@dtl@numii}% +\DTLconverttodecimal{#3}{\@dtl@numiii}% +\DTLifFPopenbetween{\@dtl@numi}{\@dtl@numii}{\@dtl@numiii}{#4}{#5}% +} +\newcommand*{\DTLifstringopenbetween}{% +\@ifstar\@sDTLifstringopenbetween\@DTLifstringopenbetween} +\newcommand*{\@DTLifstringopenbetween}[5]{% +\protected@edef\@dtl@tmpcmp{% + \noexpand\dtlcompare{\noexpand\@dtl@tmpcount}{#1}{#2}}% +\@dtl@tmpcmp +\let\@dtl@dovalue\relax +\ifnum\@dtl@tmpcount>0\relax +\else + \def\@dtl@dovalue{#5}% +\fi +\ifx\@dtl@dovalue\relax + \protected@edef\@dtl@tmpcmp{% + \noexpand\dtlcompare{\noexpand\@dtl@tmpcount}{#1}{#3}}% + \@dtl@tmpcmp + \ifnum\@dtl@tmpcount<0\relax + \def\@dtl@dovalue{#4}% + \else + \def\@dtl@dovalue{#5}% + \fi +\fi +\@dtl@dovalue +} +\newcommand*{\@sDTLifstringopenbetween}[5]{% +\protected@edef\@dtl@tmpcmp{% + \noexpand\dtlicompare{\noexpand\@dtl@tmpcount}{#1}{#2}}% +\@dtl@tmpcmp +\let\@dtl@dovalue\relax +\ifnum\@dtl@tmpcount>0\relax +\else + \def\@dtl@dovalue{#5}% +\fi +\ifx\@dtl@dovalue\relax + \protected@edef\@dtl@tmpcmp{% + \noexpand\dtlicompare{\noexpand\@dtl@tmpcount}{#1}{#3}}% + \@dtl@tmpcmp + \ifnum\@dtl@tmpcount<0\relax + \def\@dtl@dovalue{#4}% + \else + \def\@dtl@dovalue{#5}% + \fi +\fi +\@dtl@dovalue +} +\newcommand*{\DTLifopenbetween}{% +\@ifstar\@sDTLifopenbetween\@DTLifopenbetween} +\newcommand*{\@DTLifopenbetween}[5]{% +\dtl@testbothnumerical{#2}{#3}% +\if@dtl@condition + \dtl@ifsingle{#1}{% + \edef\@dtl@tmp{#1}}{% + \def\@dtl@tmp{#1}}% + \expandafter\@dtl@checknumerical\expandafter{\@dtl@tmp}% + \ifnum\@dtl@datatype>0\relax + \DTLifnumopenbetween{#1}{#2}{#3}{#4}{#5}% + \else + \@DTLifstringopenbetween{#1}{#2}{#3}{#4}{#5}% + \fi +\else + \@DTLifstringopenbetween{#1}{#2}{#3}{#4}{#5}% +\fi +} +\newcommand*{\@sDTLifopenbetween}[5]{% +\dtl@testbothnumerical{#2}{#3}% +\if@dtl@condition + \dtl@ifsingle{#1}{% + \edef\@dtl@tmp{#1}}{% + \def\@dtl@tmp{#1}}% + \expandafter\@dtl@checknumerical\expandafter{\@dtl@tmp}% + \ifnum\@dtl@datatype>0\relax + \DTLifnumopenbetween{#1}{#2}{#3}{#4}{#5}% + \else + \@sDTLifstringopenbetween{#1}{#2}{#3}{#4}{#5}% + \fi +\else + \@sDTLifstringopenbetween{#1}{#2}{#3}{#4}{#5}% +\fi +} +\newcommand*{\DTLifFPopenbetween}[5]{% + \let\@dtl@dovalue\relax + \FPifgt{#1}{#2}% + \else + \def\@dtl@dovalue{#5}% + \fi + \FPiflt{#1}{#3}% + \ifx\@dtl@dovalue\relax + \def\@dtl@dovalue{#4}% + \fi + \else + \def\@dtl@dovalue{#5}% + \fi +\@dtl@dovalue +} +\newcommand*{\DTLifFPclosedbetween}[5]{% + \let\@dtl@dovalue\relax + \FPifgt{#1}{#3}% + \def\@dtl@dovalue{#5}% + \fi + \FPiflt{#1}{#2}% + \ifx\@dtl@dovalue\relax + \def\@dtl@dovalue{#5}% + \fi + \else + \def\@dtl@dovalue{#4}% + \fi +\@dtl@dovalue +} +\newcommand{\DTLiffirstrow}[2]{% +\ifnum\dtlforeachlevel=0\relax + \PackageError{datatool}{\string\DTLiffirstrow\space can only + be used inside \string\DTLforeach}{}% +\else +\expandafter\ifnum\csname c@DTLrow\romannumeral +\dtlforeachlevel\endcsname +=1\relax#1\else#2\fi +\fi} +\newcommand{\DTLiflastrow}[2]{% +\ifnum\dtlforeachlevel=0\relax + \PackageError{datatool}{\string\DTLiflastrow\space can only + be used inside \string\DTLforeach}{}% +\else +\ifx\@dtl@nextrow\@nnil +#1\else #2\fi +\fi +} +\newcommand{\DTLifoddrow}[2]{% +\ifnum\dtlforeachlevel=0\relax + \PackageError{datatool}{\string\DTLifoddrow\space can only + be used inside \string\DTLforeach}{}% +\else +\expandafter\ifodd\csname c@DTLrow\romannumeral +\dtlforeachlevel\endcsname +#1\else #2\fi +\fi +} +\newif\if@dtl@condition +\newcommand*{\dtl@testlt}[2]{% +\DTLiflt{#1}{#2}{\@dtl@conditiontrue}{\@dtl@conditionfalse}} +\newcommand*{\DTLislt}[2]{% +\TE@throw\noexpand\dtl@testlt{#1}{#2}\noexpand\if@dtl@condition} +\newcommand*{\dtl@testiclt}[2]{% +\@sDTLiflt{#1}{#2}{\@dtl@conditiontrue}{\@dtl@conditionfalse}} +\newcommand*{\DTLisilt}[2]{% +\TE@throw\noexpand\dtl@testiclt{#1}{#2}\noexpand\if@dtl@condition} +\newcommand*{\dtl@testgt}[2]{% +\DTLifgt{#1}{#2}{\@dtl@conditiontrue}{\@dtl@conditionfalse}} +\newcommand*{\DTLisgt}[2]{% +\TE@throw\noexpand\dtl@testgt{#1}{#2}\noexpand\if@dtl@condition} +\newcommand*{\dtl@testicgt}[2]{% +\@sDTLifgt{#1}{#2}{\@dtl@conditiontrue}{\@dtl@conditionfalse}} +\newcommand*{\DTLisigt}[2]{% +\TE@throw\noexpand\dtl@testicgt{#1}{#2}\noexpand\if@dtl@condition} +\newcommand*{\dtl@testeq}[2]{% +\DTLifeq{#1}{#2}{\@dtl@conditiontrue}{\@dtl@conditionfalse}} +\newcommand*{\DTLiseq}[2]{% +\TE@throw\noexpand\dtl@testeq{#1}{#2}\noexpand\if@dtl@condition} +\newcommand*{\dtl@testiceq}[2]{% +\@sDTLifeq{#1}{#2}{\@dtl@conditiontrue}{\@dtl@conditionfalse}} +\newcommand*{\DTLisieq}[2]{% +\TE@throw\noexpand\dtl@testiceq{#1}{#2}\noexpand\if@dtl@condition} +\newcommand*{\DTLisSubString}[2]{% +\TE@throw\noexpand\dtl@testifsubstring{#1}{#2}% +\noexpand\if@dtl@condition} +\newcommand*{\DTLisPrefix}[2]{% +\TE@throw\noexpand\dtl@teststartswith{#1}{#2}% +\noexpand\if@dtl@condition} +\newcommand*{\dtl@testclosedbetween}[3]{% +\DTLifclosedbetween{#1}{#2}{#3}{\@dtl@conditiontrue}{\@dtl@conditionfalse}} +\newcommand*{\DTLisclosedbetween}[3]{% +\TE@throw\noexpand\dtl@testclosedbetween{#1}{#2}{#3}% +\noexpand\if@dtl@condition} +\newcommand*{\dtl@testiclosedbetween}[3]{% +\@sDTLifclosedbetween{#1}{#2}{#3}{\@dtl@conditiontrue}{\@dtl@conditionfalse}} +\newcommand*{\DTLisiclosedbetween}[3]{% +\TE@throw\noexpand\dtl@testiclosedbetween{#1}{#2}{#3}% +\noexpand\if@dtl@condition} +\newcommand*{\dtl@testopenbetween}[3]{% +\DTLifopenbetween{#1}{#2}{#3}{\@dtl@conditiontrue +}{\@dtl@conditionfalse}} +\newcommand*{\DTLisopenbetween}[3]{% +\TE@throw\noexpand\dtl@testopenbetween{#1}{#2}{#3}% +\noexpand\if@dtl@condition} +\newcommand*{\dtl@testiopenbetween}[3]{% +\@sDTLifopenbetween{#1}{#2}{#3}{\@dtl@conditiontrue +}{\@dtl@conditionfalse}} +\newcommand*{\DTLisiopenbetween}[3]{% +\TE@throw\noexpand\dtl@testiopenbetween{#1}{#2}{#3}% +\noexpand\if@dtl@condition} +\newcommand*{\dtl@testFPclosedbetween}[3]{% +\DTLifFPclosedbetween{#1}{#2}{#3}% +{\@dtl@conditiontrue}{\@dtl@conditionfalse}} +\newcommand*{\DTLisFPclosedbetween}[3]{% +\TE@throw\noexpand\dtl@testFPclosedbetween{#1}{#2}{#3}% +\noexpand\if@dtl@condition} +\newcommand*{\dtl@testFPopenbetween}[3]{% +\DTLifFPopenbetween{#1}{#2}{#3}{\@dtl@conditiontrue}{\@dtl@conditionfalse}} +\newcommand*{\DTLisFPopenbetween}[3]{% +\TE@throw\noexpand\dtl@testFPopenbetween{#1}{#2}{#3}% +\noexpand\if@dtl@condition} +\newcommand*{\dtl@testFPislt}[2]{% +\FPiflt{#1}{#2}\@dtl@conditiontrue\else\@dtl@conditionfalse\fi} +\newcommand*{\DTLisFPlt}[2]{% +\TE@throw\noexpand\dtl@testFPislt{#1}{#2}% +\noexpand\if@dtl@condition} +\newcommand*{\dtl@testFPisgt}[2]{% +\FPifgt{#1}{#2}\@dtl@conditiontrue\else\@dtl@conditionfalse\fi} +\newcommand*{\DTLisFPgt}[2]{% +\TE@throw\noexpand\dtl@testFPisgt{#1}{#2}% +\noexpand\if@dtl@condition} +\newcommand*{\dtl@testFPiseq}[2]{% +\FPifeq{#1}{#2}\@dtl@conditiontrue\else\@dtl@conditionfalse\fi} +\newcommand*{\DTLisFPeq}[2]{% +\TE@throw\noexpand\dtl@testFPiseq{#1}{#2}% +\noexpand\if@dtl@condition} +\newcommand*{\dtl@testFPislteq}[2]{% +\FPiflt{#1}{#2}\@dtl@conditiontrue\else\@dtl@conditionfalse\fi +\if@dtl@condition +\else + \dtl@testFPiseq{#1}{#2}% +\fi +} +\newcommand*{\DTLisFPlteq}[2]{% +\TE@throw\noexpand\dtl@testFPislteq{#1}{#2}% +\noexpand\if@dtl@condition} +\newcommand*{\dtl@testFPisgteq}[2]{% +\FPifgt{#1}{#2}\@dtl@conditiontrue\else\@dtl@conditionfalse\fi +\if@dtl@condition +\else + \dtl@testFPiseq{#1}{#2}% +\fi +} +\newcommand*{\DTLisFPgteq}[2]{% +\TE@throw\noexpand\dtl@testFPisgteq{#1}{#2}% +\noexpand\if@dtl@condition} +\newcommand*{\dtl@teststring}[1]{% +\DTLifstring{#1}{\@dtl@conditiontrue}{\@dtl@conditionfalse}} +\newcommand*{\DTLisstring}[1]{% +\TE@throw\noexpand\dtl@teststring{#1}\noexpand\if@dtl@condition} +\newcommand*{\dtl@testnumerical}[1]{% +\DTLifnumerical{#1}{\@dtl@conditiontrue}{\@dtl@conditionfalse}% +} +\newcommand*{\DTLisnumerical}[1]{% +\TE@throw\noexpand\dtl@testnumerical{#1}\noexpand\if@dtl@condition} +\newcommand*{\dtl@testint}[1]{% +\DTLifint{#1}{\@dtl@conditiontrue}{\@dtl@conditionfalse}} +\newcommand*{\DTLisint}[1]{% +\TE@throw\noexpand\dtl@testint{#1}\noexpand\if@dtl@condition} +\newcommand*{\dtl@testreal}[1]{% +\DTLifreal{#1}{\@dtl@conditiontrue}{\@dtl@conditionfalse}} +\newcommand*{\DTLisreal}[1]{% +\TE@throw\noexpand\dtl@testreal{#1}\noexpand\if@dtl@condition} +\newcommand*{\dtl@testcurrency}[1]{% +\DTLifcurrency{#1}{\@dtl@conditiontrue}{\@dtl@conditionfalse}} +\newcommand*{\DTLiscurrency}[1]{% +\TE@throw\noexpand\dtl@testcurrency{#1}\noexpand\if@dtl@condition} +\newcommand*{\dtl@testcurrencyunit}[2]{% +\DTLifcurrencyunit{#1}{#2}{\@dtl@conditiontrue}{\@dtl@conditionfalse}} +\newcommand*{\DTLiscurrencyunit}[2]{% +\TE@throw\noexpand\dtl@testcurrencyunit{#1}{#2}% +\noexpand\if@dtl@condition} +\newcommand*{\DTLnewdb}[1]{% +\DTLifdbexists{#1}{% +\PackageError{datatool}{Database `#1' already exists}{}}{% +\dtl@message{Creating database `#1'}% +\expandafter\gdef\csname dtldb@#1\endcsname{}% +\expandafter\gdef\csname dtlkeys@#1\endcsname{}% +\expandafter\global\expandafter\newcount\csname dtlrows@#1\endcsname}} +\newcommand*{\DTLrowcount}[1]{% +\expandafter\number\csname dtlrows@#1\endcsname} +\newcommand{\DTLifdbempty}[3]{% +\DTLifdbexists{#1}{% +\expandafter\ifx\csname dtldb@#1\endcsname\@empty + #2% +\else + #3% +\fi}{% +\PackageError{Database `#1' doesn't exist}{}{}}} +\newcommand*{\DTLnewrow}[1]{% +\DTLifdbempty{#1}{% + \expandafter\gdef\csname dtldb@#1\endcsname{{}}% + \expandafter\global\expandafter\advance + \csname dtlrows@#1\endcsname by 1\relax + \dtl@message{New row added to database `#1'}% +}{% + \expandafter\let\expandafter\@dtl@olddb\csname dtldb@#1\endcsname% + \expandafter\toks@\expandafter{\@dtl@olddb,{}}% + \expandafter\xdef\csname dtldb@#1\endcsname{\the\toks@}% + \expandafter\global\expandafter\advance + \csname dtlrows@#1\endcsname by 1\relax + \dtl@message{New row added to database `#1'}% +}} +\newcommand{\DTLnewdbentry}[3]{% +\@dtl@toks{#3}% +\edef\@dtl@dbvalue{\the\@dtl@toks}% +\edef\@dtl@dbid{#2}% +\edef\@dtl@dbentry{{\@dtl@dbid}{\the\@dtl@toks}}% +\DTLifdbempty{#1}{\DTLnewrow{#1}}{}% +\expandafter\dtl@choplast\expandafter{% +\csname dtldb@#1\endcsname}{\@dtl@dbrest}{\@dtl@dblastrow}% +\dtl@ifrowcontains{#2}{\@dtl@dblastrow}{% +\PackageError{datatool}{Can't add entry with ID `#2' to current +row of database `#1'}{There is already an entry with this ID on +the current row}}{% +\expandafter\@dtl@toks\expandafter{\@dtl@dbentry}% +\ifthenelse{\equal{}{\@dtl@dblastrow}}{% + \edef\@dtl@dblastrow{\the\@dtl@toks}% +}{% + \expandafter\toks@\expandafter{\@dtl@dblastrow}% + \edef\@dtl@dblastrow{\the\toks@,\the\@dtl@toks}% +}% +\expandafter\@dtl@toks\expandafter{\@dtl@dblastrow}% +\ifthenelse{\equal{}{\@dtl@dbrest}}{% + \expandafter\long\expandafter\xdef\csname dtldb@#1\endcsname{% + {\the\@dtl@toks}}% +}{% + \expandafter\toks@\expandafter{\@dtl@dbrest}% + \expandafter\long\expandafter\xdef\csname dtldb@#1\endcsname{% + \the\toks@,{\the\@dtl@toks}}% +}% +\@dtl@setidtype{#1}{#2}{#3}% +\expandafter\@dtl@setkeys\expandafter{#2}{#1}% +}% +\dtl@message{Added #2\space -> #3\space to database `#1'}% +} +\newcommand{\@dtl@setidtype}[3]{% +\@dtl@checknumerical{#3}% +\def\@dtl@value{#3}% +\@ifundefined{@dtl@idtype@#1@#2}{% +\ifx\@dtl@value\@empty + \expandafter\gdef\csname @dtl@idtype@#1@#2\endcsname{}% +\else + \expandafter\xdef\csname @dtl@idtype@#1@#2\endcsname{% + \the\@dtl@datatype}% +\fi +}{% +\ifx\@dtl@value\@empty +\else + \expandafter\ifx\csname @dtl@idtype@#1@#2\endcsname\@empty + \expandafter\xdef\csname @dtl@idtype@#1@#2\endcsname{% + \the\@dtl@datatype}% + \else + \expandafter\@dtl@tmpcount\expandafter= + \csname @dtl@idtype@#1@#2\endcsname\relax + \ifcase\@dtl@tmpcount + \or + \expandafter\xdef\csname @dtl@idtype@#1@#2\endcsname{% + \the\@dtl@datatype}% + \or + \ifnum\@dtl@datatype=0\relax + \expandafter\gdef\csname @dtl@idtype@#1@#2\endcsname{0}% + \else + \ifnum\@dtl@datatype=3\relax + \expandafter\gdef\csname @dtl@idtype@#1@#2\endcsname{3}% + \else + \expandafter\gdef\csname @dtl@idtype@#1@#2\endcsname{2}% + \fi + \fi + \or + \ifnum\@dtl@datatype=0\relax + \expandafter\gdef\csname @dtl@idtype@#1@#2\endcsname{0}% + \else + \expandafter\gdef\csname @dtl@idtype@#1@#2\endcsname{3}% + \fi + \fi + \fi +\fi +}% +} +\newcommand*{\@dtl@setkeys}[2]{% +\edef\@dtl@tmp{\csname dtlkeys@#2\endcsname}% +\expandafter\@dtl@toks\expandafter{\@dtl@tmp}% +\expandafter\ifx\csname dtlkeys@#2\endcsname\@empty + \expandafter\gdef\csname dtlkeys@#2\endcsname{#1}% +\else + \@for\dtl@key:=\@dtl@tmp\do{% + \ifthenelse{\equal{\dtl@key}{#1}}{\@endfortrue}{}% + }% + \if@endfor + \else + \expandafter\xdef\csname dtlkeys@#2\endcsname{\the\@dtl@toks,#1}% + \fi +\fi +} +\newcommand*{\@dtl@getidtype}[2]{% +\csname @dtl@idtype@#1@#2\endcsname} +\newcommand{\DTLifdbexists}[3]{% +\@ifundefined{dtldb@#1}{#3}{#2}} +\newcommand{\dtl@ifrowcontains}[4]{% +\@for\@dtl@element:=#2\do{% +\dtl@getentryid{\@dtl@element}{\@dtl@entryid}% +\ifthenelse{\equal{#1}{\@dtl@entryid}}{\@endfortrue}{}% +}% +\if@endfor #3\else #4\fi +} +\newcommand*{\dtl@getentryid}[2]{\expandafter\@dtl@getentryid#1#2} +\long\def\@dtl@getentryid#1#2#3{\def#3{#1}} +\newcommand*{\dtl@getentryvalue}[2]{% +\expandafter\@dtl@getentryvalue#1#2} +\long\def\@dtl@getentryvalue#1#2#3{\gdef#3{#2}} +\global\newcount\dtlforeachlevel +\newcounter{DTLrowi} +\newcounter{DTLrowii} +\newcounter{DTLrowiii} +\newcounter{DTLrow} +\def\theHDTLrow{\arabic{DTLrow}} +\def\theHDTLrowi{\theHDTLrow.\arabic{DTLrowi}} +\def\theHDTLrowii{\theHDTLrowi.\arabic{DTLrowii}} +\def\theHDTLrowiii{\theHDTLrowii.\arabic{DTLrowiii}} +\newcommand*{\DTLsavelastrowcount}[1]{% +\ifnum\dtlforeachlevel>2\relax + \def#1{0}% +\else + \ifnum\dtlforeachlevel<0\relax + \def#1{0}% + \else + \@dtl@tmpcount=\dtlforeachlevel + \advance\@dtl@tmpcount by 1\relax + \edef#1{\expandafter\number + \csname c@DTLrow\romannumeral\@dtl@tmpcount\endcsname}% + \fi +\fi} +\newcommand*{\DTLforeach}{\@ifstar\@sDTLforeach\@DTLforeach} +\newcommand{\@DTLforeach}[4][\boolean{true}]{% +\DTLifdbexists{#2}{% +\refstepcounter{DTLrow}% +\global\c@DTLrow=\c@DTLrow +\gdef\@dtl@dbname{#2}% +\global\advance\dtlforeachlevel by 1\relax +\ifnum\dtlforeachlevel>3\relax + \PackageError{datatool}{\string\DTLforeach\space nested too +deeply}{}% +\else + \expandafter\global + \csname c@DTLrow\romannumeral\dtlforeachlevel\endcsname = 0\relax + \expandafter\global\expandafter\let + \csname @dtl@foreachrows@\romannumeral\dtlforeachlevel\endcsname + =\@empty + \expandafter\global\expandafter\let + \csname @dtl@dbname@\romannumeral\dtlforeachlevel\endcsname + =\@dtl@dbname + \expandafter\let\expandafter\@dtl@db\csname dtldb@#2\endcsname% + \@for\@dtl@currentrow:=\@dtl@db\do{% + \expandafter\global\expandafter + \let\csname @dtl@thiscurrentrow@\romannumeral\dtlforeachlevel + \endcsname=\@dtl@currentrow + \global\let\@dtl@nextrow\@xfor@nextelement + \ifx\relax#3\relax + \else + \@dtl@assign{#3}% + \fi + \ifthenelse{#1}{% + \refstepcounter{DTLrow\romannumeral\dtlforeachlevel}% + \expandafter\edef\expandafter\DTLcurrentindex\expandafter + {\arabic{DTLrow\romannumeral\dtlforeachlevel}}% + #4% + }{}% + \expandafter\let\expandafter\@dtl@thiscurrentrow + \csname @dtl@thiscurrentrow@\romannumeral\dtlforeachlevel\endcsname + \ifx\@dtl@thiscurrentrow\@empty + \else + \expandafter\@dtl@toks\expandafter{\@dtl@thiscurrentrow}% + \expandafter + \ifx + \csname @dtl@foreachrows@\romannumeral\dtlforeachlevel\endcsname + \@empty + \expandafter + \xdef\csname @dtl@foreachrows@\romannumeral\dtlforeachlevel\endcsname{% + {\the\@dtl@toks}}% + \else + \expandafter\let\expandafter\@dtl@foreachrows\expandafter + =\csname @dtl@foreachrows@\romannumeral\dtlforeachlevel\endcsname + \expandafter\toks@\expandafter{\@dtl@foreachrows}% + \expandafter + \xdef\csname @dtl@foreachrows@\romannumeral\dtlforeachlevel\endcsname{% + \the\toks@,{\the\@dtl@toks}}% + \fi + \fi +\@endforfalse +}% +\expandafter\let\expandafter\@dtl@foreachrows\expandafter + =\csname @dtl@foreachrows@\romannumeral\dtlforeachlevel\endcsname +\expandafter\global + \expandafter\let\csname dtldb@#2\endcsname=\@dtl@foreachrows +\fi +\global\advance\dtlforeachlevel by -1\relax +}{% +\PackageError{datatool}{Database `#2' doesn't exist}{}}% +} +\newcommand{\@sDTLforeach}[4][\boolean{true}]{% +\DTLifdbexists{#2}{% +\refstepcounter{DTLrow}% +\global\c@DTLrow=\c@DTLrow +\gdef\@dtl@dbname{#2}% +\global\advance\dtlforeachlevel by 1\relax +\ifnum\dtlforeachlevel>3\relax + \PackageError{datatool}{\string\DTLforeach\space nested too +deeply}{}% +\else + \expandafter\global + \csname c@DTLrow\romannumeral\dtlforeachlevel\endcsname = 0\relax + \expandafter\global\expandafter\let + \csname @dtl@dbname@\romannumeral\dtlforeachlevel\endcsname + =\@nnil + \expandafter\let\expandafter\@dtl@db\csname dtldb@#2\endcsname% + \@for\@dtl@currentrow:=\@dtl@db\do{% + \expandafter\global\expandafter + \let\csname @dtl@thiscurrentrow@\romannumeral\dtlforeachlevel + \endcsname=\@dtl@currentrow + \global\let\@dtl@nextrow\@xfor@nextelement + \ifx\relax#3\relax + \else + \@dtl@assign{#3}% + \fi + \ifthenelse{#1}{% + \refstepcounter{DTLrow\romannumeral\dtlforeachlevel}% + \expandafter\edef\expandafter\DTLcurrentindex\expandafter + {\arabic{DTLrow\romannumeral\dtlforeachlevel}}% + #4% + }{}% +\@endforfalse +}% +\fi +\global\advance\dtlforeachlevel by -1\relax +}{% +\PackageError{datatool}{Database `#2' doesn't exist}{}}% +} +\newcommand*{\DTLappendtorow}[2]{% +\ifnum\dtlforeachlevel=0\relax + \PackageError{datatool}{\string\DTLappendtorow\space can only + be used inside \string\DTLforeach}{}% +\else + \expandafter\let\expandafter\@dtl@thisdb + \csname @dtl@dbname@\romannumeral\dtlforeachlevel\endcsname + \ifx\@dtl@thisdb\@nnil + \PackageError{datatool}{\string\DTLappendtorow\space can't + be used inside \string\DTLforeach*}{The starred version of + \string\DTLforeach\space is read only}% + \else + \expandafter\@dtl@toks\expandafter{#2}% + \edef\@dtl@dbvalue{\the\@dtl@toks}% + \edef\@dtl@dbid{#1}% + \edef\@dtl@dbentry{{\@dtl@dbid}{\the\@dtl@toks}}% + \expandafter\let\expandafter\@dtl@thisrow + \csname @dtl@thiscurrentrow@\romannumeral\dtlforeachlevel\endcsname + \dtl@ifrowcontains{#1}{\@dtl@thisrow}{% + \PackageError{datatool}{Can't add entry with ID `#1' to current + row of database `\@dtl@thisdb'}{There is already an entry with + this ID on the current row}}{% + \expandafter\@dtl@toks\expandafter{\@dtl@dbentry}% + \ifx\@dtl@thisrow\@empty + \expandafter + \xdef\csname @dtl@thiscurrentrow@\romannumeral\dtlforeachlevel\endcsname{% + \the\@dtl@toks}% + \else + \expandafter\toks@\expandafter{\@dtl@thisrow}% + \expandafter + \xdef\csname @dtl@thiscurrentrow@\romannumeral\dtlforeachlevel\endcsname{% + \the\toks@,\the\@dtl@toks}% + \fi + } + \@dtl@setidtype{\@dtl@thisdb}{#1}{#2}% + \expandafter\@dtl@setkeys\expandafter{#1}{\@dtl@thisdb}% + \fi +\fi +} +\newcommand*{\DTLremoveentryfromrow}[1]{% +\ifnum\dtlforeachlevel=0\relax + \PackageError{datatool}{\string\DTLremoveentryfromrow\space can only + be used inside \string\DTLforeach}{}% +\else + \expandafter\let\expandafter\@dtl@thisdb + \csname @dtl@dbname@\romannumeral\dtlforeachlevel\endcsname + \ifx\@dtl@thisdb\@nnil + \PackageError{datatool}{\string\DTLremoveentryfromrow\space can't + be used inside \string\DTLforeach*}{The starred version of + \string\DTLforeach\space is read only}% + \else + \expandafter\let\expandafter\@dtl@thisrow + \csname @dtl@thiscurrentrow@\romannumeral\dtlforeachlevel\endcsname + \dtl@ifrowcontains{#1}{\@dtl@thisrow}{% + \let\@dtl@pre=\@empty + \@for\dtl@thisentry:=\@dtl@thisrow\do{% + \dtl@getentryid\dtl@thisentry\@dtl@id + \ifthenelse{\equal{\@dtl@id}{#1}}{% + }{% + \expandafter\@dtl@toks\expandafter{\dtl@thisentry}% + \ifx\@dtl@pre\@empty + \edef\@dtl@pre{{\the\@dtl@toks}}% + \else + \expandafter\toks@\expandafter{\@dtl@pre}% + \edef\@dtl@pre{\the\toks@,{\the\@dtl@toks}}% + \fi + } + }% + \expandafter\let + \csname @dtl@thiscurrentrow@\romannumeral\dtlforeachlevel\endcsname + =\@dtl@pre + }{% + \PackageError{datatool}{Can't remove entry given by key `#1' + from current row in database `\@dtl@thisdb', no such entry}{}% + }% + \fi +\fi +} +\newcommand*{\DTLreplaceentryforrow}[2]{% +\ifnum\dtlforeachlevel=0\relax + \PackageError{datatool}{\string\DTLreplaceentryforrow\space can only + be used inside \string\DTLforeach}{}% +\else + \expandafter\let\expandafter\@dtl@thisdb + \csname @dtl@dbname@\romannumeral\dtlforeachlevel\endcsname + \ifx\@dtl@thisdb\@nnil + \PackageError{datatool}{\string\DTLreplaceentryforrow\space can't + be used inside \string\DTLforeach*}{The starred version of + \string\DTLforeach\space is read only}% + \else + \expandafter\@dtl@toks\expandafter{#2}% + \edef\@dtl@dbvalue{\the\@dtl@toks}% + \edef\@dtl@dbid{#1}% + \edef\dtl@newentry{{\@dtl@dbid}{\the\@dtl@toks}}% + \expandafter\let\expandafter\@dtl@thisrow + \csname @dtl@thiscurrentrow@\romannumeral\dtlforeachlevel\endcsname + \dtl@ifrowcontains{#1}{\@dtl@thisrow}{% + \let\@dtl@pre=\@empty + \@for\dtl@thisentry:=\@dtl@thisrow\do{% + \dtl@getentryid\dtl@thisentry\@dtl@id + \ifthenelse{\equal{\@dtl@id}{#1}}{% + \expandafter\@dtl@toks\expandafter{\dtl@newentry}% + }{% + \expandafter\@dtl@toks\expandafter{\dtl@thisentry}% + } + \ifx\@dtl@pre\@empty + \edef\@dtl@pre{{\the\@dtl@toks}}% + \else + \expandafter\toks@\expandafter{\@dtl@pre}% + \edef\@dtl@pre{\the\toks@,{\the\@dtl@toks}}% + \fi + }% + \expandafter\let + \csname @dtl@thiscurrentrow@\romannumeral\dtlforeachlevel\endcsname + =\@dtl@pre + }{% + \PackageError{datatool}{Can't remove entry given by key `#1' + from current row in database `\@dtl@thisdb', no such entry}{}% + }% + \fi +\fi +} +\newcommand*{\DTLremovecurrentrow}{% +\ifnum\dtlforeachlevel=0\relax + \PackageError{datatool}{\string\DTLremovecurrentrow\space can only + be used inside \string\DTLforeach}{}% +\else + \expandafter\ifx + \csname @dtl@dbname@\romannumeral\dtlforeachlevel\endcsname\@nnil + \PackageError{datatool}{\string\DTLremovecurrentrow\space can't + be used inside \string\DTLforeach*}{The starred version of + \string\DTLforeach\space is read only}% + \else + \expandafter\let + \csname @dtl@thiscurrentrow@\romannumeral\dtlforeachlevel\endcsname + =\@empty + \fi +\fi +} +\newcommand*{\DTLforeachkeyinrow}[2]{% +\ifnum\dtlforeachlevel=0\relax + \PackageError{datatool}{\string\DTLforeachkeyinrow\space can only + be used inside \string\DTLforeach}{}% +\else + \expandafter\let\expandafter\@dtl@thisrow + \csname @dtl@thiscurrentrow@\romannumeral\dtlforeachlevel\endcsname + \@for\dtl@thisentry:=\@dtl@thisrow\do{% + \dtl@getentryvalue\dtl@thisentry{#1}% + #2% + }% +\fi +} +\newcommand{\DTLaddentryforrow}[5]{% +\gdef\@dtl@dbname{#1}% +\DTLifdbexists{#1}{% + \expandafter\@dtl@toks\expandafter{#5}% + \edef\@dtl@dbvalue{\the\@dtl@toks}% + \edef\@dtl@dbid{#4}% + \edef\@dtl@dbentry{{\@dtl@dbid}{\the\@dtl@toks}}% + \expandafter + \let\expandafter\@dtl@db\csname dtldb@\@dtl@dbname\endcsname% + \let\@dtl@prerow=\@empty + \@for\@dtl@currentrow:=\@dtl@db\do{% + \@dtl@assign{#2}% + \ifthenelse{#3}{% + \expandafter\@dtl@toks\expandafter{\@dtl@dbentry}% + \ifx\@dtl@currentrow\@empty + \edef\@dtl@currentrow{{\the\@dtl@toks}}% + \else + \expandafter\toks@\expandafter{\@dtl@currentrow}% + \edef\@dtl@currentrow{\the\toks@,{\the\@dtl@toks}}% + \fi + \@endfortrue + }{% + }% + \expandafter\@dtl@toks\expandafter{\@dtl@currentrow}% + \ifx\@dtl@prerow\@empty + \edef\@dtl@prerow{{\the\@dtl@toks}}% + \else + \expandafter\toks@\expandafter{\@dtl@prerow}% + \edef\@dtl@prerow{\the\toks@,{\the\@dtl@toks}}% + \fi +}% +\if@endfor + \expandafter\@dtl@toks\expandafter{\@forremainder}% + \expandafter\toks@\expandafter{\@dtl@prerow}% + \edef\@dtl@prerow{\the\toks@,{\the\@dtl@toks}}% + \expandafter\global\expandafter + \let\csname dtldb@\@dtl@dbname\endcsname=\@dtl@prerow +\else + \PackageError{datatool}{Unable to add `#5' for key `#4' - condition + not met for any row in database `#1'}{}% +\fi +\@endforfalse +}{% +\PackageError{datatool}{Database `#1' doesn't exist}{}}% +} +\newcommand*{\@dtl@assign}[2][\@dtl@currentrow]{% +\@dtl@assigncmd#2,\relax\@@{#1}% +} +\def\@dtl@assigncmd#1=#2,#3\@@#4{% +\@for\@dtl@entry:=#4\do{% +\dtl@getentryid\@dtl@entry\@dtl@id +\ifthenelse{\equal{\@dtl@id}{#2}}{% +\dtl@getentryvalue\@dtl@entry#1% +\@endfortrue}{}% +}% +\if@endfor +\else + \@dtl@setnull{#1}{#2}% +\fi +\@endforfalse +\ifx\relax#3% + \let\@dtl@next=\@dtl@assigncmdnoop +\else + \let\@dtl@next=\@dtl@assigncmd +\fi +\@dtl@next#3\@@{#4}% +} +\def\@dtl@assigncmdnoop#1\@@#2{} +\newcommand*{\@dtl@setnull}[2]{% +\@ifundefined{@dtl@idtype@\@dtl@dbname @#2}{% +\global\let#1=\DTLstringnull}{% +\edef\@dtl@tmp{0\@dtl@getidtype{\@dtl@dbname}{#2}}% +\expandafter\ifnum\@dtl@tmp=0\relax + \global\let#1=\DTLstringnull +\else + \global\let#1=\DTLnumbernull +\fi +}} +\newcommand*{\DTLstringnull}{NULL} +\newcommand*{\DTLnumbernull}{0} +\newcommand*{\DTLifnull}[3]{% +\ifx\DTLstringnull#1\relax + #2% +\else + \ifx\DTLnumbernull#1\relax + #2% + \else + #3% + \fi +\fi} +\newcommand{\dtl@gathervalues}[3][key]{% +\expandafter\let\expandafter\@dtl@tmp\expandafter + =\csname dtlkeys@#2\endcsname% +\def\@dtl@list{}% +\@for\dtl@key:=\@dtl@tmp\do{% + \expandafter\@dtl@setnull\expandafter{% + \csname @dtl@#1@\dtl@key\endcsname}{\dtl@key}% + \@for\dtl@thiselement:=#3\do{% + \dtl@getentryid\dtl@thiselement\@dtl@id + \ifthenelse{\equal{\@dtl@id}{\dtl@key}}{% + \dtl@getentryvalue\dtl@thiselement\@dtl@value% + \expandafter\toks@\expandafter{\@dtl@value}% + \expandafter\edef\csname @dtl@#1@\dtl@key\endcsname{% + \the\toks@}% + \@endfortrue}{}% + }% +\@endforfalse +}% +} +\newcommand*{\DTLsumforkeys}[4][\boolean{true}\and +\DTLisnumerical{\DTLthisval}]{% +\def#4{0}% +\@for\@dtl@dbname:=#2\do{% + \DTLifdbexists{\@dtl@dbname}{% + \expandafter + \let\expandafter\@dtl@db\csname dtldb@\@dtl@dbname\endcsname% + \@for\@dtl@currentrow:=\@dtl@db\do{% + \dtl@gathervalues{\@dtl@dbname}{\@dtl@currentrow}% + \@for\@dtl@key:=#3\do{% + \protected@edef\DTLthisval{% + \csname @dtl@key@\@dtl@key\endcsname}% + \ifthenelse{#1}{\DTLadd{#4}{#4}{\DTLthisval}}{}% + }}% + }{\PackageError{datatool}{Database `\@dtl@dbname' doesn't exist}{}% + }% +}% +} +\newcommand*{\DTLmeanforkeys}[4][\boolean{true}\and +\DTLisnumerical{\DTLthisval}]{% +\def#4{0}% +\def\dtl@n{0}% +\@for\@dtl@dbname:=#2\do{% +\DTLifdbexists{\@dtl@dbname}{% + \expandafter + \let\expandafter\@dtl@db\csname dtldb@\@dtl@dbname\endcsname% + \@for\@dtl@currentrow:=\@dtl@db\do{% + \dtl@gathervalues{\@dtl@dbname}{\@dtl@currentrow}% + \@for\@dtl@key:=#3\do{% + \protected@edef\DTLthisval{% + \csname @dtl@key@\@dtl@key\endcsname}% + \ifthenelse{#1}{% + \DTLadd{#4}{#4}{\DTLthisval}% + \DTLadd{\dtl@n}{\dtl@n}{1}% + }{}% + }}% +}{\PackageError{datatool}{Database `\@dtl@dbname' doesn't exist}{}}}% +\ifnum\dtl@n=0\relax + \PackageError{datatool}{Can't compute mean, no data!}{}% +\else + \DTLdiv{#4}{#4}{\dtl@n}% +\fi +} +\newcommand*{\DTLvarianceforkeys}[4][\boolean{true}\and +\DTLisnumerical{\DTLthisval}]{% +\DTLmeanforkeys[#1]{#2}{#3}{\dtl@mean}% +\def#4{0}% +\@for\@dtl@dbname:=#2\do{% + \DTLifdbexists{\@dtl@dbname}{% + \expandafter + \let\expandafter\@dtl@db\csname dtldb@\@dtl@dbname\endcsname + \@for\@dtl@currentrow:=\@dtl@db\do{% + \dtl@gathervalues{\@dtl@dbname}{\@dtl@currentrow}% + \@for\@dtl@key:=#3\do{% + \protected@edef\DTLthisval{% + \csname @dtl@key@\@dtl@key\endcsname}% + \ifthenelse{#1}{% + \DTLsub{\dtl@diff}{\DTLthisval}{\dtl@mean}% + \DTLmul{\dtl@diff}{\dtl@diff}{\dtl@diff}% + \DTLadd{#4}{#4}{\dtl@diff}% + }{}% + }}% + }{\PackageError{datatool}{Database `\@dtl@dbname' doesn't exist}{}% + }% +}% +\ifnum\dtl@n=0\relax + \PackageError{datatool}{Can't compute variance, no data!}{}% +\else + \DTLdiv{#4}{#4}{\dtl@n}% +\fi +} +\newcommand*{\DTLsdforkeys}[4][\boolean{true}\and +\DTLisnumerical{\DTLthisval}]{% +\DTLvarianceforkeys[#1]{#2}{#3}{#4}% +\DTLsqrt{#4}{#4}% +} +\newcommand*{\DTLminforkeys}[4][\boolean{true}\and +\DTLisnumerical{\DTLthisval}]{% +\def#4{}% +\@for\@dtl@dbname:=#2\do{% +\DTLifdbexists{\@dtl@dbname}{% + \expandafter + \let\expandafter\@dtl@db\csname dtldb@\@dtl@dbname\endcsname% + \@for\@dtl@currentrow:=\@dtl@db\do{% + \dtl@gathervalues{\@dtl@dbname}{\@dtl@currentrow}% + \@for\@dtl@key:=#3\do{% + \protected@edef\DTLthisval{% + \csname @dtl@key@\@dtl@key\endcsname}% + \ifthenelse{#1}{% + \ifx#4\@empty + \let#4=\DTLthisval + \else + \DTLmin{#4}{#4}{\DTLthisval}% + \fi + }{}% +}}% + }{\PackageError{datatool}{Database `\@dtl@dbname' doesn't exist}{}% + }% +}} +\newcommand*{\DTLmaxforkeys}[4][\boolean{true}\and +\DTLisnumerical{\DTLthisval}]{% +\def#4{}% +\@for\@dtl@dbname:=#2\do{% +\DTLifdbexists{\@dtl@dbname}{% + \expandafter + \let\expandafter\@dtl@db\csname dtldb@\@dtl@dbname\endcsname% + \@for\@dtl@currentrow:=\@dtl@db\do{% + \dtl@gathervalues{\@dtl@dbname}{\@dtl@currentrow}% + \@for\@dtl@key:=#3\do{% + \protected@edef\DTLthisval{% + \csname @dtl@key@\@dtl@key\endcsname}% + \ifthenelse{#1}{% + \ifx#4\@empty + \let#4=\DTLthisval + \else + \DTLmax{#4}{#4}{\DTLthisval}% + \fi + }{}% +}}% + }{\PackageError{datatool}{Database `\@dtl@dbname' doesn't exist}{}% + }% +}} +\newcommand*{\DTLcomputebounds}[8][\boolean{true}]{% +\let#5=\relax +\let#6=\relax +\let#7=\relax +\let#8=\relax +\@for\dtl@thisdb:=#2\do{% + \@sDTLforeach[#1]{\dtl@thisdb}{\DTLthisX=#3,\DTLthisY=#4}{% + \DTLconverttodecimal{\DTLthisX}{\dtl@decx}% + \DTLconverttodecimal{\DTLthisY}{\dtl@decy}% + \ifx#5\relax + \let#5=\dtl@decx + \let#6=\dtl@decy + \let#7=\dtl@decx + \let#8=\dtl@decy + \else + \FPmin{#5}{#5}{\dtl@decx}% + \FPmin{#6}{#6}{\dtl@decy}% + \FPmax{#7}{#7}{\dtl@decx}% + \FPmax{#8}{#8}{\dtl@decy}% + \fi + }% +}% +} +\newcommand*{\DTLgetvalueforkey}[5]{% +{% +\global\let#1=\DTLstringnull +\@sDTLforeach{#3}{\dtl@valueA=#2,\dtl@refvalue=#4}{% +\DTLifnull{\dtl@refvalue}{}{% +\ifthenelse{\equal{\dtl@refvalue}{#5}}{% +\global\let#1=\dtl@valueA +\@endfortrue +}{}}}% +}} +\newcommand*{\DTLgetrowforkey}[4]{% +{% +\global\let#1=\@empty +\@sDTLforeach{#2}{\dtl@refvalue=#3}{% +\DTLifnull{\dtl@refvalue}{}{% +\ifthenelse{\equal{\dtl@refvalue}{#4}}{% +\expandafter\global\expandafter\let\expandafter#1 + \csname @dtl@thiscurrentrow@\romannumeral\dtlforeachlevel\endcsname +\@endfortrue +}{}}}% +}} +\newcommand*{\DTLsort}{\@ifstar\@sDTLsort\@DTLsort} +\newcommand*{\@DTLsort}[3][]{% +\edef\@dtl@replacementkeys{#1}% +\edef\@dtl@sortorder{#2}% +\edef\@dtl@dbname{#3}% +\let\@dtl@comparecs=\dtlcompare +\expandafter\let\expandafter\@dtl@list\csname dtldb@#3\endcsname +\dtl@sortlist{\@dtl@list}{\@dtl@sortcriteria}% +\expandafter\global\expandafter + \let\csname dtldb@#3\endcsname=\@dtl@list} +\newcommand*{\@sDTLsort}[3][]{% +\edef\@dtl@replacementkeys{#1}% +\edef\@dtl@sortorder{#2}% +\edef\@dtl@dbname{#3}% +\let\@dtl@comparecs=\dtlicompare +\expandafter\let\expandafter\@dtl@list\csname dtldb@#3\endcsname +\dtl@sortlist{\@dtl@list}{\@dtl@sortcriteria}% +\expandafter\global\expandafter + \let\csname dtldb@#3\endcsname=\@dtl@list} +\newcommand{\@dtl@sortcriteria}[2]{% +\@for\@dtl@level:=\@dtl@sortorder\do{% + \expandafter\@dtl@getsortdirection\@dtl@level=\relax% + \@ifundefined{@dtl@idtype@\@dtl@dbname @\@dtl@key}{% + \ifx\@dtl@replacementkeys\@empty + \PackageError{datatool}{Unknown key `\@dtl@key' for database + `\@dtl@dbname'}{}% + \else + \dtl@gathervalues[keya]{\@dtl@dbname}{#1}% + \dtl@gathervalues[keyb]{\@dtl@dbname}{#2}% + \@ifundefined{@dtl@keya@\@dtl@key}{% + \@dtl@setnull{\@dtl@tmpa}{\@dtl@key}% + }{% + \expandafter\let\expandafter\@dtl@tmpa\expandafter + =\csname @dtl@keya@\@dtl@key\endcsname}% + \@ifundefined{@dtl@keyb@\@dtl@key}{% + \@dtl@setnull{\@dtl@tmpb}{\@dtl@key}% + }{% + \expandafter\let\expandafter\@dtl@tmpb\expandafter + =\csname @dtl@keyb@\@dtl@key\endcsname}% + \let\@dtl@keya=\@dtl@key + \let\@dtl@keyb=\@dtl@key + \DTLifnull{\@dtl@tmpa}{% + % find first non null key in list of replacement keys + \@for\@dtl@keya:=\@dtl@replacementkeys\do{% + \@ifundefined{@dtl@keya@\@dtl@keya}{}{% + \expandafter\let\expandafter\@dtl@tmpa\expandafter + =\csname @dtl@keya@\@dtl@keya\endcsname + \DTLifnull{\@dtl@tmpa}{}{\@endfortrue}}% + }% + \if@endfor \else\let\@dtl@keya=\@dtl@key \fi + \@endforfalse + }{}% + \DTLifnull{\@dtl@tmpb}{% + % find first non null key in list of replacement keys + \@for\@dtl@keyb:=\@dtl@replacementkeys\do{% + \@ifundefined{@dtl@keyb@\@dtl@keyb}{}{% + \expandafter\let\expandafter\@dtl@tmpb\expandafter + =\csname @dtl@keyb@\@dtl@keyb\endcsname + \DTLifnull{\@dtl@tmpb}{}{\@endfortrue}}% + }% + \if@endfor \else\let\@dtl@keyb=\@dtl@key \fi + \@endforfalse + }{}% + \@ifundefined{@dtl@idtype@\@dtl@dbname @\@dtl@keya}{% + \@ifundefined{@dtl@idtype@\@dtl@dbname @\@dtl@keyb}{% + \dtl@sortresult=0\relax}{\dtl@sortresult=-1\relax}% + }{% + \@ifundefined{@dtl@idtype@\@dtl@dbname @\@dtl@keyb}{% + \dtl@sortresult=1\relax}{% + \dtl@compare@{\@dtl@keya}{\@dtl@keyb}{#1}{#2}% + }% + }% + \fi + }{% + \ifx\@dtl@replacementkeys\@empty + \dtl@compare{\@dtl@key}{#1}{#2}% + \else + \dtl@gathervalues[keya]{\@dtl@dbname}{#1}% + \dtl@gathervalues[keyb]{\@dtl@dbname}{#2}% + \@ifundefined{@dtl@keya@\@dtl@key}{% + \@dtl@setnull{\@dtl@tmpa}{\@dtl@key}% + }{% + \expandafter\let\expandafter\@dtl@tmpa\expandafter + =\csname @dtl@keya@\@dtl@key\endcsname}% + \@ifundefined{@dtl@keyb@\@dtl@key}{% + \@dtl@setnull{\@dtl@tmpb}{\@dtl@key}% + }{% + \expandafter\let\expandafter\@dtl@tmpb\expandafter + =\csname @dtl@keyb@\@dtl@key\endcsname}% + \let\@dtl@keya=\@dtl@key + \let\@dtl@keyb=\@dtl@key + \DTLifnull{\@dtl@tmpa}{% + % find first non null key in list of replacement keys + \@for\@dtl@keya:=\@dtl@replacementkeys\do{% + \@ifundefined{@dtl@keya@\@dtl@keya}{}{% + \expandafter\let\expandafter\@dtl@tmpa\expandafter + =\csname @dtl@keya@\@dtl@keya\endcsname + \DTLifnull{\@dtl@tmpa}{}{\@endfortrue}}% + }% + \if@endfor \else\let\@dtl@keya=\@dtl@key \fi + \@endforfalse + }{}% + \DTLifnull{\@dtl@tmpb}{% + % find first non null key in list of replacement keys + \@for\@dtl@keyb:=\@dtl@replacementkeys\do{% + \@ifundefined{@dtl@keyb@\@dtl@keyb}{}{% + \expandafter\let\expandafter\@dtl@tmpb\expandafter + =\csname @dtl@keyb@\@dtl@keyb\endcsname + \DTLifnull{\@dtl@tmpb}{}{\@endfortrue}}% + }% + \if@endfor \else\let\@dtl@keyb=\@dtl@key \fi + \@endforfalse + }{}% + \dtl@compare@{\@dtl@keya}{\@dtl@keyb}{#1}{#2}% + \fi + \multiply\dtl@sortresult by \@dtl@sortdirection\relax + \ifnum\dtl@sortresult=0\relax + \else + \@endfortrue + \fi + }% +}% +} +\def\@dtl@getsortdirection#1=#2\relax{% +\def\@dtl@key{#1}% +\def\@dtl@sortdirection{#2}% +\ifx\@dtl@sortdirection\@empty + \def\@dtl@sortdirection{-1}% +\else + \@dtl@get@sortdirection#2% + \ifthenelse{\equal{\@dtl@sortdirection}{ascending}}{% + \def\@dtl@sortdirection{-1}}{% + \ifthenelse{\equal{\@dtl@sortdirection}{descending}}{% + \def\@dtl@sortdirection{1}}{% + \PackageError{datatool}{Invalid sort direction + `\@dtl@sortdirection'}{% + The sort direction can only be one of `ascending' or + `descending'}\def\@dtl@sortdirection{-1}}}% +\fi +} +\def\@dtl@get@sortdirection#1={\def\@dtl@sortdirection{#1}} +\newtoks\@dtl@toksA\newtoks\@dtl@toksB +\newcommand{\dtl@compare}[3]{% +\dtl@gathervalues{\@dtl@dbname}{#2}% +\expandafter\let\expandafter\@dtl@tmp\expandafter + =\csname @dtl@key@#1\endcsname +\expandafter\@dtl@toksA\expandafter{\@dtl@tmp}% +\edef\@dtl@a{\the\@dtl@toksA}% +\dtl@gathervalues{\@dtl@dbname}{#3}% +\expandafter\let\expandafter\@dtl@tmp\expandafter + =\csname @dtl@key@#1\endcsname +\expandafter\@dtl@toksB\expandafter{\@dtl@tmp}% +\edef\@dtl@b{\the\@dtl@toksB}% +\expandafter\@dtl@datatype\expandafter= + \csname @dtl@idtype@\@dtl@dbname @#1\endcsname\relax +\ifnum\@dtl@datatype=0\relax + \edef\@dtl@tmpcmp{% + \noexpand\@dtl@comparecs{\noexpand\dtl@sortresult}% + {\the\@dtl@toksA}{\the\@dtl@toksB}}% + \@dtl@tmpcmp +\else + \DTLifnumlt{\@dtl@a}{\@dtl@b}{\dtl@sortresult=-1\relax}{% + \DTLifnumgt{\@dtl@a}{\@dtl@b}{\dtl@sortresult=1\relax}{% + \dtl@sortresult=0\relax}}% +\fi +\ifdtlverbose +\@onelevel@sanitize\@dtl@a +\@onelevel@sanitize\@dtl@b +\fi +\dtl@message{`\@dtl@a' <=> `\@dtl@b' = \number\dtl@sortresult}% +} +\newcommand{\dtl@compare@}[4]{% +\dtl@gathervalues{\@dtl@dbname}{#3}% +\expandafter\let\expandafter\@dtl@tmp\expandafter + =\csname @dtl@key@#1\endcsname +\expandafter\@dtl@toksA\expandafter{\@dtl@tmp}% +\edef\@dtl@a{\the\@dtl@toksA}% +\dtl@gathervalues{\@dtl@dbname}{#4}% +\expandafter\let\expandafter\@dtl@tmp\expandafter + =\csname @dtl@key@#2\endcsname +\expandafter\@dtl@toksB\expandafter{\@dtl@tmp}% +\edef\@dtl@b{\the\@dtl@toksB}% +\expandafter\@dtl@tmpcount\expandafter= + \csname @dtl@idtype@\@dtl@dbname @#1\endcsname\relax +\expandafter\@dtl@datatype\expandafter= + \csname @dtl@idtype@\@dtl@dbname @#2\endcsname\relax +\multiply\@dtl@datatype by \@dtl@tmpcount\relax +\ifnum\@dtl@datatype=0\relax + \edef\@dtl@tmpcmp{% + \noexpand\@dtl@comparecs{\noexpand\dtl@sortresult}% + {\the\@dtl@toksA}{\the\@dtl@toksB}}% + \@dtl@tmpcmp +\else + \DTLifnumlt{\@dtl@a}{\@dtl@b}{\dtl@sortresult=-1\relax}{% + \DTLifnumgt{\@dtl@a}{\@dtl@b}{\dtl@sortresult=1\relax}{% + \dtl@sortresult=0\relax}}% +\fi +\ifdtlverbose +\@onelevel@sanitize\@dtl@a +\@onelevel@sanitize\@dtl@b +\fi +\dtl@message{`\@dtl@a' <=> `\@dtl@b' = \number\dtl@sortresult}% +} +\newcommand*{\dtl@choplast}[3]{% +\let#2\@empty +\let#3\@empty +\@for\@dtl@element:=#1\do{% +\ifx#3\@empty +\else + \ifx#2\@empty + \expandafter\toks@\expandafter{#3}% + \edef#2{{\the\toks@}}% + \else + \expandafter\toks@\expandafter{#3}% + \expandafter\@dtl@toks\expandafter{#2}% + \edef#2{\the\@dtl@toks,{\the\toks@}}% + \fi +\fi +\let#3=\@dtl@element% +}% +} +\newcommand*{\dtl@chopfirst}[3]{% +\let#2=\@empty +\let#3=\@empty +\@for\@dtl@element:=#1\do{% + \let#2=\@dtl@element + \@endfortrue +}% +\if@endfor + \let#3=\@forremainder +\fi +\@endforfalse +} +\newcommand{\dtl@sortlist}[2]{% +\def\@dtl@sortedlist{}% +\@for\@dtl@currentrow:=#1\do{% +\expandafter\dtl@insertinto\expandafter + {\@dtl@currentrow}{\@dtl@sortedlist}{#2}% +\@endforfalse}% +\let#1=\@dtl@sortedlist +} +\newtoks\@dtl@toks +\newcommand{\dtl@insertinto}[3]{% +\def\@dtl@newsortedlist{}% +\@dtl@insertdonefalse +\@for\dtl@srtelement:=#2\do{% +\if@dtl@insertdone + \expandafter\toks@\expandafter{\dtl@srtelement}% + \edef\@dtl@newstuff{{\the\toks@}}% +\else + \expandafter#3\expandafter{\dtl@srtelement}{#1}% + \ifnum\dtl@sortresult<0\relax + \expandafter\toks@\expandafter{\dtl@srtelement}% + \@dtl@toks{#1}% + \edef\@dtl@newstuff{{\the\@dtl@toks},{\the\toks@}}% + \@dtl@insertdonetrue + \else + \expandafter\toks@\expandafter{\dtl@srtelement}% + \edef\@dtl@newstuff{{\the\toks@}}% + \fi +\fi +\ifx\@dtl@newsortedlist\@empty + \expandafter\toks@\expandafter{\@dtl@newstuff}% + \edef\@dtl@newsortedlist{\the\toks@}% +\else + \expandafter\toks@\expandafter{\@dtl@newsortedlist}% + \expandafter\@dtl@toks\expandafter{\@dtl@newstuff}% + \edef\@dtl@newsortedlist{\the\toks@,\the\@dtl@toks}% +\fi +\@endforfalse +}% + \ifx\@dtl@newsortedlist\@empty + \@dtl@toks{#1}% + \edef\@dtl@newsortedlist{{\the\@dtl@toks}}% + \else + \if@dtl@insertdone + \else + \expandafter\toks@\expandafter{\@dtl@newsortedlist}% + \@dtl@toks{#1}% + \edef\@dtl@newsortedlist{\the\toks@,{\the\@dtl@toks}}% + \fi + \fi +\global\let#2=\@dtl@newsortedlist +} +\newif\if@dtl@insertdone +\newcount\dtl@sortresult +\newcommand*{\DTLadd}[3]{% +\DTLconverttodecimal{#2}{\@dtl@numi}% +\DTLconverttodecimal{#3}{\@dtl@numii}% +\FPadd{\@dtl@tmp}{\@dtl@numi}{\@dtl@numii}% +\ifx\@dtl@replaced\@empty + \DTLdecimaltolocale{\@dtl@tmp}{#1}% +\else + \DTLdecimaltocurrency{\@dtl@tmp}{#1}% +\fi +} +\newcommand*{\DTLgadd}[3]{% +\DTLadd{\@dtl@tmpii}{#2}{#3}% +\global\let#1=\@dtl@tmpii +} +\newcommand*{\DTLaddall}[2]{% +\def\@dtl@sum{0}% +\@for\dtl@thisval:=#2\do{% + \DTLconverttodecimal{\dtl@thisval}{\@dtl@num}% + \FPadd{\@dtl@sum}{\@dtl@sum}{\@dtl@num}% +}% +\ifx\@dtl@replaced\@empty + \DTLdecimaltolocale{\@dtl@sum}{#1}% +\else + \DTLdecimaltocurrency{\@dtl@sum}{#1}% +\fi +} +\newcommand*{\DTLgaddall}[2]{% +\DTLaddall{\@dtl@tmpi}{#2}% +\global\let#1=\@dtl@tmpi +} +\newcommand*{\DTLsub}[3]{% +\DTLconverttodecimal{#2}{\@dtl@numi}% +\DTLconverttodecimal{#3}{\@dtl@numii}% +\FPsub{\@dtl@tmp}{\@dtl@numi}{\@dtl@numii}% +\ifx\@dtl@replaced\@empty + \DTLdecimaltolocale{\@dtl@tmp}{#1}% +\else + \DTLdecimaltocurrency{\@dtl@tmp}{#1}% +\fi +} +\newcommand*{\DTLgsub}[3]{% +\DTLsub{\@dtl@tmpii}{#2}{#3}% +\global\let#1=\@dtl@tmpii +} +\newcommand*{\DTLmul}[3]{% +\let\@dtl@thisreplaced=\@empty +\DTLconverttodecimal{#2}{\@dtl@numi}% +\ifx\@dtl@replaced\@empty +\else + \let\@dtl@thisreplaced=\@dtl@replaced +\fi +\DTLconverttodecimal{#3}{\@dtl@numii}% +\ifx\@dtl@replaced\@empty +\else + \let\@dtl@thisreplaced=\@dtl@replaced +\fi +\FPmul{\@dtl@tmp}{\@dtl@numi}{\@dtl@numii}% +\ifx\@dtl@thisreplaced\@empty + \DTLdecimaltolocale{\@dtl@tmp}{#1}% +\else + \DTLdecimaltocurrency{\@dtl@tmp}{#1}% +\fi +} +\newcommand*{\DTLgmul}[3]{% +\DTLmul{\@dtl@tmpii}{#2}{#3}% +\global\let#1=\@dtl@tmpii +} +\newcommand*{\DTLdiv}[3]{% +\let\@dtl@thisreplaced=\@empty +\DTLconverttodecimal{#2}{\@dtl@numi}% +\ifx\@dtl@replaced\@empty +\else + \let\@dtl@thisreplaced=\@dtl@replaced +\fi +\DTLconverttodecimal{#3}{\@dtl@numii}% +\FPdiv{\@dtl@tmp}{\@dtl@numi}{\@dtl@numii}% +\ifx\@dtl@thisreplaced\@empty + \DTLdecimaltolocale{\@dtl@tmp}{#1}% +\else + \ifx\@dtl@thisreplaced\@dtl@replaced + \DTLdecimaltolocale{\@dtl@tmp}{#1}% + \else + \DTLdecimaltocurrency{\@dtl@tmp}{#1}% + \fi +\fi +} +\newcommand*{\DTLgdiv}[3]{% +\DTLdiv{\@dtl@tmpii}{#2}{#3}% +\global\let#1=\@dtl@tmpii +} +\newcommand*{\DTLabs}[2]{% +\DTLconverttodecimal{#2}{\@dtl@numi}% +\FPabs{\@dtl@tmp}{\@dtl@numi}% +\ifx\@dtl@replaced\@empty + \DTLdecimaltolocale{\@dtl@tmp}{#1}% +\else + \DTLdecimaltocurrency{\@dtl@tmp}{#1}% +\fi +} +\newcommand*{\DTLgabs}[2]{% +\DTLabs{\@dtl@tmpii}{#2}% +\global\let#1=\@dtl@tmpii +} +\newcommand*{\DTLneg}[2]{% +\DTLconverttodecimal{#2}{\@dtl@numi}% +\FPneg{\@dtl@tmp}{\@dtl@numi}% +\ifx\@dtl@replaced\@empty + \DTLdecimaltolocale{\@dtl@tmp}{#1}% +\else + \DTLdecimaltocurrency{\@dtl@tmp}{#1}% +\fi +} +\newcommand*{\DTLgneg}[2]{% +\DTLneg{\@dtl@tmpii}{#2}% +\global\let#1=\@dtl@tmpii +} +\newcommand*{\DTLsqrt}[2]{% +\DTLconverttodecimal{#2}{\@dtl@numi}% +\FProot{\@dtl@tmpi}{\@dtl@numi}{2}% +\ifx\@dtl@replaced\@empty + \DTLdecimaltolocale{\@dtl@tmpi}{#1}% +\else + \DTLdecimaltocurrency{\@dtl@tmpi}{#1}% +\fi +} +\newcommand*{\DTLgsqrt}[2]{% +\DTLsqrt{\@dtl@tmpii}{#2}% +\global\let#1=\@dtl@tmpii +} +\newcommand*{\DTLmin}[3]{% +\DTLconverttodecimal{#2}{\@dtl@numi}% +\DTLconverttodecimal{#3}{\@dtl@numii}% +\FPiflt{\@dtl@numi}{\@dtl@numii}% + \dtl@ifsingle{#2}{% + \let#1=#2}{% + \def#1{#2}}% +\else + \dtl@ifsingle{#3}{% + \let#1=#3}{% + \def#1{#3}}% +\fi +} +\newcommand*{\DTLgmin}[3]{% +\DTLmin{\@dtl@tmpii}{#2}{#3}% +\global\let#1=\@dtl@tmpii +} +\newcommand*{\DTLminall}[2]{% +\let\@dtl@min=\@empty +\@for\dtl@thisval:=#2\do{% + \DTLconverttodecimal{\dtl@thisval}{\@dtl@num}% + \ifx\@dtl@min\@empty + \let\@dtl@min=\@dtl@num + \else + \FPmin{\@dtl@min}{\@dtl@min}{\@dtl@num}% + \fi +}% +\ifx\@dtl@replaced\@empty + \DTLdecimaltolocale{\@dtl@min}{#1}% +\else + \DTLdecimaltocurrency{\@dtl@min}{#1}% +\fi +} +\newcommand*{\DTLgminall}[2]{% +\DTLminall{\@dtl@tmpi}{#2}% +\global\let#1=\@dtl@tmpi +} +\newcommand*{\DTLmax}[3]{% +\DTLconverttodecimal{#2}{\@dtl@numi}% +\DTLconverttodecimal{#3}{\@dtl@numii}% +\FPmax{\@dtl@tmp}{\@dtl@numi}{\@dtl@numii}% +\FPifgt{\@dtl@numi}{\@dtl@numii}% + \dtl@ifsingle{#2}{% + \let#1=#2}{% + \def#1{#2}}% +\else + \dtl@ifsingle{#3}{% + \let#1=#3}{% + \def#1{#3}}% +\fi +} +\newcommand*{\DTLgmax}[3]{% +\DTLmax{\@dtl@tmpii}{#2}{#3}% +\global\let#1=\@dtl@tmpii +} +\newcommand*{\DTLmaxall}[2]{% +\let\@dtl@max=\@empty +\@for\dtl@thisval:=#2\do{% + \DTLconverttodecimal{\dtl@thisval}{\@dtl@num}% + \ifx\@dtl@max\@empty + \let\@dtl@max\@dtl@num + \else + \FPmax{\@dtl@max}{\@dtl@max}{\@dtl@num}% + \fi +}% +\ifx\@dtl@replaced\@empty + \DTLdecimaltolocale{\@dtl@max}{#1}% +\else + \DTLdecimaltocurrency{\@dtl@max}{#1}% +\fi +} +\newcommand*{\DTLgmaxall}[2]{% +\DTLmaxall{\@dtl@tmpi}{#2}% +\global\let#1=\@dtl@tmpi +} +\newcommand*{\DTLmeanforall}[2]{% +\def\@dtl@mean{0}% +\def\@dtl@n{0}% +\@for\dtl@thisval:=#2\do{% + \DTLconverttodecimal{\dtl@thisval}{\@dtl@num}% + \FPadd{\@dtl@mean}{\@dtl@mean}{\@dtl@num}% + \FPadd{\@dtl@n}{\@dtl@n}{1}% +}% +\FPdiv{\@dtl@mean}{\@dtl@mean}{\@dtl@n}% +\ifx\@dtl@replaced\@empty + \DTLdecimaltolocale{\@dtl@mean}{#1}% +\else + \DTLdecimaltocurrency{\@dtl@mean}{#1}% +\fi +} +\newcommand*{\DTLgmeanforall}[2]{% +\DTLmeanforall{\@dtl@tmpi}{#2}% +\global\let#1=\@dtl@tmpi +} +\newcommand*{\DTLvarianceforall}[2]{% +\def\@dtl@mean{0}% +\def\@dtl@n{0}% +\let\@dtl@decvals=\@empty +\@for\dtl@thisval:=#2\do{% + \DTLconverttodecimal{\dtl@thisval}{\@dtl@num}% + \ifx\@dtl@decvals\@empty + \let\@dtl@decvals=\@dtl@num + \else + \expandafter\toks@\expandafter{\@dtl@decvals}% + \edef\@dtl@decvals{\the\toks@,\@dtl@num}% + \fi + \FPadd{\@dtl@mean}{\@dtl@mean}{\@dtl@num}% + \FPadd{\@dtl@n}{\@dtl@n}{1}% +}% +\FPdiv{\@dtl@mean}{\@dtl@mean}{\@dtl@n}% +\def\@dtl@var{0}% +\@for\@dtl@num:=\@dtl@decvals\do{% + \FPsub{\@dtl@diff}{\@dtl@num}{\@dtl@mean}% + \FPmul{\@dtl@diff}{\@dtl@diff}{\@dtl@diff}% + \FPadd{\@dtl@var}{\@dtl@var}{\@dtl@diff}% +}% +\FPdiv{\@dtl@var}{\@dtl@var}{\@dtl@n}% +\ifx\@dtl@replaced\@empty + \DTLdecimaltolocale{\@dtl@var}{#1}% +\else + \DTLdecimaltocurrency{\@dtl@var}{#1}% +\fi +} +\newcommand*{\DTLgvarianceforall}[2]{% +\DTLvarianceforall{\@dtl@tmpi}{#2}% +\global\let#1=\@dtl@tmpi +} +\newcommand*{\DTLsdforall}[2]{% +\def\@dtl@mean{0}% +\def\@dtl@n{0}% +\let\@dtl@decvals=\@empty +\@for\dtl@thisval:=#2\do{% + \DTLconverttodecimal{\dtl@thisval}{\@dtl@num}% + \ifx\@dtl@decvals\@empty + \let\@dtl@decvals=\@dtl@num + \else + \expandafter\toks@\expandafter{\@dtl@decvals}% + \edef\@dtl@decvals{\the\toks@,\@dtl@num}% + \fi + \FPadd{\@dtl@mean}{\@dtl@mean}{\@dtl@num}% + \FPadd{\@dtl@n}{\@dtl@n}{1}% +}% +\FPdiv{\@dtl@mean}{\@dtl@mean}{\@dtl@n}% +\def\@dtl@sd{0}% +\@for\@dtl@num:=\@dtl@decvals\do{% + \FPsub{\@dtl@diff}{\@dtl@num}{\@dtl@mean}% + \FPmul{\@dtl@diff}{\@dtl@diff}{\@dtl@diff}% + \FPadd{\@dtl@sd}{\@dtl@sd}{\@dtl@diff}% +}% +\FPdiv{\@dtl@sd}{\@dtl@sd}{\@dtl@n}% +\FProot{\@dtl@sd}{\@dtl@sd}{2}% +\ifx\@dtl@replaced\@empty + \DTLdecimaltolocale{\@dtl@sd}{#1}% +\else + \DTLdecimaltocurrency{\@dtl@sd}{#1}% +\fi +} +\newcommand*{\DTLgsdforall}[2]{% +\DTLsdforall{\@dtl@tmpi}{#2}% +\global\let#1=\@dtl@tmpi +} +\newcommand*{\DTLround}[3]{% +\DTLconverttodecimal{#2}{\@dtl@numi}% +\FPround{\@dtl@tmp}{\@dtl@numi}{#3}% +\ifx\@dtl@replaced\@empty + \DTLdecimaltolocale{\@dtl@tmp}{#1}% +\else + \DTLdecimaltocurrency{\@dtl@tmp}{#1}% +\fi +} +\newcommand*{\DTLground}[3]{% +\DTLround{\@dtl@tmpii}{#2}{#3}% +\global\let#1=\@dtl@tmpii +} +\newcommand*{\DTLtrunc}[3]{% +\DTLconverttodecimal{#2}{\@dtl@numi}% +\FPtrunc{\@dtl@tmp}{\@dtl@numi}{#3}% +\ifx\@dtl@replaced\@empty + \DTLdecimaltolocale{\@dtl@tmp}{#1}% +\else + \DTLdecimaltocurrency{\@dtl@tmp}{#1}% +\fi +} +\newcommand*{\DTLgtrunc}[3]{% +\DTLtrunc{\@dtl@tmpii}{#2}{#3}% +\global\let#1=\@dtl@tmpii +} +\newcommand*{\DTLclip}[2]{% +\DTLconverttodecimal{#2}{\@dtl@numi}% +\FPclip{\@dtl@tmp}{\@dtl@numi}% +\ifx\@dtl@replaced\@empty + \DTLdecimaltolocale{\@dtl@tmp}{#1}% +\else + \DTLdecimaltocurrency{\@dtl@tmp}{#1}% +\fi +} +\newcommand*{\DTLgclip}[3]{% +\DTLclip{\@dtl@tmpii}{#2}% +\global\let#1=\@dtl@tmpii +} +\newcommand*\DTLinitials[1]{% +\def\dtl@initialscmd{}% +\dtl@subnobrsp{#1}{\dtl@string}% +\DTLsubstituteall{\dtl@string}{~}{ }% +\DTLsubstituteall{\dtl@string}{\ }{ }% +\DTLsubstituteall{\dtl@string}{\space}{ }% +\expandafter\dtl@initials\dtl@string{} \@nil% +\dtl@initialscmd}% +\edef\dtl@construct@subnobrsp{% +\noexpand\def\noexpand\@dtl@subnobrsp##1\noexpand\protect +\expandafter\noexpand\csname nobreakspace \endcsname ##2{% +\noexpand\toks@{##1}% +\noexpand\expandafter\noexpand\@dtl@toks\noexpand\expandafter{% +\noexpand\@dtl@string}% +\noexpand\edef\noexpand\@dtl@string{\noexpand\the\noexpand\@dtl@toks +\noexpand\the\noexpand\toks@}% +\noexpand\def\noexpand\@dtl@tmp{##2}% +\noexpand\ifx\noexpand\@dtl@tmp\noexpand\@nnil + \noexpand\let\noexpand\@dtl@subnobrspnext=\noexpand\relax +\noexpand\else + \noexpand\toks@{ }% + \noexpand\expandafter\noexpand\@dtl@toks\noexpand\expandafter{% + \noexpand\@dtl@string}% + \noexpand\edef\noexpand\@dtl@string{\noexpand\the\noexpand\@dtl@toks + \noexpand\the\noexpand\toks@}% + \noexpand\let\noexpand\@dtl@subnobrspnext=\noexpand\@dtl@subnobrsp +\noexpand\fi +\noexpand\@dtl@subnobrspnext +}% +\noexpand\def\noexpand\dtl@subnobrsp##1##2{% +\noexpand\def\noexpand\@dtl@string{}% +\noexpand\@dtl@subnobrsp ##1\noexpand\protect\expandafter\noexpand +\csname nobreakspace \endcsname \noexpand\@nil +\noexpand\let##2=\noexpand\@dtl@string +}} +\dtl@construct@subnobrsp +\newcommand*{\DTLstoreinitials}[2]{% +\def\dtl@initialscmd{}% +\dtl@subnobrsp{#1}{\dtl@string}% +\DTLsubstituteall{\dtl@string}{~}{ }% +\DTLsubstituteall{\dtl@string}{\ }{ }% +\DTLsubstituteall{\dtl@string}{\space}{ }% +\expandafter\dtl@initials\dtl@string{} \@nil +\let#2=\dtl@initialscmd +} +\def\dtl@initials#1#2 #3{% +\dtl@ifsingle{#1}{% +\ifcat\noexpand#1\relax\relax + \def\@dtl@donextinitials{\@dtl@initials#2 {#3}}% +\else + \def\@dtl@donextinitials{\@dtl@initials#1#2 {#3}}% +\fi +}{% + \def\@dtl@donextinitials{\@dtl@initials{#1}#2 {#3}}% +}% +\@dtl@donextinitials +} +\def\@dtl@initials#1#2 #3{% +\dtl@initialshyphen#2-{}\dtl@endhyp +\expandafter\@dtl@toks\expandafter{\dtl@initialscmd}% +\toks@{#1}% +\ifx\dtl@inithyphen\@empty +\else + \edef\dtl@initialscmd{\the\@dtl@toks\the\toks@}% + \expandafter\@dtl@toks\expandafter{\dtl@initialscmd}% + \expandafter\toks@\expandafter{\dtl@inithyphen}% +\fi +\def\dtl@tmp{#3}% +\ifx\@nnil\dtl@tmp + \edef\dtl@initialscmd{\the\@dtl@toks\the\toks@\DTLafterinitials}% + \let\dtl@initialsnext=\@gobble +\else + \edef\dtl@initialscmd{\the\@dtl@toks\the\toks@\DTLbetweeninitials}% + \let\dtl@initialsnext=\dtl@initials +\fi +\dtl@initialsnext{#3}} +\def\dtl@initialshyphen#1-#2#3\dtl@endhyp{% +\def\dtl@inithyphen{#2}% +\ifx\dtl@inithyphen\@empty +\else + \edef\dtl@inithyphen{% + \DTLafterinitialbeforehyphen\DTLinitialhyphen#2}% +\fi +} +\newcommand*{\DTLafterinitials}{.} +\newcommand*{\DTLbetweeninitials}{.} +\newcommand*{\DTLafterinitialbeforehyphen}{.} +\newcommand*{\DTLinitialhyphen}{-} +\newcommand*{\DTLifAllUpperCase}[3]{% +\protected@edef\dtl@tuc{#1}% +\expandafter\dtl@testifuppercase\dtl@tuc\@nil\relax +\if@dtl@condition#2\else#3\fi +} +\def\dtl@testifuppercase#1#2{% +\def\dtl@argi{#1}% +\def\dtl@argii{#2}% +\def\dtl@tc@rest{}% +\ifx\dtl@argi\@nnil + \let\dtl@testifuppernext=\@nnil +\else + \ifx#1\protect + \let\dtl@testifuppernext=\dtl@testifuppercase + \else + \ifx\uppercase#1\relax + \@dtl@conditiontrue + \def\dtl@tc@rest{}% + \let\dtl@testifuppernext=\relax + \else + \edef\dtl@tc@arg{\string#1}% + \expandafter\dtl@test@ifuppercase\dtl@tc@arg\end + \ifx\dtl@argii\@nnil + \let\dtl@testifuppernext=\@dtl@gobbletonil + \fi + \fi + \fi +\fi +\ifx\dtl@testifuppernext\relax + \edef\dtl@dotestifuppernext{% + \noexpand\dtl@testifuppercase}% +\else + \ifx\dtl@testifuppernext\@nnil + \edef\dtl@dotestifuppernext{#2}% + \else + \expandafter\toks@\expandafter{\dtl@tc@rest}% + \@dtl@toks{#2}% + \edef\dtl@dotestifuppernext{% + \noexpand\dtl@testifuppernext\the\toks@\the\@dtl@toks}% + \fi +\fi +\dtl@dotestifuppernext +} +\def\dtl@test@ifuppercase#1#2\end{% +\def\dtl@tc@rest{#2}% +\IfSubStringInString{\string\MakeUppercase}{#1#2}{% + \@dtl@conditiontrue + \def\dtl@tc@rest{}% + \let\dtl@testifuppernext=\relax +}{% + \IfSubStringInString{\string\MakeTextUppercase}{#1#2}{% + \@dtl@conditiontrue + \def\dtl@tc@rest{}% + \let\dtl@testifuppernext=\relax + }{% + \edef\dtl@uccode{\the\uccode`#1}% + \edef\dtl@code{\number`#1}% + \ifnum\dtl@code=\dtl@uccode\relax + \@dtl@conditiontrue + \let\dtl@testifuppernext=\dtl@testifuppercase + \else + \ifnum\dtl@uccode=0\relax + \@dtl@conditiontrue + \let\dtl@testifuppernext=\dtl@testifuppercase + \else + \@dtl@conditionfalse + \let\dtl@testifuppernext=\@dtl@gobbletonil + \fi + \fi +}}} +\newcommand*{\DTLifAllLowerCase}[3]{% +\protected@edef\dtl@tlc{#1}% +\expandafter\dtl@testiflowercase\dtl@tlc\@nil\relax +\if@dtl@condition#2\else#3\fi +} +\def\dtl@testiflowercase#1#2{% +\def\dtl@argi{#1}% +\def\dtl@argii{#2}% +\ifx\dtl@argi\@nnil + \let\dtl@testiflowernext=\@nnil +\else + \ifx#1\protect + \let\dtl@testiflowernext=\dtl@testiflowercase + \else + \ifx\lowercase#1\relax + \@dtl@conditiontrue + \def\dtl@tc@rest{}% + \let\dtl@testiflowernext=\relax + \else + \edef\dtl@tc@arg{\string#1}% + \expandafter\dtl@test@iflowercase\dtl@tc@arg\end + \ifx\dtl@argii\@nnil + \let\dtl@testiflowernext=\@dtl@gobbletonil + \fi + \fi + \fi +\fi +\ifx\dtl@testiflowernext\relax + \edef\dtl@dotestiflowernext{% + \noexpand\dtl@testiflowercase}% +\else + \ifx\dtl@testiflowernext\@nnil + \edef\dtl@dotestiflowernext{#2}% + \else + \expandafter\toks@\expandafter{\dtl@tc@rest}% + \@dtl@toks{#2}% + \edef\dtl@dotestiflowernext{% + \noexpand\dtl@testiflowernext\the\toks@\the\@dtl@toks}% + \fi +\fi +\dtl@dotestiflowernext +} +\def\dtl@test@iflowercase#1#2\end{% +\def\dtl@tc@rest{#2}% +\IfSubStringInString{\string\MakeLowercase}{#1#2}{% + \@dtl@conditiontrue + \def\dtl@tc@rest{}% + \let\dtl@testiflowernext=\relax +}{% + \IfSubStringInString{\string\MakeTextLowercase}{#1#2}{% + \@dtl@conditiontrue + \def\dtl@tc@rest{}% + \let\dtl@testiflowernext=\relax + }{% + \edef\dtl@lccode{\the\lccode`#1}% + \edef\dtl@code{\number`#1}% + \ifnum\dtl@code=\dtl@lccode\relax + \@dtl@conditiontrue + \let\dtl@testiflowernext=\dtl@testiflowercase + \else + \ifnum\dtl@lccode=0\relax + \@dtl@conditiontrue + \let\dtl@testiflowernext=\dtl@testiflowercase + \else + \@dtl@conditionfalse + \let\dtl@testiflowernext=\@dtl@gobbletonil + \fi + \fi +}}} +\newwrite\@dtl@write +\newcommand*{\DTLsavedb}[2]{% +\DTLifdbexists{#1}{% +\openout\@dtl@write=#2% +\edef\@dtl@keys{\csname dtlkeys@#1\endcsname}% +\def\@dtl@header{}% +\@for\@dtl@key:=\@dtl@keys\do{% +\expandafter\@dtl@toks\expandafter{\@dtl@header}% +\ifx\@dtl@header\@empty + \IfSubStringInString{\@dtl@separator}{\@dtl@key}{% + \protected@edef\@dtl@header{% + \@dtl@delimiter\@dtl@key\@dtl@delimiter}% + }{% + \protected@edef\@dtl@header{\@dtl@key}% + }% +\else + \IfSubStringInString{\@dtl@separator}{\@dtl@key}{% + \protected@edef\@dtl@header{\the\@dtl@toks\@dtl@separator + \@dtl@delimiter\@dtl@key\@dtl@delimiter}% + }{% + \protected@edef\@dtl@header{\the\@dtl@toks\@dtl@separator + \@dtl@key}% + }% +\fi +}% +\protected@write\@dtl@write{}{\@dtl@header}% +\expandafter\let\expandafter\@dtl@db\csname dtldb@#1\endcsname% +\@for\@dtl@currentrow:=\@dtl@db\do{% +\dtl@gathervalues{#1}{\@dtl@currentrow}% +\def\@dtl@outputrow{}% +\@for\@dtl@key:=\@dtl@keys\do{% +\protected@edef\@dtl@element{\csname @dtl@key@\@dtl@key\endcsname}% +\expandafter\@dtl@toks\expandafter{\@dtl@outputrow}% +\ifx\@dtl@outputrow\@empty + \IfSubStringInString{\@dtl@separator}{\@dtl@element}{% + \protected@edef\@dtl@outputrow{% + \@dtl@delimiter\@dtl@element\@dtl@delimiter}% + }{% + \protected@edef\@dtl@outputrow{\@dtl@element}% + }% +\else + \IfSubStringInString{\@dtl@separator}{\@dtl@element}{% + \protected@edef\@dtl@outputrow{\the\@dtl@toks\@dtl@separator + \@dtl@delimiter\@dtl@element\@dtl@delimiter}% + }{% + \protected@edef\@dtl@outputrow{\the\@dtl@toks\@dtl@separator + \@dtl@element}% + }% +\fi +}% +\protected@write\@dtl@write{}{\@dtl@outputrow}% +}% +\closeout\@dtl@write +}{% +\PackageError{datatool}{Database `#1' doesn't exist}{}% +}} +\newcommand*{\DTLsavetexdb}[2]{% +\DTLifdbexists{#1}{% +\def\@dtl@dbname{#1}% +\openout\@dtl@write=#2% +\edef\@dtl@keys{\csname dtlkeys@#1\endcsname}% +\protected@write\@dtl@write{}{\string\DTLnewdb{#1}}% +\expandafter\let\expandafter\@dtl@db\csname dtldb@#1\endcsname% +\@for\@dtl@currentrow:=\@dtl@db\do{% +\dtl@gathervalues{#1}{\@dtl@currentrow}% +\protected@write\@dtl@write{}{\string\DTLnewrow{#1}}% +\@for\@dtl@key:=\@dtl@keys\do{% +\expandafter\DTLifnull\csname @dtl@key@\@dtl@key\endcsname +{}{% +\protected@edef\@dtl@element{\csname @dtl@key@\@dtl@key\endcsname}% +\protected@write\@dtl@write{}{\string\DTLnewdbentry + {#1}{\@dtl@key}{\@dtl@element}}% +}% +}% +}% +\closeout\@dtl@write +}{% +\PackageError{datatool}{Database `#1' doesn't exist}{}% +}} +\newread\@dtl@read +\newcount\dtl@entrycr +\gdef\DTLloaddb#1#2{% +\IfFileExists{#2}{% +\begingroup +\catcode`\"12\relax +\openin\@dtl@read=#2% +\dtl@message{Reading `#2'}% +\DTLnewdb{#1}% +\ifeof\@dtl@read +\else + \loop + \@dtl@conditionfalse + \ifeof\@dtl@read + \else + \read\@dtl@read to \@dtl@line + \dtl@trim\@dtl@line + \if\@dtl@line\par + \@dtl@conditiontrue + \fi + \fi + \if@dtl@condition + \repeat + \ifeof\@dtl@read + \else + \protected@edef\@dtl@lin@{\@dtl@separator\@dtl@line\@dtl@separator}% + \@dtl@tmpcount=0\relax + \whiledo{\not\equal{\@dtl@lin@}{\@dtl@separator}}{% + \expandafter\@dtl@lopoff\@dtl@lin@\to\@dtl@lin@\@dtl@key + \advance\@dtl@tmpcount by 1\relax + \expandafter\@dtl@toks\expandafter{\@dtl@key}% + \expandafter + \edef\csname @dtl@inky@\romannumeral\@dtl@tmpcount\endcsname{% + \the\@dtl@toks}% + }% + \ifeof\@dtl@read + \else + \@dtl@conditiontrue + \loop + \read\@dtl@read to \@dtl@line + \dtl@trim\@dtl@line + \ifthenelse{\equal{\@dtl@line}{}}{}% + {% + \DTLnewrow{#1}% + \expandafter\@dtl@toks\expandafter{\@dtl@line}% + \edef\@dtl@lin@{\@dtl@separator\the\@dtl@toks + \@dtl@separator}% + \dtl@entrycr=0\relax + \whiledo{\not\equal{\@dtl@lin@}{\@dtl@separator}}{% + \expandafter\@dtl@lopoff\@dtl@lin@\to + \@dtl@lin@\@dtl@thisentry + \advance\dtl@entrycr by 1\relax + \edef\@dtl@thiskey{% + \csname @dtl@inky@\romannumeral\dtl@entrycr\endcsname}% + \expandafter\@dtl@toks\expandafter{\@dtl@thisentry}% + \edef\@do@dtlnewentry{\noexpand\DTLnewdbentry + {#1}{\@dtl@thiskey}{\the\@dtl@toks}}% + \@do@dtlnewentry + }% + }% + \ifeof\@dtl@read \@dtl@conditionfalse\fi + \if@dtl@condition + \repeat + \fi + \fi +\fi +\closein\@dtl@read +\endgroup +}{% +\PackageError{datatool}{Can't load database `#1' (file `#2' +doesn't exist)}{}% +}} +\newcommand{\dtl@trim}[1]{% +\def\@dtl@trmstr{}% +\expandafter\@dtl@starttrim#1\@nil% +\let#1=\@dtl@trmstr +} +\long\def\@dtl@starttrim#1#2{% +\ifx\par#1% + \def\@dtl@dotrim{\@dtl@trim{} #2}% +\else + \def\@dtl@dotrim{\@dtl@trim#1#2}% +\fi +\@dtl@dotrim% +} +\long\def\@dtl@trim#1 \@nil{\long\def\@dtl@trmstr{#1}} +\gdef\DTLloadrawdb#1#2{% +\IfFileExists{#2}{% +\openin\@dtl@read=#2% +\dtl@message{Reading `#2'}% +\DTLnewdb{#1}% +\ifeof\@dtl@read +\else + \loop + \@dtl@conditionfalse + \ifeof\@dtl@read + \else + \@dtl@rawread\@dtl@read to\@dtl@line + \dtl@trim\@dtl@line + \if\@dtl@line\par + \@dtl@conditiontrue + \fi + \fi + \if@dtl@condition + \repeat + \ifeof\@dtl@read + \else + \dtl@domappings\@dtl@line + \protected@edef\@dtl@lin@{\@dtl@separator\@dtl@line\@dtl@separator}% + \@dtl@tmpcount=0\relax + \whiledo{\not\equal{\@dtl@lin@}{\@dtl@separator}}{% + \expandafter\@dtl@lopoff\@dtl@lin@\to\@dtl@lin@\@dtl@key + \advance\@dtl@tmpcount by 1\relax + \expandafter\@dtl@toks\expandafter{\@dtl@key}% + \expandafter + \edef\csname @dtl@inky@\romannumeral\@dtl@tmpcount\endcsname{% + \the\@dtl@toks}% + }% + \ifeof\@dtl@read + \else + \@dtl@conditiontrue + \loop + \@dtl@rawread\@dtl@read to\@dtl@line + \dtl@trim\@dtl@line + \ifthenelse{\equal{\@dtl@line}{}}{}% + {% + \DTLnewrow{#1}% + \dtl@domappings\@dtl@line + \expandafter\@dtl@toks\expandafter{\@dtl@line}% + \edef\@dtl@lin@{\@dtl@separator\the\@dtl@toks + \@dtl@separator}% + \dtl@entrycr=0\relax + \whiledo{\not\equal{\@dtl@lin@}{\@dtl@separator}}{% + \expandafter\@dtl@lopoff\@dtl@lin@\to + \@dtl@lin@\@dtl@thisentry + \advance\dtl@entrycr by 1\relax + \edef\@dtl@thiskey{% + \csname @dtl@inky@\romannumeral\dtl@entrycr\endcsname}% + \expandafter\@dtl@toks\expandafter{\@dtl@thisentry}% + \edef\@do@dtlnewentry{\noexpand\DTLnewdbentry + {#1}{\@dtl@thiskey}{\the\@dtl@toks}}% + \@do@dtlnewentry + }% + }% + \ifeof\@dtl@read \@dtl@conditionfalse\fi + \if@dtl@condition + \repeat + \fi + \fi +\fi +\closein\@dtl@read +}{% +\PackageError{datatool}{Can't load database `#1' (file `#2' +doesn't exist)}{}% +}} +\begingroup +\catcode`\%=\active +\catcode`$=\active +\catcode`&=\active +\catcode`~=\active +\catcode`_=\active +\catcode`^=\active +\catcode`#=\active +\catcode`?=6\relax +\catcode`<=1\relax +\catcode`>=2\relax +\catcode`\{=\active +\catcode`\}=\active +\gdef\@dtl@rawread?1to?2<\relax +<<\catcode`\%=\active +\catcode`$=\active +\catcode`&=\active +\catcode`~=\active +\catcode`_=\active +\catcode`^=\active +\catcode`#=\active +\catcode`\{=\active +\catcode`\}=\active +\def%<\noexpand\%>\relax +\def$<\noexpand\$>\relax +\def&<\&>\relax +\def#<\#>\relax +\def~<\noexpand\textasciitilde>\relax +\def_<\noexpand\_>\relax +\def^<\noexpand\textasciicircum>\relax +\@dtl@activatebraces +\@dtl@doreadraw?1?2>>> +\gdef\@dtl@doreadraw?1?2<\relax +\read?1 to \tmp +\xdef?2<\tmp>\relax +> +\endgroup +\begingroup +\catcode`\{=\active +\catcode`\}=\active +\catcode`<=1\relax +\catcode`>=2\relax +\gdef\@dtl@activatebraces<% + \catcode`\{=\active + \catcode`\}=\active + \def{<\noexpand\{>% + \def}<\noexpand\}>% +>% +\endgroup +\newcommand*{\DTLrawmap}[2]{% +\expandafter\@dtl@toks\expandafter{\@dtl@rawmappings}% +\ifx\@dtl@rawmappings\@empty + \def\@dtl@rawmappings{{#1}{#2}}% +\else + \def\@dtl@tmp{{#1}{#2}} + \protected@edef\@dtl@rawmappings{\the\@dtl@toks,\@dtl@tmp} +\fi +} +\newcommand*{\@dtl@rawmappings}{} +\newcommand*{\dtl@domappings}[1]{% +\@for\@dtl@map:=\@dtl@rawmappings\do{% + \expandafter\DTLsubstitute\expandafter#1\@dtl@map +}} +\newcommand{\DTLsubstitute}[3]{% +\expandafter\DTLsplitstring\expandafter + {#1}{#2}{\@dtl@beforepart}{\@dtl@afterpart}% +\ifx\@dtl@replaced\@empty +\else + \def#1{}% + \expandafter\@dtl@toks\expandafter{\@dtl@beforepart}% + \expandafter\toks@\expandafter{#1}% + \protected@edef#1{\the\toks@\the\@dtl@toks#3}% + \expandafter\@dtl@toks\expandafter{\@dtl@afterpart}% + \expandafter\toks@\expandafter{#1}% + \edef#1{\the\toks@\the\@dtl@toks}% +\fi +} +\newcommand*{\DTLsplitstring}[4]{% +\def\dtl@splitstr##1#2##2\@nil{% +\def#3{##1}% +\def#4{##2}% +\ifx#4\@empty + \let\@dtl@replaced=\@empty +\else + \def\@dtl@replaced{#2}% + \dtl@split@str##2\@nil +\fi +}% +\def\dtl@split@str##1#2\@nil{% +\def#4{##1}}% +\dtl@splitstr#1#2\@nil +} +\newcommand{\DTLsubstituteall}[3]{% +\def\@dtl@splitsubstr{}% +\let\@dtl@afterpart=#1\relax +\@dtl@dosubstitute{#2}{#3}% +\expandafter\toks@\expandafter{\@dtl@splitsubstr}% +\expandafter\@dtl@toks\expandafter{\@dtl@afterpart}% +\edef#1{\the\toks@\the\@dtl@toks}% +} +\def\@dtl@dosubstitute#1#2{% +\expandafter\DTLsplitstring\expandafter + {\@dtl@afterpart}{#1}{\@dtl@beforepart}{\@dtl@afterpart}% +\expandafter\toks@\expandafter{\@dtl@splitsubstr}% +\expandafter\@dtl@toks\expandafter{\@dtl@beforepart}% +\edef\@dtl@splitsubstr{\the\toks@\the\@dtl@toks}% +\ifx\@dtl@replaced\@empty + \let\@dtl@dosubstnext=\@dtl@dosubstitutenoop +\else + \expandafter\toks@\expandafter{\@dtl@splitsubstr}% + \@dtl@toks{#2}% + \edef\@dtl@splitsubstr{\the\toks@\the\@dtl@toks}% + \let\@dtl@dosubstnext=\@dtl@dosubstitute +\fi +\@dtl@dosubstnext{#1}{#2}% +} +\def\@dtl@dosubstitutenoop#1#2{} +\newcommand*{\@dtl@currencies}{\$,\pounds} +\newcommand*{\DTLnewcurrencysymbol}[1]{% +\expandafter\toks@\expandafter{\@dtl@currencies}% +\@dtl@toks{#1}% +\edef\@dtl@currencies{\the\@dtl@toks,\the\toks@}% +} +\AtBeginDocument{% +\@ifundefined{texteuro}{}{\DTLnewcurrencysymbol{\texteuro}}% +\@ifundefined{textdollar}{}{\DTLnewcurrencysymbol{\textdollar}}% +\@ifundefined{textstirling}{}{\DTLnewcurrencysymbol{\textstirling}}% +\@ifundefined{textyen}{}{\DTLnewcurrencysymbol{\textyen}}% +\@ifundefined{textwon}{}{\DTLnewcurrencysymbol{\textwon}}% +\@ifundefined{textcurrency}{}{\DTLnewcurrencysymbol{\textcurrency}}% +\@ifundefined{euro}{}{\DTLnewcurrencysymbol{\euro}}% +\@ifundefined{yen}{}{\DTLnewcurrencysymbol{\yen}}% +} +\newcommand{\@dtl@standardize@currency}[1]{% +\def\@dtl@org@currency{}% +\@for\@dtl@thiscurrency:=\@dtl@currencies\do{% + \expandafter\toks@\expandafter{\@dtl@thiscurrency}% + \edef\@dtl@dosubs{\noexpand\DTLsubstitute{\noexpand#1}% + {\the\toks@}{\noexpand\$}}% + \@dtl@dosubs + \ifx\@dtl@replaced\@empty + \else + \let\@dtl@org@currency=\@dtl@replaced + \@endfortrue + \fi +}% +\@endforfalse} +\newcommand*{\@dtl@currency}{\$} +\newcommand*{\DTLsetdefaultcurrency}[1]{% +\renewcommand*{\@dtl@currency}{#1}} +\newcommand{\dtl@ifsingle}[3]{% +\def\@dtl@arg{#1}% +\ifx\@dtl@arg\@empty + #3% +\else + \@dtl@ifsingle#1\@nil{#2}{#3}% +\fi +} +\def\@dtl@ifsingle#1#2\@nil#3#4{% +\def\dtl@sg@arg{#2}% +\ifx\dtl@sg@arg\@empty + #3% +\else + #4% +\fi +} +\newcommand*{\dtlshowdb}[1]{% +\expandafter\show\csname dtldb@#1\endcsname} +\newcommand*{\dtlshowdbkeys}[1]{% +\expandafter\show\csname dtlkeys@#1\endcsname} +\newcommand*{\dtlshowtype}[2]{% +\expandafter\show\csname @dtl@idtype@#1@#2\endcsname} +\endinput +%% +%% End of file `datatool.sty'. -- cgit v1.2.3