diff options
author | Karl Berry <karl@freefriends.org> | 2012-07-23 21:55:18 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2012-07-23 21:55:18 +0000 |
commit | d5ef93ccfdd8ddb5ee3d5a41434e0aec04df8fa0 (patch) | |
tree | 0bfa67f70ec53a66e165994e6bfc17b52ff92130 /Master/texmf-dist/tex/latex/datatool | |
parent | 44928b3e4ed601cdf5afd19c5abb613fe3e8b4a0 (diff) |
datatool 2.10 (23jul12)
git-svn-id: svn://tug.org/texlive/trunk@27115 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/datatool')
-rw-r--r-- | Master/texmf-dist/tex/latex/datatool/databar.sty | 570 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/datatool/databib.sty | 11 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/datatool/datapie.sty | 11 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/datatool/dataplot.sty | 11 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/datatool/datatool-base.sty | 2375 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/datatool/datatool-fp.sty | 164 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/datatool/datatool-pgfmath.sty | 121 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/datatool/datatool.sty | 2674 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/datatool/person.sty | 11 |
9 files changed, 3383 insertions, 2565 deletions
diff --git a/Master/texmf-dist/tex/latex/datatool/databar.sty b/Master/texmf-dist/tex/latex/datatool/databar.sty index a381960c486..513e39c512e 100644 --- a/Master/texmf-dist/tex/latex/datatool/databar.sty +++ b/Master/texmf-dist/tex/latex/datatool/databar.sty @@ -7,7 +7,7 @@ %% datatool.dtx (with options: `databar.sty,package') %% %% datatool.dtx -%% Copyright 2009 Nicola Talbot +%% Copyright 2012 Nicola Talbot %% %% This work may be distributed and/or modified under the %% conditions of the LaTeX Project Public License, either version 1.3 @@ -21,7 +21,7 @@ %% %% 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, person.sty. +%% This work consists of the files datatool.dtx and datatool.ins and the derived files datatool-base.sty, datatool-fp.sty, datatool-pgfmath.sty, datatool.sty, databib.sty, databar.sty, datapie.sty, dataplot.sty, person.sty, databib.bst. %% %% \CharacterTable %% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z @@ -38,13 +38,8 @@ %% Right bracket \] Circumflex \^ Underscore \_ %% Grave accent \` Left brace \{ Vertical bar \| %% Right brace \} Tilde \~} -%% load student information from file "students.csv" -%% Iterate through the student database: -%% Define "anon": -%% Do the letter: -%% Undefine "anon": \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{databar}[2009/10/22 v2.01 (NLCT)] +\ProvidesPackage{databar}[2012/07/18 v2.10 (NLCT)] \RequirePackage{xkeyval} \RequirePackage{dataplot} \newif\ifDTLcolorbarchart @@ -167,9 +162,11 @@ \fi } \define@key{databar}{variable}{% -\def\DTLbarvariable{#1}} + \def\DTLbarvariable{#1}% +} \define@key{databar}{variables}{% -\def\dtlbar@variables{#1}} + \def\dtlbar@variables{#1}% +} \define@key{databar}{barwidth}{\setlength{\DTLbarwidth}{#1}} \define@key{databar}{barlabel}{% \def\dtl@barlabel{#1}} @@ -198,286 +195,299 @@ \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}{You haven't use the "variable" key}% -\else - \ifx\DTLbarmax\relax - \@sDTLforeach[#1]{#3}{#4}{% - \expandafter\DTLconverttodecimal\expandafter - {\DTLbarvariable}{\dtl@barvar}% - \ifx\DTLbarmax\relax - \let\DTLbarmax=\dtl@barvar +{% + \undef\DTLbarvariable + \undef\DTLbarmax + \undef\DTLnegextent + \disable@keys{databar}{variables,multibarlabels,% + uppermultibarlabels,groupgap}% + \setkeys{databar}{#2}% + \ifundef{\DTLbarvariable}% + {% + \PackageError{databar}% + {\string\DTLbarchart\space missing variable}% + {You haven't use the "variable" key}% + }% + {% + \ifundef{\DTLbarmax}% + {% + \@sDTLforeach[#1]{#3}{#4}{% + \expandafter\DTLconverttodecimal\expandafter + {\DTLbarvariable}{\dtl@barvar}% + \ifundef{\DTLbarmax}% + {% + \let\DTLbarmax=\dtl@barvar + }% + {% + \let\dtl@old=\DTLbarmax + \dtlmax{\DTLbarmax}{\dtl@old}{\dtl@barvar}% + }% + }% + \ifx\dtlbar@yticgap\relax \else - \let\dtl@old=\DTLbarmax - \FPmax{\DTLbarmax}{\dtl@old}{\dtl@barvar}% + \let\dtl@thistick=\dtlbar@yticgap + \whiledo{\DTLisFPopenbetween{\dtl@thistick}{0}{\DTLbarmax}}% + {% + \dtladd{\dtl@thistick}{\dtl@thistick}{\dtlbar@yticgap}% + }% + \let\DTLbarmax=\dtl@thistick \fi }% - \ifx\dtlbar@yticgap\relax - \else - \let\dtl@thistick=\dtlbar@yticgap% - \whiledo{\DTLisFPopenbetween{\dtl@thistick}{0}{\DTLbarmax}}{% - \FPadd{\dtl@thistick}{\dtl@thistick}{\dtlbar@yticgap}% + {}% + \ifundef{\DTLnegextent}% + {% + \def\DTLnegextent{0}% + \@sDTLforeach[#1]{#3}{#4}{% + \expandafter\DTLconverttodecimal\expandafter + {\DTLbarvariable}{\dtl@barvar}% + \let\dtl@old=\DTLnegextent + \DTLmin{\DTLnegextent}{\dtl@old}{\dtl@barvar}% }% - \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}}{% + \dtlsub{\dtl@thistick}{\dtl@thistick}{\dtlbar@yticgap}% + }% + \let\DTLnegextent=\dtl@thistick + }{}% + \fi }% - \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 + {}% + \@dtl@tmpcount=\DTLbarchartlength + \dtlsub{\dtl@extent}{\DTLbarmax}{\DTLnegextent}% + \dtldiv{\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 - \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 - }% + \ifx\dtlbar@ylabel\relax \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 - }% + \ifx\dtlbar@yticlabels\relax + \@for\dtl@thislabel:=\dtlbar@yticlist\do{% + \dtlround{\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 -\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 - }% - \edef\DTLstartpt{\noexpand\pgfpointxy{\@dtl@start.5}{0}}% -\else - \edef\dtl@textopt{% - at={\noexpand\pgfpointadd - {\noexpand\pgfpointxy{0}{\@dtl@start.5}} - {\noexpand\pgfpoint{-\noexpand\DTLbarlabeloffset}{0pt}}}, - \DTLbarXlabelalign - }% - \edef\DTLstartpt{\noexpand\pgfpointxy{0}{\@dtl@start.5}}% -\fi - \expandafter\pgftext\expandafter[\dtl@textopt]{% - \DTLdisplaylowerbarlabel{\dtl@barlabel}} -\ifDTLverticalbars - \expandafter\DTLifnumlt\expandafter{\DTLbarvariable}{0} - { + \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}{\dtl@variable}} - {\noexpand\pgfpoint{0pt}{-\noexpand\DTLbarlabeloffset}}} + at={\noexpand\pgfpointadd + {\noexpand\pgfpointxy{\@dtl@start.5}{0}} + {\noexpand\pgfpoint{0pt}{-\noexpand\DTLbarlabeloffset}}}, + \DTLbarXlabelalign }% - }{% + \edef\DTLstartpt{\noexpand\pgfpointxy{\@dtl@start.5}{0}}% + \else \edef\dtl@textopt{% - at={\noexpand\pgfpointadd - {\noexpand\pgfpointxy{\@dtl@start.5}{\dtl@variable}} - {\noexpand\pgfpoint{0pt}{\noexpand\DTLbarlabeloffset}}} - }% - } - \edef\DTLendpt{\noexpand\pgfpointxy{\@dtl@start.5}{\dtl@variable}}% -\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}}} + at={\noexpand\pgfpointadd + {\noexpand\pgfpointxy{0}{\@dtl@start.5}} + {\noexpand\pgfpoint{-\noexpand\DTLbarlabeloffset}{0pt}}}, + \DTLbarXlabelalign }% - } - \edef\DTLendpt{\noexpand\pgfpointxy{\dtl@variable}{\@dtl@start.5}}% -\fi - \expandafter\pgftext\expandafter[\dtl@textopt]{% - \DTLdisplayupperbarlabel{\dtl@upperbarlabel}} -\def\DTLmidpt{\pgfpointlineattime{0.5}{\DTLstartpt}{\DTLendpt}}% - \DTLeverybarhook - \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); + \edef\DTLstartpt{\noexpand\pgfpointxy{0}{\@dtl@start.5}}% \fi -\fi -\ifDTLbaryaxis + \expandafter\pgftext\expandafter[\dtl@textopt]{% + \DTLdisplaylowerbarlabel{\dtl@barlabel}} \ifDTLverticalbars - \expandafter\draw\expandafter[\DTLBarYAxisStyle] - (0,\DTLnegextent) -- (0,\DTLbarmax); + \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}}} + }% + } + \edef\DTLendpt{\noexpand\pgfpointxy{\@dtl@start.5}{\dtl@variable}}% \else - \expandafter\draw\expandafter[\DTLBarYAxisStyle] - (\DTLnegextent,0) -- (\DTLbarmax,0); + \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}}} + }% + } + \edef\DTLendpt{\noexpand\pgfpointxy{\dtl@variable}{\@dtl@start.5}}% \fi -\fi -\ifx\dtlbar@yticlist\relax -\else - \@for\dtl@thistick:=\dtlbar@yticlist\do{% + \expandafter\pgftext\expandafter[\dtl@textopt]{% + \DTLdisplayupperbarlabel{\dtl@upperbarlabel}} + \def\DTLmidpt{\pgfpointlineattime{0.5}{\DTLstartpt}{\DTLendpt}}% + \DTLeverybarhook + \edef\@dtl@start{\number\@dtl@bar}% + }% + \ifDTLbarxaxis \ifDTLverticalbars - \pgfpathmoveto{\pgfpointxy{0}{\dtl@thistick}} - \pgfpathlineto{ - \pgfpointadd{\pgfpointxy{0}{\dtl@thistick}} - {\pgfpoint{-\DTLticklength}{0pt}}} + \expandafter\draw\expandafter[\DTLBarXAxisStyle] + (0,0) -- (\DTLbarchartwidth,0); \else - \pgfpathmoveto{\pgfpointxy{\dtl@thistick}{0}} - \pgfpathlineto{ - \pgfpointadd{\pgfpointxy{\dtl@thistick}{0}} - {\pgfpoint{0pt}{-\DTLticklength}}} + \expandafter\draw\expandafter[\DTLBarXAxisStyle] + (0,0) -- (0,\DTLbarchartwidth); \fi - \pgfusepath{stroke} - \ifx\dtlbar@yticlabels\relax - \FPround{\dtl@thislabel}{\dtl@thistick} - {\c@DTLbarroundvar}% + \fi + \ifDTLbaryaxis + \ifDTLverticalbars + \expandafter\draw\expandafter[\DTLBarYAxisStyle] + (0,\DTLnegextent) -- (0,\DTLbarmax); \else - \dtl@chopfirst\dtlbar@yticlabels\dtl@thislabel\dtl@rest - \let\dtlbar@yticlabels=\dtl@rest + \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 + \dtlround{\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 - \edef\dtl@textopt{\DTLbarYticklabelalign,% - at={\noexpand\pgfpointadd - {\noexpand\pgfpointxy{0}{\dtl@thistick}} - {\noexpand\pgfpoint{-\noexpand\DTLticklabeloffset}{0pt}}, - }}% + \pgftext[bottom,center,at={\pgfpointadd + {\pgfpointxy{0}{\DTLnegextent}}% + {\pgfpoint{-\dtl@yticlabelwidth}{\dtl@tmplength}}}, + rotate=90]{% + \dtlbar@ylabel} \else - \edef\dtl@textopt{\DTLbarYticklabelalign, - at={\noexpand\pgfpointadd - {\noexpand\pgfpointxy{\dtl@thistick}{0}} - {\noexpand\pgfpoint{0pt}{-\noexpand\DTLticklabeloffset}} - }}% + \pgftext[bottom,center,at={\pgfpointadd + {\pgfpointxy{\DTLnegextent}{0}}% + {\pgfpoint{\dtl@tmplength}{-\dtl@yticlabelwidth}}}]{% + \dtlbar@ylabel} \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 -}} + \DTLbaratendtikz + \end{tikzpicture} + }% +}% +} \newcommand*{\DTLmultibarchart}[4][\boolean{true}]{% {\let\dtlbar@variables=\relax \let\DTLbarmax=\relax @@ -496,7 +506,7 @@ uppermultibarlabels,groupgap}% \let\DTLbarmax=\dtl@barvar \else \let\dtl@old=\DTLbarmax - \FPmax{\DTLbarmax}{\dtl@old}{\dtl@barvar}% + \dtlmax{\DTLbarmax}{\dtl@old}{\dtl@barvar}% \fi }% }% @@ -504,7 +514,7 @@ uppermultibarlabels,groupgap}% \else \let\dtl@thistick=\dtlbar@yticgap% \whiledo{\DTLisFPopenbetween{\dtl@thistick}{0}{\DTLbarmax}}{% - \FPadd{\dtl@thistick}{\dtl@thistick}{\dtlbar@yticgap}% + \dtladd{\dtl@thistick}{\dtl@thistick}{\dtlbar@yticgap}% }% \let\DTLbarmax=\dtl@thistick \fi @@ -524,15 +534,15 @@ uppermultibarlabels,groupgap}% \ifthenelse{\DTLisFPlt{\DTLnegextent}{0}}{% \edef\dtl@thistick{0}% \whiledo{\DTLisFPclosedbetween{\dtl@thistick}{\DTLnegextent}{0}}{% - \FPsub{\dtl@thistick}{\dtl@thistick}{\dtlbar@yticgap}% + \dtlsub{\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}% + \dtlsub{\dtl@extent}{\DTLbarmax}{\DTLnegextent}% + \dtldiv{\dtl@unit}{\number\@dtl@tmpcount}{\dtl@extent}% \setlength{\dtl@yticlabelwidth}{0pt}% \ifDTLbarytics \ifx\dtlbar@yticlist\relax @@ -548,7 +558,7 @@ uppermultibarlabels,groupgap}% \else \ifx\dtlbar@yticlabels\relax \@for\dtl@thislabel:=\dtlbar@yticlist\do{% - \FPround{\dtl@thislabel}{\dtl@thislabel} + \dtlround{\dtl@thislabel}{\dtl@thislabel} {\c@DTLbarroundvar}% \ifDTLverticalbars \settowidth{\dtl@tmplength}{% @@ -608,10 +618,10 @@ uppermultibarlabels,groupgap}% }% \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} +\dtlmul{\dtl@tmpi}{\dtl@n}{\DTLbargroupwidth} +\dtlsub{\dtl@tmpii}{\dtl@n}{1}% +\dtlmul{\dtl@tmpii}{\dtl@tmpii}{\dtlbar@groupgap}% +\dtladd{\DTLbarchartwidth}{\dtl@tmpi}{\dtl@tmpii} \begin{tikzpicture} \ifDTLverticalbars \pgfsetyvec{\pgfpoint{0pt}{\dtl@unit sp}}% @@ -626,10 +636,10 @@ uppermultibarlabels,groupgap}% \@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}% +\dtlmul{\dtl@multimidpt}{\DTLbargroupwidth}{0.5}% +\dtladd{\dtl@multimidpt}{\dtl@multimidpt}{\@dtl@start}% \@for\DTLbarvariable:=\dtlbar@variables\do{% -\FPadd{\@dtl@endpt}{\@dtl@start}{1}% +\dtladd{\@dtl@endpt}{\@dtl@start}{1}% \expandafter\DTLconverttodecimal\expandafter {\DTLbarvariable}{\dtl@variable}% \dtl@chopfirst\dtl@multibar@labels\dtl@thisbarlabel\dtl@rest @@ -658,7 +668,7 @@ uppermultibarlabels,groupgap}% \fi \fi \end{scope} -\FPadd{\@dtl@midpt}{\@dtl@start}{0.5}% +\dtladd{\@dtl@midpt}{\@dtl@start}{0.5}% \ifDTLverticalbars \edef\dtl@textopt{% at={\noexpand\pgfpointadd @@ -715,7 +725,7 @@ uppermultibarlabels,groupgap}% \DTLdisplayuppermultibarlabel{\dtl@thisupperbarlabel}} \def\DTLmidpt{\pgfpointlineattime{0.5}{\DTLstartpt}{\DTLendpt}}% \DTLeverybarhook - \FPadd{\@dtl@start}{\@dtl@start}{1}% + \dtladd{\@dtl@start}{\@dtl@start}{1}% \advance\@dtl@barcount by 1\relax }% \setlength{\dtl@tmplength}{\DTLbarlabeloffset}% @@ -737,7 +747,7 @@ uppermultibarlabels,groupgap}% \fi \expandafter\pgftext\expandafter[\dtl@textopt]{% \DTLdisplaylowerbarlabel{\dtl@barlabel}} - \FPadd{\@dtl@start}{\@dtl@start}{\dtlbar@groupgap}% + \dtladd{\@dtl@start}{\@dtl@start}{\dtlbar@groupgap}% } \ifDTLbarxaxis \ifDTLverticalbars @@ -773,7 +783,7 @@ uppermultibarlabels,groupgap}% \fi \pgfusepath{stroke} \ifx\dtlbar@yticlabels\relax - \FPround{\dtl@thislabel}{\dtl@thistick} + \dtlround{\dtl@thislabel}{\dtl@thistick} {\c@DTLbarroundvar}% \else \dtl@chopfirst\dtlbar@yticlabels\dtl@thislabel\dtl@rest diff --git a/Master/texmf-dist/tex/latex/datatool/databib.sty b/Master/texmf-dist/tex/latex/datatool/databib.sty index 4e45c052256..1229b6dcfc7 100644 --- a/Master/texmf-dist/tex/latex/datatool/databib.sty +++ b/Master/texmf-dist/tex/latex/datatool/databib.sty @@ -7,7 +7,7 @@ %% datatool.dtx (with options: `databib.sty,package') %% %% datatool.dtx -%% Copyright 2009 Nicola Talbot +%% Copyright 2012 Nicola Talbot %% %% This work may be distributed and/or modified under the %% conditions of the LaTeX Project Public License, either version 1.3 @@ -21,7 +21,7 @@ %% %% 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, person.sty. +%% This work consists of the files datatool.dtx and datatool.ins and the derived files datatool-base.sty, datatool-fp.sty, datatool-pgfmath.sty, datatool.sty, databib.sty, databar.sty, datapie.sty, dataplot.sty, person.sty, databib.bst. %% %% \CharacterTable %% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z @@ -38,13 +38,8 @@ %% Right bracket \] Circumflex \^ Underscore \_ %% Grave accent \` Left brace \{ Vertical bar \| %% Right brace \} Tilde \~} -%% load student information from file "students.csv" -%% Iterate through the student database: -%% Define "anon": -%% Do the letter: -%% Undefine "anon": \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{databib}[2009/10/22 v2.01 (NLCT)] +\ProvidesPackage{databib}[2012/07/18 v2.10 (NLCT)] \RequirePackage{datatool} \newcommand*{\dtlbib@style}{plain} \define@choicekey{databib.sty}{style}{plain,abbrv,alpha}{% diff --git a/Master/texmf-dist/tex/latex/datatool/datapie.sty b/Master/texmf-dist/tex/latex/datatool/datapie.sty index 62916f4638d..f464e584153 100644 --- a/Master/texmf-dist/tex/latex/datatool/datapie.sty +++ b/Master/texmf-dist/tex/latex/datatool/datapie.sty @@ -7,7 +7,7 @@ %% datatool.dtx (with options: `datapie.sty,package') %% %% datatool.dtx -%% Copyright 2009 Nicola Talbot +%% Copyright 2012 Nicola Talbot %% %% This work may be distributed and/or modified under the %% conditions of the LaTeX Project Public License, either version 1.3 @@ -21,7 +21,7 @@ %% %% 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, person.sty. +%% This work consists of the files datatool.dtx and datatool.ins and the derived files datatool-base.sty, datatool-fp.sty, datatool-pgfmath.sty, datatool.sty, databib.sty, databar.sty, datapie.sty, dataplot.sty, person.sty, databib.bst. %% %% \CharacterTable %% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z @@ -38,13 +38,8 @@ %% Right bracket \] Circumflex \^ Underscore \_ %% Grave accent \` Left brace \{ Vertical bar \| %% Right brace \} Tilde \~} -%% load student information from file "students.csv" -%% Iterate through the student database: -%% Define "anon": -%% Do the letter: -%% Undefine "anon": \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{datapie}[2009/10/22 v2.01 (NLCT)] +\ProvidesPackage{datapie}[2012/07/18 v2.10 (NLCT)] \RequirePackage{xkeyval} \newif\ifDTLcolorpiechart \DTLcolorpiecharttrue diff --git a/Master/texmf-dist/tex/latex/datatool/dataplot.sty b/Master/texmf-dist/tex/latex/datatool/dataplot.sty index 3d67f7823de..29bc2632de6 100644 --- a/Master/texmf-dist/tex/latex/datatool/dataplot.sty +++ b/Master/texmf-dist/tex/latex/datatool/dataplot.sty @@ -7,7 +7,7 @@ %% datatool.dtx (with options: `dataplot.sty,package') %% %% datatool.dtx -%% Copyright 2009 Nicola Talbot +%% Copyright 2012 Nicola Talbot %% %% This work may be distributed and/or modified under the %% conditions of the LaTeX Project Public License, either version 1.3 @@ -21,7 +21,7 @@ %% %% 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, person.sty. +%% This work consists of the files datatool.dtx and datatool.ins and the derived files datatool-base.sty, datatool-fp.sty, datatool-pgfmath.sty, datatool.sty, databib.sty, databar.sty, datapie.sty, dataplot.sty, person.sty, databib.bst. %% %% \CharacterTable %% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z @@ -38,13 +38,8 @@ %% Right bracket \] Circumflex \^ Underscore \_ %% Grave accent \` Left brace \{ Vertical bar \| %% Right brace \} Tilde \~} -%% load student information from file "students.csv" -%% Iterate through the student database: -%% Define "anon": -%% Do the letter: -%% Undefine "anon": \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{dataplot}[2009/10/22 v2.01 (NLCT)] +\ProvidesPackage{dataplot}[2012/07/18 v2.10 (NLCT)] \RequirePackage{xkeyval} \RequirePackage{tikz} \RequirePackage{datatool} diff --git a/Master/texmf-dist/tex/latex/datatool/datatool-base.sty b/Master/texmf-dist/tex/latex/datatool/datatool-base.sty new file mode 100644 index 00000000000..90e7a0c545a --- /dev/null +++ b/Master/texmf-dist/tex/latex/datatool/datatool-base.sty @@ -0,0 +1,2375 @@ +%% +%% This is file `datatool-base.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% datatool.dtx (with options: `datatool-base.sty,package') +%% +%% datatool.dtx +%% Copyright 2012 Nicola Talbot +%% +%% This work may be distributed and/or modified under the +%% conditions of the LaTeX Project Public License, either version 1.3 +%% of this license of (at your option) any later version. +%% The latest version of this license is in +%% http://www.latex-project.org/lppl.txt +%% and version 1.3 or later is part of all distributions of LaTeX +%% version 2005/12/01 or later. +%% +%% This work has the LPPL maintenance status `maintained'. +%% +%% The Current Maintainer of this work is Nicola Talbot. +%% +%% This work consists of the files datatool.dtx and datatool.ins and the derived files datatool-base.sty, datatool-fp.sty, datatool-pgfmath.sty, datatool.sty, databib.sty, databar.sty, datapie.sty, dataplot.sty, person.sty, databib.bst. +%% +%% \CharacterTable +%% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z +%% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z +%% Digits \0\1\2\3\4\5\6\7\8\9 +%% Exclamation \! Double quote \" Hash (number) \# +%% Dollar \$ Percent \% Ampersand \& +%% Acute accent \' Left paren \( Right paren \) +%% Asterisk \* Plus \+ Comma \, +%% Minus \- Point \. Solidus \/ +%% Colon \: Semicolon \; Less than \< +%% Equals \= Greater than \> Question mark \? +%% Commercial at \@ Left bracket \[ Backslash \\ +%% Right bracket \] Circumflex \^ Underscore \_ +%% Grave accent \` Left brace \{ Vertical bar \| +%% Right brace \} Tilde \~} +\NeedsTeXFormat{LaTeX2e} +\ProvidesPackage{datatool-base}[2012/07/18 v2.10 (NLCT)] +\RequirePackage{etoolbox} +\RequirePackage{amsmath} +\RequirePackage{xkeyval} +\RequirePackage{xfor} +\RequirePackage{ifthen} +\RequirePackage{substr}[2009/10/20] +\ifundef{\ifdtlverbose} +{ + \define@boolkey{datatool-base.sty}[dtl]{verbose}[true]{} +}% +{} +\define@choicekey{datatool-base.sty}{math}[\val\nr]{fp,pgfmath}{% + \renewcommand*\@dtl@mathprocessor{#1}% +} +\providecommand*{\@dtl@mathprocessor}{fp} +\ProcessOptionsX +\RequirePackage{datatool-\@dtl@mathprocessor} +\newcommand*{\dtl@message}[1]{% + \ifdtlverbose\typeout{#1}\fi +} +\newtoks\@dtl@toks +\newcount\@dtl@tmpcount +\newlength\dtl@tmplength +\newcommand{\dtl@ifsingle}[3]{% + \def\@dtl@arg{#1}% + \ifdefempty{\@dtl@arg}% + {% + #3% + }% + {% + \@dtl@ifsingle#1\@nil{#2}{#3}% + }% +} +\def\@dtl@ifsingle#1#2\@nil#3#4{% + \def\dtl@sg@arg{#2}% + \ifdefempty{\dtl@sg@arg}% + {% + #3% + }% + {% + #4% + }% +} +\long\def\long@collect@body#1{% + \@envbody{\@xp#1\@xp{\the\@envbody}}% + \edef\process@envbody{\the\@envbody\@nx\end{\@currenvir}}% + \@envbody\@emptytoks \def\begin@stack{b}% + \begingroup + \@xp\let\csname\@currenvir\endcsname\long@collect@@body + \edef\process@envbody{\@xp\@nx\csname\@currenvir\endcsname}% + \process@envbody +} +\long\def\long@addto@envbody#1{% + \toks@{#1}% + \edef\@dtl@tmp{\the\@envbody\the\toks@}% + \global\@envbody\@xp{\@dtl@tmp}% +} +\long\def\long@collect@@body#1\end#2{% + \protected@edef\begin@stack{% + \long@push@begins#1\begin\end \@xp\@gobble\begin@stack + }% + \ifx\@empty\begin@stack + \endgroup + \@checkend{#2}% + \long@addto@envbody{#1}% + \else + \long@addto@envbody{#1\end{#2}}% + \fi + \process@envbody +} +\long\def\long@push@begins#1\begin#2{% + \ifx\end#2\else b\@xp\long@push@begins\fi +} +\newcommand*{\DTLifinlist}[4]{% + \def\@dtl@doifinlist##1,#1,##2\end@dtl@doifinlist{% + \def\@before{##1}% + \def\@after{##2}% + }% + \expandafter\@dtl@doifinlist\expandafter,#2,#1,\@nil + \end@dtl@doifinlist + \ifx\@after\@nnil + #4% + \else + #3% + \fi +} +\newcommand*{\DTLnumitemsinlist}[2]{% + \@dtl@tmpcount=0\relax + \@for\@dtl@element:=#1\do{% + \ifdefempty{\@dtl@element}% + {}% + {\advance\@dtl@tmpcount by 1\relax}% + }% + \edef#2{\number\@dtl@tmpcount}% +} +\newcommand*{\dtl@choplast}[3]{% + \let#2\@empty + \let#3\@empty + \@for\@dtl@element:=#1\do{% + \ifdefempty{#3}% + {% + }% + {% + \ifdefempty{#2}% + {% + \expandafter\toks@\expandafter{#3}% + \edef#2{{\the\toks@}}% + }% + {% + \expandafter\toks@\expandafter{#3}% + \expandafter\@dtl@toks\expandafter{#2}% + \edef#2{\the\@dtl@toks,{\the\toks@}}% + }% + }% + \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 +} +\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 + \ifdefempty{\@dtl@newsortedlist}% + {% + \expandafter\toks@\expandafter{\@dtl@newstuff}% + \edef\@dtl@newsortedlist{\the\toks@}% + }% + {% + \expandafter\toks@\expandafter{\@dtl@newsortedlist}% + \expandafter\@dtl@toks\expandafter{\@dtl@newstuff}% + \edef\@dtl@newsortedlist{\the\toks@,\the\@dtl@toks}% + }% + \@endforfalse + }% + \ifdefempty{\@dtl@newsortedlist}% + {% + \@dtl@toks{#1}% + \edef\@dtl@newsortedlist{{\the\@dtl@toks}}% + }% + {% + \if@dtl@insertdone + \else + \expandafter\toks@\expandafter{\@dtl@newsortedlist}% + \@dtl@toks{#1}% + \edef\@dtl@newsortedlist{\the\toks@,{\the\@dtl@toks}}% + \fi + }% + \global\let#2=\@dtl@newsortedlist +} +\newif\if@dtl@insertdone +\newcount\dtl@sortresult +\newcommand{\toks@gput@right@cx}[2]{% + \def\@toks@name{#1}% + \edef\@dtl@stuff{#2}% + \global\csname\@toks@name\endcsname\expandafter + \expandafter\expandafter{\expandafter\the + \csname\expandafter\@toks@name\expandafter\endcsname\@dtl@stuff}% +} +\newcommand{\toks@gconcat@middle@cx}[4]{% + \def\@toks@name{#1}% + \edef\@dtl@stuff{#3}% + \global\csname\@toks@name\endcsname\expandafter\expandafter + \expandafter\expandafter\expandafter + \expandafter\expandafter{\expandafter\expandafter\expandafter + \the\expandafter\expandafter\expandafter#2% + \expandafter\@dtl@stuff\the#4}% +} +\newcount\@dtl@numgrpsepcount +\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\ifdefempty{\noexpand\@dtl@org@currency}% + {% + }% + {% + \noexpand\let\noexpand\@dtl@currency\noexpand\@dtl@org@currency + }% + \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{% + \dtlifnumeq{#2}{0}% + {% + \edef\@dtl@tmpcpz{\@dtl@tmpcpz#1}% + \let\@dtl@chopzeroesnext=\@dtl@gobbletonil + }% + {% + \edef\@dtl@tmpcpz{\@dtl@tmpcpz#1}% + \let\@dtl@chopzeroesnext=\@dtl@chop@trailingzeroes + }% + \@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 + \dtlifnumeq{\@dtl@fracpart}{0}% + {% + \edef#2{\@dtl@intpart}% + }% + {% + \edef#2{\@dtl@intpart\@dtl@decimal\@dtl@fracpart}% + }% +} +\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}% + \dtlifnumeq{\@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 + }% + {% + \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 + }% +} +\@dtl@construct@getnums +\expandafter\@dtl@construct@stripnumgrpchar\expandafter + {\@dtl@numbergroupchar} +\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 + \ifdefempty{\@dtl@replaced}% + {% + }% + {% + \let\@dtl@org@currency=\@dtl@replaced + \@endfortrue + }% + }% + \@endforfalse +} +\newcommand*{\@dtl@currency}{\$} +\newcommand*{\DTLsetdefaultcurrency}[1]{% + \renewcommand*{\@dtl@currency}{#1}% +} +\newcommand*{\DTLadd}[3]{% + \DTLconverttodecimal{#2}{\@dtl@numi}% + \DTLconverttodecimal{#3}{\@dtl@numii}% + \dtladd{\@dtl@tmp}{\@dtl@numi}{\@dtl@numii}% + \ifdefempty{\@dtl@replaced}% + {% + \DTLdecimaltolocale{\@dtl@tmp}{#1}% + }% + {% + \DTLdecimaltocurrency{\@dtl@tmp}{#1}% + }% +} +\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{% + \expandafter\DTLconverttodecimal\expandafter{\dtl@thisval}{\@dtl@num}% + \dtladd{\@dtl@sum}{\@dtl@sum}{\@dtl@num}% + }% + \ifdefempty{\@dtl@replaced}% + {% + \DTLdecimaltolocale{\@dtl@sum}{#1}% + }% + {% + \DTLdecimaltocurrency{\@dtl@sum}{#1}% + }% +} +\newcommand*{\DTLgaddall}[2]{% + \DTLaddall{\@dtl@tmpi}{#2}% + \global\let#1=\@dtl@tmpi +} +\newcommand*{\DTLsub}[3]{% + \DTLconverttodecimal{#2}{\@dtl@numi}% + \DTLconverttodecimal{#3}{\@dtl@numii}% + \dtlsub{\@dtl@tmp}{\@dtl@numi}{\@dtl@numii}% + \ifdefempty{\@dtl@replaced}% + {% + \DTLdecimaltolocale{\@dtl@tmp}{#1}% + }% + {% + \DTLdecimaltocurrency{\@dtl@tmp}{#1}% + }% +} +\newcommand*{\DTLgsub}[3]{% + \DTLsub{\@dtl@tmpii}{#2}{#3}% + \global\let#1=\@dtl@tmpii +} +\newcommand*{\DTLmul}[3]{% + \let\@dtl@thisreplaced=\@empty + \DTLconverttodecimal{#2}{\@dtl@numi}% + \ifdefempty{\@dtl@replaced}% + {% + }% + {% + \let\@dtl@thisreplaced=\@dtl@replaced + }% + \DTLconverttodecimal{#3}{\@dtl@numii}% + \ifdefempty{\@dtl@replaced}% + {% + }% + {% + \let\@dtl@thisreplaced=\@dtl@replaced + }% + \dtlmul{\@dtl@tmp}{\@dtl@numi}{\@dtl@numii}% + \ifdefempty{\@dtl@thisreplaced}% + {% + \DTLdecimaltolocale{\@dtl@tmp}{#1}% + }% + {% + \DTLdecimaltocurrency{\@dtl@tmp}{#1}% + }% +} +\newcommand*{\DTLgmul}[3]{% + \DTLmul{\@dtl@tmpii}{#2}{#3}% + \global\let#1=\@dtl@tmpii +} +\newcommand*{\DTLdiv}[3]{% + \let\@dtl@thisreplaced=\@empty + \DTLconverttodecimal{#2}{\@dtl@numi}% + \ifdefempty{\@dtl@replaced}% + {% + }% + {% + \let\@dtl@thisreplaced=\@dtl@replaced + }% + \DTLconverttodecimal{#3}{\@dtl@numii}% + \dtldiv{\@dtl@tmp}{\@dtl@numi}{\@dtl@numii}% + \ifdefempty{\@dtl@thisreplaced}% + {% + \DTLdecimaltolocale{\@dtl@tmp}{#1}% + }% + {% + \ifdefequal{\@dtl@thisreplaced}{\@dtl@replaced}% + {% + \DTLdecimaltolocale{\@dtl@tmp}{#1}% + }% + {% + \DTLdecimaltocurrency{\@dtl@tmp}{#1}% + }% + }% +} +\newcommand*{\DTLgdiv}[3]{% + \DTLdiv{\@dtl@tmpii}{#2}{#3}% + \global\let#1=\@dtl@tmpii +} +\newcommand*{\DTLabs}[2]{% + \DTLconverttodecimal{#2}{\@dtl@numi}% + \dtlabs{\@dtl@tmp}{\@dtl@numi}% + \ifdefempty{\@dtl@replaced}% + {% + \DTLdecimaltolocale{\@dtl@tmp}{#1}% + }% + {% + \DTLdecimaltocurrency{\@dtl@tmp}{#1}% + }% +} +\newcommand*{\DTLgabs}[2]{% + \DTLabs{\@dtl@tmpii}{#2}% + \global\let#1=\@dtl@tmpii +} +\newcommand*{\DTLneg}[2]{% + \DTLconverttodecimal{#2}{\@dtl@numi}% + \dtlneg{\@dtl@tmp}{\@dtl@numi}% + \ifdefempty{\@dtl@replaced}% + {% + \DTLdecimaltolocale{\@dtl@tmp}{#1}% + }% + {% + \DTLdecimaltocurrency{\@dtl@tmp}{#1}% + }% +} +\newcommand*{\DTLgneg}[2]{% + \DTLneg{\@dtl@tmpii}{#2}% + \global\let#1=\@dtl@tmpii +} +\newcommand*{\DTLsqrt}[2]{% + \DTLconverttodecimal{#2}{\@dtl@numi}% + \dtlroot{\@dtl@tmpi}{\@dtl@numi}{2}% + \ifdefempty{\@dtl@replaced}% + {% + \DTLdecimaltolocale{\@dtl@tmpi}{#1}% + }% + {% + \DTLdecimaltocurrency{\@dtl@tmpi}{#1}% + }% +} +\newcommand*{\DTLgsqrt}[2]{% +\DTLsqrt{\@dtl@tmpii}{#2}% +\global\let#1=\@dtl@tmpii +} +\newcommand*{\DTLmin}[3]{% + \DTLconverttodecimal{#2}{\@dtl@numi}% + \DTLconverttodecimal{#3}{\@dtl@numii}% + \dtlifnumlt{\@dtl@numi}{\@dtl@numii}% + {% + \dtl@ifsingle{#2}% + {\let#1=#2}% + {\def#1{#2}}% + }% + {% + \dtl@ifsingle{#3}% + {\let#1=#3}% + {\def#1{#3}}% + }% +} +\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{% + \expandafter\DTLconverttodecimal\expandafter{\dtl@thisval}{\@dtl@num}% + \ifdefempty{\@dtl@min}% + {% + \let\@dtl@min=\@dtl@num + }% + {% + \dtlmin{\@dtl@min}{\@dtl@min}{\@dtl@num}% + }% + }% + \ifdefempty{\@dtl@replaced}% + {% + \DTLdecimaltolocale{\@dtl@min}{#1}% + }% + {% + \DTLdecimaltocurrency{\@dtl@min}{#1}% + }% +} +\newcommand*{\DTLgminall}[2]{% + \DTLminall{\@dtl@tmpi}{#2}% + \global\let#1=\@dtl@tmpi +} +\newcommand*{\DTLmax}[3]{% + \DTLconverttodecimal{#2}{\@dtl@numi}% + \DTLconverttodecimal{#3}{\@dtl@numii}% + \dtlmax{\@dtl@tmp}{\@dtl@numi}{\@dtl@numii}% + \dtlifnumgt{\@dtl@numi}{\@dtl@numii}% + {% + \dtl@ifsingle{#2}% + {\let#1=#2}% + {\def#1{#2}}% + }% + {% + \dtl@ifsingle{#3}% + {\let#1=#3}% + {\def#1{#3}}% + }% +} +\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{% + \expandafter\DTLconverttodecimal\expandafter{\dtl@thisval}{\@dtl@num}% + \ifdefempty{\@dtl@max}% + {% + \let\@dtl@max\@dtl@num + }% + {% + \dtlmax{\@dtl@max}{\@dtl@max}{\@dtl@num}% + }% + }% + \ifdefempty{\@dtl@replaced}% + {% + \DTLdecimaltolocale{\@dtl@max}{#1}% + }% + {% + \DTLdecimaltocurrency{\@dtl@max}{#1}% + }% +} +\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{% + \expandafter\DTLconverttodecimal\expandafter{\dtl@thisval}{\@dtl@num}% + \dtladd{\@dtl@mean}{\@dtl@mean}{\@dtl@num}% + \dtladd{\@dtl@n}{\@dtl@n}{1}% + }% + \dtldiv{\@dtl@mean}{\@dtl@mean}{\@dtl@n}% + \ifdefempty{\@dtl@replaced}% + {% + \DTLdecimaltolocale{\@dtl@mean}{#1}% + }% + {% + \DTLdecimaltocurrency{\@dtl@mean}{#1}% + }% +} +\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{% + \expandafter\DTLconverttodecimal\expandafter{\dtl@thisval}{\@dtl@num}% + \ifdefempty{\@dtl@decvals}% + {% + \let\@dtl@decvals=\@dtl@num + }% + {% + \expandafter\toks@\expandafter{\@dtl@decvals}% + \edef\@dtl@decvals{\the\toks@,\@dtl@num}% + }% + \dtladd{\@dtl@mean}{\@dtl@mean}{\@dtl@num}% + \dtladd{\@dtl@n}{\@dtl@n}{1}% + }% + \dtldiv{\@dtl@mean}{\@dtl@mean}{\@dtl@n}% + \def\@dtl@var{0}% + \@for\@dtl@num:=\@dtl@decvals\do{% + \dtlsub{\@dtl@diff}{\@dtl@num}{\@dtl@mean}% + \dtlmul{\@dtl@diff}{\@dtl@diff}{\@dtl@diff}% + \dtladd{\@dtl@var}{\@dtl@var}{\@dtl@diff}% + }% + \dtldiv{\@dtl@var}{\@dtl@var}{\@dtl@n}% + \ifdefempty{\@dtl@replaced}% + {% + \DTLdecimaltolocale{\@dtl@var}{#1}% + }% + {% + \DTLdecimaltocurrency{\@dtl@var}{#1}% + }% +} +\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{% + \expandafter\DTLconverttodecimal\expandafter{\dtl@thisval}{\@dtl@num}% + \ifdefempty{\@dtl@decvals}% + {% + \let\@dtl@decvals=\@dtl@num + }% + {% + \expandafter\toks@\expandafter{\@dtl@decvals}% + \edef\@dtl@decvals{\the\toks@,\@dtl@num}% + }% + \dtladd{\@dtl@mean}{\@dtl@mean}{\@dtl@num}% + \dtladd{\@dtl@n}{\@dtl@n}{1}% + }% + \dtldiv{\@dtl@mean}{\@dtl@mean}{\@dtl@n}% + \def\@dtl@sd{0}% + \@for\@dtl@num:=\@dtl@decvals\do{% + \dtlsub{\@dtl@diff}{\@dtl@num}{\@dtl@mean}% + \dtlmul{\@dtl@diff}{\@dtl@diff}{\@dtl@diff}% + \dtladd{\@dtl@sd}{\@dtl@sd}{\@dtl@diff}% + }% + \dtldiv{\@dtl@sd}{\@dtl@sd}{\@dtl@n}% + \dtlroot{\@dtl@sd}{\@dtl@sd}{2}% + \ifdefempty{\@dtl@replaced}% + {% + \DTLdecimaltolocale{\@dtl@sd}{#1}% + }% + {% + \DTLdecimaltocurrency{\@dtl@sd}{#1}% + }% +} +\newcommand*{\DTLgsdforall}[2]{% + \DTLsdforall{\@dtl@tmpi}{#2}% + \global\let#1=\@dtl@tmpi +} +\newcommand*{\DTLround}[3]{% + \DTLconverttodecimal{#2}{\@dtl@numi}% + \dtlround{\@dtl@tmp}{\@dtl@numi}{#3}% + \ifdefempty{\@dtl@replaced}% + {% + \DTLdecimaltolocale{\@dtl@tmp}{#1}% + }% + {% + \DTLdecimaltocurrency{\@dtl@tmp}{#1}% + }% +} +\newcommand*{\DTLground}[3]{% + \DTLround{\@dtl@tmpii}{#2}{#3}% + \global\let#1=\@dtl@tmpii +} +\newcommand*{\DTLtrunc}[3]{% + \DTLconverttodecimal{#2}{\@dtl@numi}% + \dtltrunc{\@dtl@tmp}{\@dtl@numi}{#3}% + \ifdefempty{\@dtl@replaced}% + {% + \DTLdecimaltolocale{\@dtl@tmp}{#1}% + }% + {% + \DTLdecimaltocurrency{\@dtl@tmp}{#1}% + }% +} +\newcommand*{\DTLgtrunc}[3]{% + \DTLtrunc{\@dtl@tmpii}{#2}{#3}% + \global\let#1=\@dtl@tmpii +} +\newcommand*{\DTLclip}[2]{% + \DTLconverttodecimal{#2}{\@dtl@numi}% + \dtlclip{\@dtl@tmp}{\@dtl@numi}% + \ifdefempty{\@dtl@replaced}% + {% + \DTLdecimaltolocale{\@dtl@tmp}{#1}% + }% + {% + \DTLdecimaltocurrency{\@dtl@tmp}{#1}% + }% +} +\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}% + \ifdefempty{\dtl@inithyphen}% + {% + }% + {% + \edef\dtl@initialscmd{\the\@dtl@toks\the\toks@}% + \expandafter\@dtl@toks\expandafter{\dtl@initialscmd}% + \expandafter\toks@\expandafter{\dtl@inithyphen}% + }% + \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}% + \ifdefempty{\dtl@inithyphen}% + {% + }% + {% + \edef\dtl@inithyphen{% + \DTLafterinitialbeforehyphen\DTLinitialhyphen#2}% + }% +} +\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 + }% + }% +} +\newcommand{\DTLsubstitute}[3]{% + \expandafter\DTLsplitstring\expandafter + {#1}{#2}{\@dtl@beforepart}{\@dtl@afterpart}% + \ifdefempty{\@dtl@replaced}% + {% + }% + {% + \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}% + }% +} +\newcommand*{\DTLsplitstring}[4]{% + \def\dtl@splitstr##1#2##2\@nil{% + \def#3{##1}% + \def#4{##2}% + \ifdefempty{#4}% + {% + \let\@dtl@replaced=\@empty + }% + {% + \def\@dtl@replaced{#2}% + \dtl@split@str##2\@nil + }% + }% + \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}% + \long\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}% + \ifdefempty{\@dtl@replaced}% + {% + \let\@dtl@dosubstnext=\@dtl@dosubstitutenoop + }% + {% + \expandafter\toks@\expandafter{\@dtl@splitsubstr}% + \@dtl@toks{#2}% + \edef\@dtl@splitsubstr{\the\toks@\the\@dtl@toks}% + \let\@dtl@dosubstnext=\@dtl@dosubstitute + }% + \@dtl@dosubstnext{#1}{#2}% +} +\def\@dtl@dosubstitutenoop#1#2{} +\newif\if@dtl@condition +\newcount\@dtl@datatype +\newcommand{\@dtl@checknumerical}[1]{% + \@dtl@numgrpsepfalse + \def\@dtl@tmp{#1}% + \ifstrempty{#1}% + {% + \@dtl@datatype=0\relax + }% + {% + \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 + \ifdefempty{\@dtl@org@currency}% + {% + }% + {% + \let\@dtl@currency\@dtl@org@currency + }% + \expandafter\@dtl@checknumericalstart\@dtl@tmp\@nil\@nil + }% + \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\relax + \@dtl@checknumericalstart#2\@nil\@nil\relax +\else + \ifx-#1\relax + \def\@dtl@tmp{#2}% + \ifdefempty{\@dtl@tmp}% + {% + \@dtl@datatype=0\relax + }% + {% + \ifnum\@dtl@datatype=0\relax + \@dtl@datatype=1\relax + \fi + \@dtl@checknumericalstart#2\@nil\@nil\relax + }% + \else + \ifx+#1\relax + \def\@dtl@tmp{#2}% + \ifdefempty{\@dtl@tmp}% + {% + \@dtl@datatype=0\relax + }% + {% + \ifnum\@dtl@datatype=0\relax + \@dtl@datatype=1\relax + \fi + \@dtl@checknumericalstart#2\@nil\@nil\relax + }% + \else + \def\@dtl@tmp{#1}% + \ifx#1\$\relax + \@dtl@datatype=3\relax + \@dtl@checknumericalstart#2\@nil\@nil\relax + \else + \ifdefempty{\@dtl@tmp}% + {% + \@dtl@datatype=0\relax + }% + {% + \ifnum\@dtl@datatype=0\relax + \@dtl@datatype=1\relax + \fi + \@dtl@checknumericalloop#1#2\@nil\@nil\relax + }% + \fi + \fi + \fi +\fi +} +\newif\if@dtl@numgrpsep +\newcommand*{\@dtl@ifDigitOrDecimalSep}[3]{% + \ifnum 9<1\noexpand#1\relax + #2% + \else + \expandafter\ifx\@dtl@decimal#1\relax + #2% + \else + #3% + \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}% + \dtlifnumlt{\@dtl@numi}{\@dtl@numii}% + {% + #3% + }% + {% + #4% + }% +} +\newcommand*{\dtlcompare}[3]{% + \dtl@subnobrsp{#2}{\@dtl@argA}% + \dtl@subnobrsp{#3}{\@dtl@argB}% + \ifdefempty{\@dtl@argA}% + {% + \ifdefempty{\@dtl@argB}% + {% + #1=0\relax + }% + {% + #1=-1\relax + }% + }% + {% + \ifdefempty{\@dtl@argB}% + {% + #1=1\relax + }% + {% + \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 + \ifdefempty{\dtl@restA}% + {% + \ifdefempty{\dtl@restB}% + {% + #1=0\relax + }% + {% + #1=-1\relax + }% + }% + {% + \ifdefempty{\restB}% + {% + #1=1\relax + }% + {% + \protected@edef\dtl@donext{% + \noexpand\dtlcompare + {\noexpand#1}{\dtl@restA}{\dtl@restB}}% + \dtl@donext + }% + }% + \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 + }% + }% + }% +} +\def\dtl@getfirst#1#2\end{% + \def\dtl@first{#1}% + \ifdefempty{\dtl@first}% + {% + \def\dtl@rest{#2}% + }% + {% + \dtl@ifsingle{#1}{\def\dtl@rest{#2}}{\dtl@getfirst#1#2\end}% + }% +} +\newcount\dtl@codeA +\newcount\dtl@codeB +\newcommand*{\dtl@setcharcode}[2]{% + \ifstrempty{#1}% + {% + #2=-1\relax + }% + {% + \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 + }% +} +\newcommand*{\dtl@setlccharcode}[2]{% + \ifstrempty{#1}% + {% + #2=-1\relax + }% + {% + \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 + }% +} +\newcommand*{\dtlicompare}[3]{% + \dtl@subnobrsp{#2}{\@dtl@argA}% + \dtl@subnobrsp{#3}{\@dtl@argB}% + \ifdefempty{\@dtl@argA}% + {% + \ifdefempty{\@dtl@argB}% + {% + #1=0\relax + }% + {% + #1=-1\relax + }% + }% + {% + \ifdefempty{\@dtl@argB}% + {% + #1=1\relax + }% + {% + \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 + \ifdefempty{\dtl@restA}% + {% + \ifdefempty{\dtl@restB}% + {% + #1=0\relax + }% + {% + #1=-1\relax + }% + }% + {% + \ifdefempty{\restB}% + {% + #1=1\relax + }% + {% + \protected@edef\dtl@donext{% + \noexpand\dtlicompare + {\noexpand#1}{\dtl@restA}{\dtl@restB}}% + \dtl@donext + }% + }% + \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 + }% + }% + }% +} +\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}% + \dtlifnumgt{\@dtl@numi}{\@dtl@numii}% + {% + #3% + }% + {% + #4% + }% +} +\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}% + \dtlifnumeq{\@dtl@numi}{\@dtl@numii}% + {% + #3% + }% + {% + #4% + }% +} +\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}% + \ifdefempty{\@dtl@argB}% + {% + \@dtl@conditiontrue + }% + {% + \ifdefempty{\@dtl@argA}% + {% + \@dtl@conditionfalse + }% + {% + \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 + }% + }% +} +\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}% + \ifdefempty{\@dtl@argA}% + {% + \ifdefempty{\@dtl@argB}% + {% + \@dtl@conditiontrue + }% + {% + \@dtl@conditionfalse + }% + }% + {% + \ifdefempty{\@dtl@argB}% + {% + \@dtl@conditiontrue + }% + {% + \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}}% + }% + }% + }% +} +\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 +} +\let\DTLifFPopenbetween\dtlifnumopenbetween +\let\DTLifFPclosedbetween\dtlifnumclosedbetween +\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@testnumclosedbetween}[3]{% + \DTLifnumclosedbetween{#1}{#2}{#3}% + {\@dtl@conditiontrue}{\@dtl@conditionfalse}% +} +\newcommand*{\DTLisnumclosedbetween}[3]{% + \TE@throw\noexpand\dtl@testnumclosedbetween{#1}{#2}{#3}% + \noexpand\if@dtl@condition +} +\newcommand*{\dtl@testnumopenbetween}[3]{% + \DTLifnumopenbetween{#1}{#2}{#3}% + {\@dtl@conditiontrue}{\@dtl@conditionfalse}% +} +\newcommand*{\DTLisnumopenbetween}[3]{% + \TE@throw\noexpand\dtl@testnumopenbetween{#1}{#2}{#3}% + \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 +} +\let\DTLisFPclosedbetween\DTLisnumclosedbetween +\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]{% + \dtlifnumlt{#1}{#2}% + {% + \@dtl@conditiontrue + }% + {% + \@dtl@conditionfalse + }% +} +\newcommand*{\DTLisFPlt}[2]{% + \TE@throw\noexpand\dtl@testFPislt{#1}{#2}% + \noexpand\if@dtl@condition +} +\newcommand*{\dtl@testFPisgt}[2]{% + \dtlifnumgt{#1}{#2}% + {% + \@dtl@conditiontrue + }% + {% + \@dtl@conditionfalse + }% +} +\newcommand*{\DTLisFPgt}[2]{% + \TE@throw\noexpand\dtl@testFPisgt{#1}{#2}% + \noexpand\if@dtl@condition +} +\newcommand*{\dtl@testFPiseq}[2]{% + \dtlifnumeq{#1}{#2}% + {% + \@dtl@conditiontrue + }% + {% + \@dtl@conditionfalse + }% +} +\newcommand*{\DTLisFPeq}[2]{% + \TE@throw\noexpand\dtl@testFPiseq{#1}{#2}% + \noexpand\if@dtl@condition +} +\newcommand*{\dtl@testFPislteq}[2]{% + \dtlifnumlt{#1}{#2}% + {% + \@dtl@conditiontrue + }% + {% + \@dtl@conditionfalse + }% + \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]{% + \dtlifnumgt{#1}{#2}% + {% + \@dtl@conditiontrue + }% + {% + \@dtl@conditionfalse + }% + \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*{\dtlbreak}{% + \PackageError{datatool}{Can't break out of anything}{}% +} +\long\def\dtlforint#1=#2\to#3\step#4\do#5{% + \let\@dtl@orgbreak\dtlbreak + \def\@dtl@endloophook{}% + \def\dtlbreak{\def\@dtl@endloophook{#1=#3}}% + #1=#2\relax + \ifnum#4<0\relax + \whiledo{\(#1>#3\)\TE@or\(#1=#3\)}% + {% + #5% + \@dtl@endloophook + \advance#1 by #4\relax + }% + \else + \whiledo{\(#1<#3\)\TE@or\(#1=#3\)}% + {% + #5% + \@dtl@endloophook + \advance#1 by #4\relax + }% + \fi + \let\dtlbreak\@dtl@orgbreak +} +\newcount\@dtl@foreach@level +\long\def\dtlgforint#1=#2\to#3\step#4\do#5{% + \global#1=#2\relax + \global\advance\@dtl@foreach@level by 1\relax + \expandafter\global\expandafter + \let\csname @dtl@endhook@\the\@dtl@foreach@level\endcsname + \relax + \expandafter\global\expandafter + \let\csname @dtl@break@\the\@dtl@foreach@level\endcsname + \dtlbreak + \gdef\dtlbreak{\expandafter + \gdef\csname @dtl@endhook@\the\@dtl@foreach@level\endcsname{% + #1=#3}}% + \ifnum#4<0\relax + \whiledo{\(#1>#3\)\TE@or\(#1=#3\)}% + {% + #5% + \csname @dtl@endhook@\the\@dtl@foreach@level\endcsname + \global\advance#1 by #4\relax + }% + \else + \whiledo{\(#1<#3\)\TE@or\(#1=#3\)}% + {% + #5% + \csname @dtl@endhook@\the\@dtl@foreach@level\endcsname + \global\advance#1 by #4\relax + }% + \fi + \expandafter\global\expandafter\let\expandafter\dtlbreak + \csname @dtl@break@\the\@dtl@foreach@level\endcsname + \global\advance\@dtl@foreach@level by -1\relax +} +\newenvironment{dtlenvgforint}[1]% +{% + \def\@dtlenvgforint@arg{#1}% + \long@collect@body\@do@dtlenvgforint +}% +{} +\newcommand{\@do@dtlenvgforint}[1]{% + \expandafter\dtlgforint\@dtlenvgforint@arg\do{#1}% +} +\endinput +%% +%% End of file `datatool-base.sty'. diff --git a/Master/texmf-dist/tex/latex/datatool/datatool-fp.sty b/Master/texmf-dist/tex/latex/datatool/datatool-fp.sty new file mode 100644 index 00000000000..135d81f2c5b --- /dev/null +++ b/Master/texmf-dist/tex/latex/datatool/datatool-fp.sty @@ -0,0 +1,164 @@ +%% +%% This is file `datatool-fp.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% datatool.dtx (with options: `datatool-fp.sty,package') +%% +%% datatool.dtx +%% Copyright 2012 Nicola Talbot +%% +%% This work may be distributed and/or modified under the +%% conditions of the LaTeX Project Public License, either version 1.3 +%% of this license of (at your option) any later version. +%% The latest version of this license is in +%% http://www.latex-project.org/lppl.txt +%% and version 1.3 or later is part of all distributions of LaTeX +%% version 2005/12/01 or later. +%% +%% This work has the LPPL maintenance status `maintained'. +%% +%% The Current Maintainer of this work is Nicola Talbot. +%% +%% This work consists of the files datatool.dtx and datatool.ins and the derived files datatool-base.sty, datatool-fp.sty, datatool-pgfmath.sty, datatool.sty, databib.sty, databar.sty, datapie.sty, dataplot.sty, person.sty, databib.bst. +%% +%% \CharacterTable +%% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z +%% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z +%% Digits \0\1\2\3\4\5\6\7\8\9 +%% Exclamation \! Double quote \" Hash (number) \# +%% Dollar \$ Percent \% Ampersand \& +%% Acute accent \' Left paren \( Right paren \) +%% Asterisk \* Plus \+ Comma \, +%% Minus \- Point \. Solidus \/ +%% Colon \: Semicolon \; Less than \< +%% Equals \= Greater than \> Question mark \? +%% Commercial at \@ Left bracket \[ Backslash \\ +%% Right bracket \] Circumflex \^ Underscore \_ +%% Grave accent \` Left brace \{ Vertical bar \| +%% Right brace \} Tilde \~} +\NeedsTeXFormat{LaTeX2e} +\ProvidesPackage{datatool-fp}[2012/07/18 v2.10 (NLCT)] +\RequirePackage{xkeyval} +\RequirePackage{fp} +\RequirePackage{datatool-base} +\define@choicekey{datatool-fp}{verbose}[\val\nr]{true,false}[true]{% + \ifcase\nr\relax + \FPmessagestrue + \or + \FPmessagesfalse + \fi +} +\let\ifFPmessages\ifdtlverbose +\ProcessOptionsX +\providecommand*{\@dtl@mathprocessor}{fp} +\newcommand*{\dtlifnumeq}[4]{% + \FPifeq{#1}{#2}% + #3% + \else + #4% + \fi +} +\let\ifdtlverbose\ifFPmessages +\newcommand*{\dtlifnumlt}[4]{% + \FPiflt{#1}{#2}% + #3% + \else + #4% + \fi +} +\newcommand*{\dtlifnumgt}[4]{% + \FPifgt{#1}{#2}% + #3% + \else + #4% + \fi +} +\newcommand*{\dtlifnumopenbetween}[5]{% + \let\@dtl@dovalue\relax + \dtlifnumgt{#1}{#2}% + {}% + {% + \def\@dtl@dovalue{#5}% + }% + \dtlifnumlt{#1}{#3}% + {% + \ifx\@dtl@dovalue\relax + \def\@dtl@dovalue{#4}% + \fi + }% + {% + \def\@dtl@dovalue{#5}% + }% + \@dtl@dovalue +} +\newcommand*{\dtlifnumclosedbetween}[5]{% + \let\@dtl@dovalue\relax + \dtlifnumgt{#1}{#2}% + {}% + {% + \dtlifnumeq{#1}{#2}% + {% + \def\@dtl@dovalue{#4}% + }% + {% + \def\@dtl@dovalue{#5}% + }% + }% + \dtlifnumlt{#1}{#3}% + {% + \ifx\@dtl@dovalue\relax + \def\@dtl@dovalue{#4}% + \fi + }% + {% + \dtlifnumeq{#1}{#3}% + {% + \def\@dtl@dovalue{#4}% + }% + {% + \def\@dtl@dovalue{#5}% + }% + }% + \@dtl@dovalue +} +\newcommand*{\dtladd}[3]{% + \FPadd{#1}{#2}{#3}% +} +\newcommand*{\dtlsub}[3]{% + \FPsub{#1}{#2}{#3}% +} +\newcommand*{\dtlmul}[3]{% + \FPmul{#1}{#2}{#3}% +} +\newcommand*{\dtldiv}[3]{% + \FPdiv{#1}{#2}{#3}% +} +\newcommand*{\dtlroot}[2]{% + \FProot{#1}{#2}% +} +\newcommand*{\dtlround}[3]{% + \FPround{#1}{#2}{#3}% +} +\newcommand*{\dtltrunc}[3]{% + \FPtrunc{#1}{#2}{#3}% +} +\newcommand*{\dtlclip}[2]{% + \FPclip{#1}{#2}% +} +\newcommand*{\dtlmin}[3]{% + \FPmin{#1}{#2}{#3}% +} +\newcommand*{\dtlmax}[3]{% + \FPmax{#1}{#2}{#3}% +} +\newcommand*{\dtlabs}[2]{% + \FPabs{#1}{#2}% +} +\newcommand*{\dtlneg}[2]{% + \FPneg{#1}{#2}% +} +\endinput +%% +%% End of file `datatool-fp.sty'. diff --git a/Master/texmf-dist/tex/latex/datatool/datatool-pgfmath.sty b/Master/texmf-dist/tex/latex/datatool/datatool-pgfmath.sty new file mode 100644 index 00000000000..4da81dbc76f --- /dev/null +++ b/Master/texmf-dist/tex/latex/datatool/datatool-pgfmath.sty @@ -0,0 +1,121 @@ +%% +%% This is file `datatool-pgfmath.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% datatool.dtx (with options: `datatool-pgfmath.sty,package') +%% +%% datatool.dtx +%% Copyright 2012 Nicola Talbot +%% +%% This work may be distributed and/or modified under the +%% conditions of the LaTeX Project Public License, either version 1.3 +%% of this license of (at your option) any later version. +%% The latest version of this license is in +%% http://www.latex-project.org/lppl.txt +%% and version 1.3 or later is part of all distributions of LaTeX +%% version 2005/12/01 or later. +%% +%% This work has the LPPL maintenance status `maintained'. +%% +%% The Current Maintainer of this work is Nicola Talbot. +%% +%% This work consists of the files datatool.dtx and datatool.ins and the derived files datatool-base.sty, datatool-fp.sty, datatool-pgfmath.sty, datatool.sty, databib.sty, databar.sty, datapie.sty, dataplot.sty, person.sty, databib.bst. +%% +%% \CharacterTable +%% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z +%% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z +%% Digits \0\1\2\3\4\5\6\7\8\9 +%% Exclamation \! Double quote \" Hash (number) \# +%% Dollar \$ Percent \% Ampersand \& +%% Acute accent \' Left paren \( Right paren \) +%% Asterisk \* Plus \+ Comma \, +%% Minus \- Point \. Solidus \/ +%% Colon \: Semicolon \; Less than \< +%% Equals \= Greater than \> Question mark \? +%% Commercial at \@ Left bracket \[ Backslash \\ +%% Right bracket \] Circumflex \^ Underscore \_ +%% Grave accent \` Left brace \{ Vertical bar \| +%% Right brace \} Tilde \~} +\NeedsTeXFormat{LaTeX2e} +\ProvidesPackage{datatool-pgfmath}[2012/07/18 v2.10 (NLCT)] +\RequirePackage{xkeyval} +\RequirePackage{pgfrcs,pgfkeys,pgfmath} +\ProcessOptionsX +\providecommand*{\@dtl@mathprocessor}{pgfmath} +\newcommand*{\dtlifnumeq}[4]{% + \pgfmathifthenelse{#1==#2}{"#3"}{"#4"}% + \pgfmathresult +} +\RequirePackage{datatool-base} +\newcommand*{\dtlifnumlt}[4]{% + \pgfmathifthenelse{#1 < #2}{"#3"}{"#4"}% + \pgfmathresult +} +\newcommand*{\dtlifnumgt}[4]{% + \pgfmathifthenelse{#1 > #2}{"#3"}{"#4"}% + \pgfmathresult +} +\newcommand*{\dtlifnumopenbetween}[5]{% + \pgfmathifthenelse{(#2 < #1) && (#1 < #3)}{"#4"}{"#5"}% + \pgfmathresult +} +\newcommand*{\dtlifnumclosedbetween}[5]{% + \pgfmathifthenelse{(#2 <= #1) && (#1 <= #3)}{"#4"}{"#5"}% + \pgfmathresult +} +\newcommand*{\dtladd}[3]{% + \pgfmathadd{#2}{#3}% + \let#1\pgfmathresult +} +\newcommand*{\dtlsub}[3]{% + \pgfmathsubtract{#2}{#3}% + \let#1\pgfmathresult +} +\newcommand*{\dtlmul}[3]{% + \pgfmathmultiply{#2}{#3}% + \let#1\pgfmathresult +} +\newcommand*{\dtldiv}[3]{% + \pgfmathdivide{#2}{#3}% + \let#1\pgfmathresult +} +\newcommand*{\dtlroot}[2]{% + \pgfmathsqrt{#2}% + \let#1\pgfmathresult +} +\newcommand*{\dtlround}[3]{% + \pgfmathparse{10^#3}% + \let\dtl@tmpshift\pgfmathresult + \pgfmathparse{round(#2 * \dtl@tmpshift) / \dtl@tmpshift}% + \let#1\pgfmathresult +} +\newcommand*{\dtltrunc}[3]{% + \pgfmathparse{10^#3}% + \let\dtl@tmpshift\pgfmathresult + \pgfmathparse{floor(#2 * \dtl@tmpshift) / \dtl@tmpshift}% + \let#1\pgfmathresult +} +\newcommand*{\dtlclip}[2]{% + \edef#1{#2}% +} +\newcommand*{\dtlmin}[3]{% + \pgfmathmin{#2}{#3}% + \let#1\pgfmathresult +} +\newcommand*{\dtlmax}[3]{% + \pgfmathmax{#2}{#3}% + \let#1\pgfmathresult +} +\newcommand*{\dtlabs}[2]{% + \pgfmathabs{#2}% + \let#1\pgfmathresult +} +\newcommand*{\dtlneg}[2]{% + \pgfmathmul{-1}{#2}% + \let#1\pgfmathresult +} +\endinput +%% +%% End of file `datatool-pgfmath.sty'. diff --git a/Master/texmf-dist/tex/latex/datatool/datatool.sty b/Master/texmf-dist/tex/latex/datatool/datatool.sty index 8306dba927c..103f7daa59a 100644 --- a/Master/texmf-dist/tex/latex/datatool/datatool.sty +++ b/Master/texmf-dist/tex/latex/datatool/datatool.sty @@ -7,7 +7,7 @@ %% datatool.dtx (with options: `datatool.sty,package') %% %% datatool.dtx -%% Copyright 2009 Nicola Talbot +%% Copyright 2012 Nicola Talbot %% %% This work may be distributed and/or modified under the %% conditions of the LaTeX Project Public License, either version 1.3 @@ -21,7 +21,7 @@ %% %% 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, person.sty. +%% This work consists of the files datatool.dtx and datatool.ins and the derived files datatool-base.sty, datatool-fp.sty, datatool-pgfmath.sty, datatool.sty, databib.sty, databar.sty, datapie.sty, dataplot.sty, person.sty, databib.bst. %% %% \CharacterTable %% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z @@ -38,29 +38,23 @@ %% Right bracket \] Circumflex \^ Underscore \_ %% Grave accent \` Left brace \{ Vertical bar \| %% Right brace \} Tilde \~} -%% load student information from file "students.csv" -%% Iterate through the student database: -%% Define "anon": -%% Do the letter: -%% Undefine "anon": \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{datatool}[2009/11/15 v2.03 (NLCT)] +\ProvidesPackage{datatool}[2012/07/18 v2.10 (NLCT)] \RequirePackage{xkeyval} \RequirePackage{ifthen} \RequirePackage{xfor} -\RequirePackage{fp} \RequirePackage{substr} \RequirePackage{etex} \newcommand*{\@dtl@separator}{,} \newcommand*{\DTLsetseparator}[1]{% -\renewcommand*{\@dtl@separator}{#1}% -\@dtl@construct@lopoffs + \renewcommand*{\@dtl@separator}{#1}% + \@dtl@construct@lopoffs } \begingroup -\catcode`\ 12 +\catcode`\^^I12 \gdef\DTLsettabseparator{% - \catcode`\ 12 - \DTLsetseparator{ }% + \catcode`\^^I12 + \DTLsetseparator{^^I}% } \endgroup \begingroup @@ -68,1300 +62,61 @@ \gdef\@dtl@delimiter{"} \endgroup \newcommand*\DTLsetdelimiter[1]{% -\renewcommand*{\@dtl@delimiter}{#1}% -\@dtl@construct@lopoffs} + \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 -}} + \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}% -}} + \noexpand\long + \noexpand\def\noexpand\@dtl@qlopoff#1#2##1#2#1##2\noexpand\to##3##4{% + \noexpand\def##4{##1}% + \noexpand\DTLsubstituteall{##4}{#2#2}{#2}% + \noexpand\edef\noexpand\@dtl@dosubs{% + \noexpand\noexpand\noexpand\DTLsubstituteall{\noexpand\noexpand##4}% + {\noexpand\expandafter\noexpand\noexpand\noexpand\csname#2\noexpand\endcsname#2}% + {\noexpand\expandafter\noexpand\noexpand\noexpand\csname#2\noexpand\endcsname}% + }% + \noexpand\@dtl@dosubs + \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 + \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}% + }% } -\def\@dtl@get@next@intpart#1.\relax{% -\edef\@dtl@intpart{\@dtl@intpart#1}% +\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@choptrailingzeroes}[1]{% -\def\@dtl@tmpcpz{}% -\expandafter\@dtl@chop@trailingzeroes#1\@nil% -\let#1=\@dtl@tmpcpz +\define@key{datatool.sty}{separator}{% + \DTLsetseparator{#1}% } -\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 -}% +\define@key{datatool.sty}{delimiter}{% + \DTLsetdelimiter{#1}% } -\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 +\define@boolkey{datatool.sty}[dtl]{verbose}[true]{} +\define@choicekey{datatool.sty}{math}[\val\nr]{fp,pgfmath}{% + \renewcommand*\@dtl@mathprocessor{#1}% } -\@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} +\newcommand*{\@dtl@mathprocessor}{fp} \ProcessOptionsX +\@dtl@construct@lopoffs +\RequirePackage{datatool-base} \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]{% - \PackageError{datatool}{\string\DTLiffirstrow\space can only - be used inside \string\DTLforeach}{}% -} -\newcommand{\DTLiflastrow}[2]{% - \PackageError{datatool}{\string\DTLiflastrow\space can only - be used inside \string\DTLforeach}{}% -} -\newcommand{\DTLifoddrow}[2]{% - \PackageError{datatool}{\string\DTLifoddrow\space can only - be used inside \string\DTLforeach}{}% -} -\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}% {% @@ -1410,9 +165,11 @@ }% } \newcommand*{\DTLrowcount}[1]{% -\expandafter\number\csname dtlrows@#1\endcsname} + \expandafter\number\csname dtlrows@#1\endcsname +} \newcommand*{\DTLcolumncount}[1]{% -\expandafter\number\csname dtlcols@#1\endcsname} + \expandafter\number\csname dtlcols@#1\endcsname +} \newcommand{\DTLifdbempty}[3]{% \DTLifdbexists{#1}% {\@DTLifdbempty{#1}{#2}{#3}}% @@ -1531,10 +288,10 @@ \db@col@id@w #3\db@col@id@end@% index \db@plist@elt@end@% end of block ##5\q@nil{\def#1{##2}}% - \edef\@dtl@tmp{\expandafter\the\csname dtldb@#2\endcsname}% - \expandafter\@dtl@getkeyforcolumn\@dtl@tmp + \edef\@dtl@tmp{\expandafter\the\csname dtlkeys@#2\endcsname}% + \expandafter\@dtl@get@keyforcolumn\@dtl@tmp \db@plist@elt@w% start of block - \db@col@id@w #3\db@col@id@end@ index + \db@col@id@w #3\db@col@id@end@ %index \db@key@id@w \@nil\db@key@id@end@% key \db@type@id@w \db@type@id@end@% data type \db@header@id@w \db@header@id@end@% header @@ -1617,14 +374,17 @@ {\noexpand\@dtl@after}{\the\csname dtlkeys@#1\endcsname}% {\number\dtlcolumnnum}} \@dtl@dogetprops - \def\@dtl@tmp{#3}% - \ifx\@dtl@tmp\@empty - \else + \ifstrempty{#3}% + {% + }% + {% \let\@dtl@oldtype\@dtl@type \@dtl@checknumerical{#3}% - \ifx\@dtl@type\@empty + \ifdefempty{\@dtl@type}% + {% \edef\@dtl@type{\number\@dtl@datatype}% - \else + }% + {% \ifcase\@dtl@datatype % string \def\@dtl@type{0}% \or % int @@ -1637,7 +397,7 @@ \def\@dtl@type{3}% \fi \fi - \fi + }% \ifx\@dtl@oldtype\@dtl@type \else \toks@gconcat@middle@cx{dtlkeys@#1}% @@ -1657,7 +417,7 @@ }% {\@dtl@after}% \fi - \fi + }% }% {% \expandafter\global\expandafter\advance @@ -1665,13 +425,14 @@ \dtlcolumnnum=\csname dtlcols@#1\endcsname\relax \expandafter\xdef\csname dtl@ci@#1@#2\endcsname{% \number\dtlcolumnnum}% - \def\@dtl@tmp{#3}% - \ifx\@dtl@tmp\@empty + \ifstrempty{#2}% + {% \edef\@dtl@type{}% don't know data type yet - \else + }% + {% \@dtl@checknumerical{#3}% \edef\@dtl@type{\number\@dtl@datatype}% - \fi + }% \toks@gput@right@cx{dtlkeys@#1}% {% \noexpand\db@plist@elt@w @@ -1792,6 +553,12 @@ } \newcommand{\DTLifdbexists}[3]{% \@ifundefined{dtldb@#1}{#3}{#2}} +\newcommand*{\DTLassign}[3]{% + {% + \dtlgetrow{#1}{#2}% + \@dtl@assign{#3}{#1}% + }% +} \newcommand*{\@dtl@assign}[2]{% \@dtl@assigncmd#1,\@nil\@@{#2}% } @@ -1896,6 +663,8 @@ \newtoks\dtlbeforerow \newtoks\dtlafterrow \newcommand*{\dtlgetrow}[2]{% + \dtlrownum=#2\relax + \edef\dtldbname{#1}% \expandafter\toks@\expandafter=\csname dtldb@#1\endcsname \edef\@dtl@dogetrow{\noexpand\@dtlgetrow{\the\toks@}{\number#2}}% \@dtl@dogetrow @@ -1911,6 +680,86 @@ \q@nil{\dtlbeforerow={##1}\dtlcurrentrow={##2}\dtlafterrow={##3}}% \@dtl@getrow#1\q@nil } +\newcommand*{\dtlrecombine}{% + \toks@gconcat@middle@cx{dtldb@\dtldbname}% + {\dtlbeforerow}% + {% + \noexpand\db@row@elt@w + \noexpand\db@row@id@w + \number\dtlrownum + \noexpand\db@row@id@end@ + \the\dtlcurrentrow + \noexpand\db@row@id@w + \number\dtlrownum + \noexpand\db@row@id@end@ + \noexpand\db@row@elt@end@ + }% + {\dtlafterrow}% +} +\newcommand{\dtlrecombineomitcurrent}{% + \dtl@decrementrows{\dtlafterrow}{\dtlrownum} + \csname dtldb@\dtldbname\endcsname=\dtlbeforerow + \toks@gput@right@cx{dtldb@\dtldbname}{\the\dtlafterrow}% + \dtl@message{Removed row \number\dtlrownum\space in database + `\dtldbname'}% +} +\newcommand*{\dtlsplitrow}[4]{% + \def\@dtlsplitrow##1%before stuff + \db@col@id@w #2\db@col@id@end@% column id + ##2% unwanted stuff + \db@col@id@w #2\db@col@id@end@% column id + ##3% after stuff + \q@nil{\def#3{##1}\def#4{##3}}% + \@dtlsplitrow#1\q@nil +} +\newcommand*{\dtlreplaceentryincurrentrow}[2]{% + \edef\@dtl@do@splitrow{\noexpand\dtlsplitrow + {\the\dtlcurrentrow}% + {\number#2}% + {\noexpand\@dtl@before@cs}% + {\noexpand\@dtl@after@cs}}% + \@dtl@do@splitrow + \toks@{#1}% + \edef\@dtl@stuff{% + \expandonce\@dtl@before@cs + \noexpand\db@col@id@w \number#2\noexpand + \noexpand\db@col@id@end@% column id + \noexpand\db@col@elt@w + \the\toks@ + \noexpand\db@col@elt@end@ + \noexpand\db@col@id@w \number#2\noexpand + \noexpand\db@col@id@end@% column id + \expandonce\@dtl@after@cs + }% + \expandafter\dtlcurrentrow\expandafter{\@dtl@stuff}% + \@sdtlgetkeyforcolumn{\@dtl@key}{\dtldbname}{#2}% + \@dtl@updatekeys{\dtldbname}{\@dtl@key}{#1}% + \dtl@message{Updated \@dtl@key\space -> #1\space in database + `\dtldbname'}% +} +\newcommand*{\dtlremoveentryincurrentrow}[1]{% + \edef\@dtl@do@splitrow{\noexpand\dtlsplitrow + {\the\dtlcurrentrow}% + {\number#1}% + {\noexpand\@dtl@before@cs}% + {\noexpand\@dtl@after@cs}}% + \@dtl@do@splitrow + \edef\@dtl@stuff{% + \expandonce\@dtl@before@cs + \expandonce\@dtl@after@cs + }% + \expandafter\dtlcurrentrow\expandafter{\@dtl@stuff}% + \dtl@message{Removed entry from column \number#1\space\space in database + `\dtldbname'}% +} +\newcommand*{\dtlswapentriesincurrentrow}[2]{% + \dtlgetentryfromcurrentrow{\@dtl@entryI}{#1}% + \dtlgetentryfromcurrentrow{\@dtl@entryII}{#2}% + \expandafter\dtlreplaceentryincurrentrow\expandafter + {\@dtl@entryII}{#1}% + \expandafter\dtlreplaceentryincurrentrow\expandafter + {\@dtl@entryI}{#2}% +} \newcommand*{\dtlgetentryfromcurrentrow}[2]{% \dtlgetentryfromrow{#1}{#2}{\dtlcurrentrow}% } @@ -1932,6 +781,36 @@ \db@col@id@w #2\db@col@id@end@% \q@nil } +\newcommand*{\dtlappendentrytocurrentrow}[2]{% + \@dtl@updatekeys{\dtldbname}{#1}{#2}% + \expandafter\dtlcolumnnum\expandafter + =\dtlcolumnindex{\dtldbname}{#1}\relax + \edef\dtl@dogetentry{\noexpand\dtlgetentryfromcurrentrow + {\noexpand\dtl@entry}{\number\dtlcolumnnum}% + }% + \dtl@dogetentry + \ifx\dtl@entry\dtlnovalue + \protected@edef\@dtl@tmp{#2}% + \expandafter\@dtl@toks\expandafter{\@dtl@tmp}% + \toks@gput@right@cx{dtlcurrentrow}% + {% + \noexpand\db@col@id@w + \number\dtlcolumnnum + \noexpand\db@col@id@end@ + \noexpand\db@col@elt@w + \the\@dtl@toks + \noexpand\db@col@elt@end@ + \noexpand\db@col@id@w + \number\dtlcolumnnum + \noexpand\db@col@id@end@ + }% + \dtl@message{Appended #1\space -> #2\space to database + `\dtldbname'}% + \else + \PackageError{datatool}{Can't append entry to row: + there is already an entry for key `#1' in this row}{}% + \fi +} \newcommand*{\DTLgetvalue}[4]{% \edef\dtl@dogetvalue{\noexpand\dtl@getvalue{\noexpand#1}{#2}% {\number#3}{\number#4}}% @@ -1976,63 +855,6 @@ \fi } -\newcommand*{\dtlbreak}{% - \PackageError{datatool}{Can't break out of anything}{}% -} -\long\def\dtlforint#1=#2\to#3\step#4\do#5{% - \let\@dtl@orgbreak\dtlbreak - \def\@dtl@endloophook{}% - \def\dtlbreak{\def\@dtl@endloophook{#1=#3}}% - #1=#2\relax - \ifnum#4<0\relax - \whiledo{\(#1>#3\)\TE@or\(#1=#3\)}% - {% - #5% - \@dtl@endloophook - \advance#1 by #4\relax - }% - \else - \whiledo{\(#1<#3\)\TE@or\(#1=#3\)}% - {% - #5% - \@dtl@endloophook - \advance#1 by #4\relax - }% - \fi - \let\dtlbreak\@dtl@orgbreak -} -\newcount\@dtl@foreach@level -\long\def\dtlgforint#1=#2\to#3\step#4\do#5{% - \global#1=#2\relax - \global\advance\@dtl@foreach@level by 1\relax - \expandafter\global\expandafter - \let\csname @dtl@endhook@\the\@dtl@foreach@level\endcsname - \relax - \expandafter\global\expandafter - \let\csname @dtl@break@\the\@dtl@foreach@level\endcsname - \dtlbreak - \gdef\dtlbreak{\expandafter - \gdef\csname @dtl@endhook@\the\@dtl@foreach@level\endcsname{% - #1=#3}}% - \ifnum#4<0\relax - \whiledo{\(#1>#3\)\TE@or\(#1=#3\)}% - {% - #5% - \csname @dtl@endhook@\the\@dtl@foreach@level\endcsname - \global\advance#1 by #4\relax - }% - \else - \whiledo{\(#1<#3\)\TE@or\(#1=#3\)}% - {% - #5% - \csname @dtl@endhook@\the\@dtl@foreach@level\endcsname - \global\advance#1 by #4\relax - }% - \fi - \expandafter\global\expandafter\let\expandafter\dtlbreak - \csname @dtl@break@\the\@dtl@foreach@level\endcsname - \global\advance\@dtl@foreach@level by -1\relax -} \long\def\@dtlforeachrow(#1,#2)\in#3\do#4{% \edef\dtl@tmp{\expandafter\the\csname dtldb@#3\endcsname}% \expandafter\@dtl@foreachrow\dtl@tmp @@ -2240,6 +1062,24 @@ \csname c@DTLrow\romannumeral\@dtl@tmpcount\endcsname}% \fi \fi} +\newenvironment{DTLenvforeach}[3][\boolean{true}]% +{% + \def\@dtlenvforeach@args{[#1]{#2}{#3}}% + \long@collect@body\@do@dtlenvforeach +}% +{} +\newcommand{\@do@dtlenvforeach}[1]{% + \expandafter\@DTLforeach\@dtlenvforeach@args{#1}% +} +\newenvironment{DTLenvforeach*}[3][\boolean{true}]% +{% + \def\s@dtlenvforeach@args{[#1]{#2}{#3}}% + \long@collect@body\@do@sdtlenvforeach +}% +{} +\newcommand{\@do@sdtlenvforeach}[1]{% + \expandafter\@sDTLforeach\s@dtlenvforeach@args{#1}% +} \newcommand*{\DTLforeach}{\@ifstar\@sDTLforeach\@DTLforeach} \newcommand{\@DTLforeach}[4][\boolean{true}]{% \DTLifdbexists{#2}% @@ -2725,6 +1565,18 @@ }% \fi } +\newcommand{\DTLiffirstrow}[2]{% + \PackageError{datatool}{\string\DTLiffirstrow\space can only + be used inside \string\DTLforeach}{}% +} +\newcommand{\DTLiflastrow}[2]{% + \PackageError{datatool}{\string\DTLiflastrow\space can only + be used inside \string\DTLforeach}{}% +} +\newcommand{\DTLifoddrow}[2]{% + \PackageError{datatool}{\string\DTLifoddrow\space can only + be used inside \string\DTLforeach}{}% +} \newcommand*{\dtlbetweencols}{} \newcommand*{\dtlbeforecols}{} \newcommand*{\dtlaftercols}{} @@ -2738,9 +1590,11 @@ \else \protected@edef#1{#1\dtlbetweencols}% \fi - \ifx\@empty#2\@empty + \ifstrempty{#2}% + {% \protected@edef#1{#1c}% - \else + }% + {% \ifcase#2\relax \protected@edef#1{#1\dtlstringalign}% \or @@ -2753,7 +1607,7 @@ \protected@edef#1{#1c}% \PackageError{datatool}{Unknown data type `#2'}{}% \fi - \fi + }% \ifnum#3=#4\relax \protected@edef#1{#1\dtlaftercols}% \fi @@ -2768,49 +1622,64 @@ \newcommand*{\dtldisplayafterhead}{} \newcommand*{\dtldisplaystartrow}{} -\newcommand*{\DTLdisplaydb}[1]{% +\newcommand*{\DTLdisplaydb}[2][]{% \def\@dtl@doamp{\gdef\@dtl@doamp{&}} \def\@dtl@resetdoamp{\gdef\@dtl@doamp{\gdef\@dtl@doamp{&}}} \edef\@dtl@maxcols{\expandafter\number - \csname dtlcols@#1\endcsname}% + \csname dtlcols@#2\endcsname}% + \DTLnumitemsinlist{#1}{\@dtl@tmp}% + \dtlsub{\@dtl@maxcols}{\@dtl@maxcols}{\@dtl@tmp}% + \dtlclip{\@dtl@maxcols}{\@dtl@maxcols}% \def\@dtl@tabargs{}% \dtlforeachkey(\@dtl@key,\@dtl@idx,\@dtl@type,\@dtl@head)% - \in{#1}\do + \in{#2}\do {% - \dtladdalign\@dtl@tabargs\@dtl@type\@dtl@idx\@dtl@maxcols + \expandafter\DTLifinlist\expandafter{\@dtl@key}{#1}% + {}% + {% + \dtladdalign\@dtl@tabargs\@dtl@type\@dtl@idx\@dtl@maxcols + } }% \edef\@dtl@dobegintab{\noexpand\begin{tabular}{\@dtl@tabargs}}% \@dtl@dobegintab \dtldisplaystarttab \@dtl@resetdoamp \dtlforeachkey(\@dtl@key,\@dtl@idx,\@dtl@type,\@dtl@head)% - \in{#1}\do + \in{#2}\do {% - \@dtl@doamp - \dtlheaderformat{\@dtl@head}% + \expandafter\DTLifinlist\expandafter{\@dtl@key}{#1}% + {}% + {% + \@dtl@doamp + \dtlheaderformat{\@dtl@head}% + }% }% \\% \dtldisplayafterhead \@dtl@resetdoamp - \DTLforeach*{#1}{}{% + \@sDTLforeach{#2}{}{% \DTLiffirstrow{}{\\\dtldisplaystartrow}% \@dtl@resetdoamp \DTLforeachkeyinrow{\@dtl@val}% {% - \global\let\@dtl@val\@dtl@val - \@dtl@doamp - \@dtl@datatype=0\dtltype\relax - \ifcase\@dtl@datatype - \dtlstringformat\@dtl@val - \or - \dtlintformat\@dtl@val - \or - \dtlrealformat\@dtl@val - \or - \dtlcurrencyformat\@dtl@val - \else - \@dtl@val - \fi + \expandafter\DTLifinlist\expandafter{\dtlkey}{#1}% + {}% + {% + \global\let\@dtl@val\@dtl@val + \@dtl@doamp + \@dtl@datatype=0\dtltype\relax + \ifcase\@dtl@datatype + \dtlstringformat\@dtl@val + \or + \dtlintformat\@dtl@val + \or + \dtlrealformat\@dtl@val + \or + \dtlcurrencyformat\@dtl@val + \else + \@dtl@val + \fi + }% }% }% \dtldisplayendtab @@ -2822,6 +1691,7 @@ \define@key{displaylong}{label}{\def\@dtl@label{#1}} \define@key{displaylong}{foot}{\def\@dtl@foot{#1}} \define@key{displaylong}{lastfoot}{\def\@dtl@lastfoot{#1}} +\define@key{displaylong}{omit}{\def\@dtl@omitlist{#1}} \newcommand*{\@dtl@resetdostartrow}{% \gdef\@dtl@dostartrow{% \gdef\@dtl@dostartrow{\\\dtldisplaystartrow}}% @@ -2833,17 +1703,25 @@ \def\@dtl@shortcap{\@dtl@cap}% \def\@dtl@foot{\@nil}% \def\@dtl@lastfoot{\@nil}% + \def\@dtl@omitlist{}% \setkeys{displaylong}{#1}% \def\@dtl@doamp{\gdef\@dtl@doamp{&}} \def\@dtl@resetdoamp{\gdef\@dtl@doamp{\gdef\@dtl@doamp{&}}} \@dtl@resetdostartrow \edef\@dtl@maxcols{\expandafter\number \csname dtlcols@#2\endcsname}% + \DTLnumitemsinlist{\@dtl@omitlist}{\@dtl@tmp}% + \dtlsub{\@dtl@maxcols}{\@dtl@maxcols}{\@dtl@tmp}% + \dtlclip{\@dtl@maxcols}{\@dtl@maxcols}% \def\@dtl@tabargs{}% \dtlforeachkey(\@dtl@key,\@dtl@idx,\@dtl@type,\@dtl@head)% \in{#2}\do {% - \dtladdalign\@dtl@tabargs\@dtl@type\@dtl@idx\@dtl@maxcols + \expandafter\DTLifinlist\expandafter{\@dtl@key}{\@dtl@omitlist}% + {}% + {% + \dtladdalign\@dtl@tabargs\@dtl@type\@dtl@idx\@dtl@maxcols + }% }% \edef\@dtl@dobegintab{\noexpand\begin{longtable}{\@dtl@tabargs}}% \@dtl@dobegintab @@ -2860,7 +1738,13 @@ \@dtl@resetdoamp \dtlforeachkey(\@dtl@key,\@dtl@idx,\@dtl@type,\@dtl@head)% \in{#2}\do - {\@dtl@doamp{\dtlheaderformat{\@dtl@head}}}% + {% + \expandafter\DTLifinlist\expandafter{\@dtl@key}{\@dtl@omitlist}% + {}% + {% + \@dtl@doamp{\dtlheaderformat{\@dtl@head}}% + }% + }% \@dtl@resetdoamp \@dtl@resetdostartrow \endhead\dtldisplayafterhead @@ -2874,7 +1758,13 @@ \@dtl@resetdoamp \dtlforeachkey(\@dtl@key,\@dtl@idx,\@dtl@type,\@dtl@head)% \in{#2}\do - {\@dtl@doamp{\dtlheaderformat{\@dtl@head}}}% + {% + \expandafter\DTLifinlist\expandafter{\@dtl@key}{\@dtl@omitlist}% + {}% + {% + \@dtl@doamp{\dtlheaderformat{\@dtl@head}}% + }% + }% \@dtl@resetdoamp \@dtl@resetdostartrow \endfirsthead @@ -2887,28 +1777,38 @@ \@dtl@resetdoamp \dtlforeachkey(\@dtl@key,\@dtl@idx,\@dtl@type,\@dtl@head)% \in{#2}\do - {\@dtl@doamp{\dtlheaderformat{\@dtl@head}}}% + {% + \expandafter\DTLifinlist\expandafter{\@dtl@key}{\@dtl@omitlist}% + {}% + {% + \@dtl@doamp{\dtlheaderformat{\@dtl@head}}% + }% + }% \@dtl@resetdoamp \@dtl@resetdostartrow \endhead\dtldisplayafterhead \fi - \DTLforeach*{#2}{}{% + \@sDTLforeach{#2}{}{% \@dtl@dostartrow \@dtl@resetdoamp \DTLforeachkeyinrow{\@dtl@val}% {% \global\let\@dtl@val\@dtl@val - \@dtl@doamp - \@dtl@datatype=0\dtltype\relax - \ifcase\@dtl@datatype - \dtlstringformat\@dtl@val - \or - \dtlintformat\@dtl@val - \or - \dtlrealformat\@dtl@val - \or - \dtlcurrencyformat\@dtl@val - \fi + \expandafter\DTLifinlist\expandafter{\dtlkey}{\@dtl@omitlist}% + {}% + {% + \@dtl@doamp + \@dtl@datatype=0\dtltype\relax + \ifcase\@dtl@datatype + \dtlstringformat\@dtl@val + \or + \dtlintformat\@dtl@val + \or + \dtlrealformat\@dtl@val + \or + \dtlcurrencyformat\@dtl@val + \fi + }% }% }% \dtldisplayendtab @@ -3116,7 +2016,6 @@ }% }% \ifnum\@dtl@elements=0\relax - \PackageError{datatool}{Unable to evaluate mean: no data}{}% \else \edef\@dtl@n{\number\@dtl@elements}% \DTLdiv{#4}{#4}{\@dtl@n}% @@ -3249,11 +2148,13 @@ \dtlgetentryfromrow{\DTLthisval}{\@dtl@col}{\dtlcurrentrow}% \expandafter\ifthenelse\expandafter{\@dtl@cond}% {% - \ifx#4\@empty + \ifstrempty{#4}% + {% \let#4\DTLthisval - \else + }% + {% \DTLmin{#4}{#4}{\DTLthisval}% - \fi + }% }{}% }% }% @@ -3267,11 +2168,13 @@ {% \@sdtlforcolumn{\DTLthisval}{#1}{#2}% {% - \ifx#3\@empty + \ifdefempty{#3}% + {% \let#3\DTLthisval - \else + }% + {% \DTLmin{#3}{#3}{\DTLthisval}% - \fi + }% }% }% {% @@ -3301,11 +2204,13 @@ \dtlgetentryfromrow{\DTLthisval}{\@dtl@col}{\dtlcurrentrow}% \expandafter\ifthenelse\expandafter{\@dtl@cond}% {% - \ifx#4\@empty + \ifdefempty{#4}% + {% \let#4\DTLthisval - \else + }% + {% \DTLmax{#4}{#4}{\DTLthisval}% - \fi + }% }{}% }% }% @@ -3319,11 +2224,13 @@ {% \@sdtlforcolumn{\DTLthisval}{#1}{#2}% {% - \ifx#3\@empty + \ifdefempty{#3}% + {% \let#3\DTLthisval - \else + }% + {% \DTLmax{#3}{#3}{\DTLthisval}% - \fi + }% }% }% {% @@ -3343,18 +2250,18 @@ \let#8=\relax \@for\dtl@thisdb:=#2\do{% \@sDTLforeach[#1]{\dtl@thisdb}{\DTLthisX=#3,\DTLthisY=#4}{% - \DTLconverttodecimal{\DTLthisX}{\dtl@decx}% - \DTLconverttodecimal{\DTLthisY}{\dtl@decy}% + \expandafter\DTLconverttodecimal\expandafter{\DTLthisX}{\dtl@decx}% + \expandafter\DTLconverttodecimal\expandafter{\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}% + \dtlmin{#5}{#5}{\dtl@decx}% + \dtlmin{#6}{#6}{\dtl@decy}% + \dtlmax{#7}{#7}{\dtl@decx}% + \dtlmax{#8}{#8}{\dtl@decy}% \fi }% }% @@ -3385,15 +2292,6 @@ }% }% } -\newcommand*{\dtlsplitrow}[4]{% - \def\@dtlsplitrow##1%before stuff - \db@col@id@w #2\db@col@id@end@% column id - ##2% unwanted stuff - \db@col@id@w #2\db@col@id@end@% column id - ##3% after stuff - \q@nil{\def#3{##1}\def#4{##3}}% - \@dtlsplitrow#1\q@nil -} \newtoks\@dtl@list \newcommand*{\DTLsort}{\@ifstar\@sDTLsort\@DTLsort} \newcommand{\@DTLsort}[3][]{% @@ -3551,9 +2449,11 @@ \def\@dtl@getsortdirection#1=#2\relax{% \def\@dtl@key{#1}% \def\@dtl@sortdirection{#2}% - \ifx\@dtl@sortdirection\@empty + \ifdefempty{\@dtl@sortdirection}% + {% \def\@dtl@sortdirection{-1}% - \else + }% + {% \@dtl@get@sortdirection#2% \def\@dtl@dir{ascending}% \ifx\@dtl@sortdirection\@dtl@dir @@ -3569,12 +2469,11 @@ \def\@dtl@sortdirection{-1} \fi \fi - \fi + }% } \def\@dtl@get@sortdirection#1={\def\@dtl@sortdirection{#1}} \newtoks\@dtl@toksA \newtoks\@dtl@toksB -\newtoks\@dtl@toks \newcommand{\dtl@compare}[3]{% \dtl@compare@{#1}{#1}{#2}{#3}% } @@ -3633,24 +2532,28 @@ {% \IfSubStringInString{\@dtl@separator}{\@dtl@key}% {% - \ifx\@dtl@header\@empty + \ifdefempty{\@dtl@header}% + {% \protected@edef\@dtl@header{% \@dtl@delimiter\@dtl@key\@dtl@delimiter}% - \else + }% + {% \toks@=\expandafter{\@dtl@header}% \protected@edef\@dtl@header{% \the\toks@\@dtl@separator \@dtl@delimiter\@dtl@key\@dtl@delimiter}% - \fi + }% }% {% - \ifx\@dtl@header\@empty + \ifdefempty{\@dtl@header}% + {% \protected@edef\@dtl@header{\@dtl@key}% - \else + }% + {% \toks@=\expandafter{\@dtl@header}% \protected@edef\@dtl@header{\the\toks@ \@dtl@separator\@dtl@key}% - \fi + }% }% }% \protected@write\@dtl@write{}{\@dtl@header}% @@ -3661,23 +2564,27 @@ {% \IfSubStringInString{\@dtl@separator}{\@dtl@val}% {% - \ifx\@dtl@row\@empty + \ifdefempty{\@dtl@row}% + {% \protected@edef\@dtl@row{% \@dtl@delimiter\@dtl@val\@dtl@delimiter}% - \else + }% + {% \toks@=\expandafter{\@dtl@row}% \protected@edef\@dtl@row{\the\toks@\@dtl@separator \@dtl@delimiter\@dtl@val\@dtl@delimiter}% - \fi + }% }% {% - \ifx\@dtl@row\@empty + \ifdefempty{\@dtl@row}% + {% \protected@edef\@dtl@row{\@dtl@val}% - \else + }% + {% \toks@=\expandafter{\@dtl@row}% \protected@edef\@dtl@row{\the\toks@\@dtl@separator \@dtl@val}% - \fi + }% }% }% \protected@write\@dtl@write{}{\@dtl@row}% @@ -3719,7 +2626,6 @@ database}{}% }% } -\newcommand{\@longempty}{} \newread\@dtl@read \newcount\dtl@entrycr \define@boolkey{loaddb}[dtl]{noheader}[true]{} @@ -3744,17 +2650,23 @@ \the\toks@}% }% } +\newcount{\dtl@omitlines} +\define@key{loaddb}{omitlines}{\dtl@omitlines=#1\relax} \newcommand*{\dtldefaultkey}{Column} \newcommand*{\@dtl@readline}[2]{% \read#1 to #2% - \dtl@trim#2% + \ifdefempty{#2}% + {% + }% + {% + \dtl@trim#2% + } } \newcommand*{\@dtl@readrawline}[2]{% \@dtl@rawread#1 to #2% \dtl@trim#2% \dtl@domappings\@dtl@line } - \newcommand*{\DTLloaddb}{% \let\@dtl@doreadline\@dtl@readline \@dtlloaddb @@ -3767,6 +2679,11 @@ \setkeys{loaddb}{#1}% \openin\@dtl@read=#3% \dtl@message{Reading `#3'}% + \loop + \ifnum \dtl@omitlines > \z@ + \advance\dtl@omitlines by \m@ne + \read\@dtl@read to \@dtl@line + \repeat \DTLnewdb{#2}% \ifeof\@dtl@read \PackageWarning{datatool}{File `#3' has no data}% @@ -3778,9 +2695,12 @@ \ifeof\@dtl@read \else \@dtl@doreadline\@dtl@read\@dtl@line - \ifx\@dtl@line\@longempty + \ifdefempty{\@dtl@line}% + {% \@dtl@conditiontrue - \fi + }% + {% + }% \fi \if@dtl@condition \repeat @@ -3790,6 +2710,11 @@ \loop \expandafter\@dtl@lopoff\@dtl@lin@\to\@dtl@lin@\@dtl@key \advance\dtl@entrycr by 1\relax + \ifdefempty{\@dtl@key}% + {% + \edef\@dtl@key{\dtldefaultkey\number\dtl@entrycr}% + }% + {}% \expandafter\@dtl@toks\expandafter{\@dtl@key}% \@ifundefined{@dtl@inky@\romannumeral\dtl@entrycr}% {% @@ -3824,8 +2749,10 @@ \@dtl@conditiontrue \loop \@dtl@doreadline\@dtl@read\@dtl@line - \ifx\@dtl@line\@longempty - \else + \ifdefempty{\@dtl@line}% + {% + }% + {% \@sDTLnewrow{#2}% \expandafter\@dtl@toks\expandafter{\@dtl@line}% \edef\@dtl@lin@{\@dtl@separator\the\@dtl@toks @@ -3860,7 +2787,7 @@ \if@dtl@condition \repeat }% - \fi + }% \ifeof\@dtl@read \@dtl@conditionfalse\fi \if@dtl@condition \repeat @@ -3889,17 +2816,23 @@ }% } \newcommand{\dtl@trim}[1]{% -\def\@dtl@trmstr{}% -\expandafter\@dtl@starttrim#1\@nil% -\let#1=\@dtl@trmstr + \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% + \def\@dtl@tmpB{#2}% + \ifx\par#1% + \def\@dtl@dotrim{\@dtl@trim{} #2}% + \else + \ifx\@dtl@tmpB\@nnil + \def\@dtl@dotrim{}% + \def\@dtl@trmstr{#1}% + \else + \def\@dtl@dotrim{\@dtl@trim#1#2}% + \fi + \fi + \@dtl@dotrim } \long\def\@dtl@trim#1 \@nil{\long\def\@dtl@trmstr{#1}} \newcommand*\DTLloadrawdb{% @@ -3956,793 +2889,28 @@ >% \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 + \expandafter\@dtl@toks\expandafter{\@dtl@rawmappings}% + \ifdefempty{\@dtl@rawmappings}% + {% + \def\@dtl@rawmappings{{#1}{#2}}% + }% + {% + \def\@dtl@tmp{{#1}{#2}} + \protected@edef\@dtl@rawmappings{\the\@dtl@toks,\@dtl@tmp} + }% } \newcommand*{\@dtl@rawmappings}{} \newcommand*{\dtl@domappings}[1]{% -\@for\@dtl@map:=\@dtl@rawmappings\do{% - \expandafter\DTLsubstitute\expandafter#1\@dtl@map -}} -\newcommand*{\DTLifinlist}[4]{% - \def\@dtl@doifinlist##1,#1,##2\end@dtl@doifinlist{% - \def\@before{##1}% - \def\@after{##2}% + \@for\@dtl@map:=\@dtl@rawmappings\do{% + \expandafter\DTLsubstituteall\expandafter#1\@dtl@map }% - \expandafter\@dtl@doifinlist\expandafter,#2,#1,\@nil - \end@dtl@doifinlist - \ifx\@after\@nnil - #4% - \else - #3% - \fi -} -\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 -} -\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{\toks@gput@right@cx}[2]{% - \def\@toks@name{#1}% - \edef\@dtl@stuff{#2}% - \global\csname\@toks@name\endcsname\expandafter - \expandafter\expandafter{\expandafter\the - \csname\expandafter\@toks@name\expandafter\endcsname\@dtl@stuff}% -} -\newcommand{\toks@gconcat@middle@cx}[4]{% - \def\@toks@name{#1}% - \edef\@dtl@stuff{#3}% - \global\csname\@toks@name\endcsname\expandafter\expandafter - \expandafter\expandafter\expandafter - \expandafter\expandafter{\expandafter\expandafter\expandafter - \the\expandafter\expandafter\expandafter#2% - \expandafter\@dtl@stuff\the#4}% -} -\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 -}}} -\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\showthe\csname dtldb@#1\endcsname} + \expandafter\showthe\csname dtldb@#1\endcsname +} \newcommand*{\dtlshowdbkeys}[1]{% -\expandafter\showthe\csname dtlkeys@#1\endcsname} + \expandafter\showthe\csname dtlkeys@#1\endcsname +} \newcommand*{\dtlshowtype}[2]{% \DTLgetdatatype{\@dtl@type}{#1}{#2}\show\@dtl@type } diff --git a/Master/texmf-dist/tex/latex/datatool/person.sty b/Master/texmf-dist/tex/latex/datatool/person.sty index 3a6ea1b6d27..8d77dbcacd0 100644 --- a/Master/texmf-dist/tex/latex/datatool/person.sty +++ b/Master/texmf-dist/tex/latex/datatool/person.sty @@ -7,7 +7,7 @@ %% datatool.dtx (with options: `person.sty,package') %% %% datatool.dtx -%% Copyright 2009 Nicola Talbot +%% Copyright 2012 Nicola Talbot %% %% This work may be distributed and/or modified under the %% conditions of the LaTeX Project Public License, either version 1.3 @@ -21,7 +21,7 @@ %% %% 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, person.sty. +%% This work consists of the files datatool.dtx and datatool.ins and the derived files datatool-base.sty, datatool-fp.sty, datatool-pgfmath.sty, datatool.sty, databib.sty, databar.sty, datapie.sty, dataplot.sty, person.sty, databib.bst. %% %% \CharacterTable %% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z @@ -38,13 +38,8 @@ %% Right bracket \] Circumflex \^ Underscore \_ %% Grave accent \` Left brace \{ Vertical bar \| %% Right brace \} Tilde \~} -%% load student information from file "students.csv" -%% Iterate through the student database: -%% Define "anon": -%% Do the letter: -%% Undefine "anon": \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{person}[2009/11/15 v1.01 (NLCT)] +\ProvidesPackage{person}[2012/07/18 v2.10 (NLCT)] \RequirePackage{ifthen} \RequirePackage{datatool} \newcounter{people} |