summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/datatool/datatool.dtx
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/source/latex/datatool/datatool.dtx')
-rw-r--r--Master/texmf-dist/source/latex/datatool/datatool.dtx166
1 files changed, 139 insertions, 27 deletions
diff --git a/Master/texmf-dist/source/latex/datatool/datatool.dtx b/Master/texmf-dist/source/latex/datatool/datatool.dtx
index 54027354f9f..d84c46f7ee0 100644
--- a/Master/texmf-dist/source/latex/datatool/datatool.dtx
+++ b/Master/texmf-dist/source/latex/datatool/datatool.dtx
@@ -2,11 +2,8 @@
% datatool.dtx generated using makedtx version 1.1 (c) Nicola Talbot
% Command line args:
% -macrocode "databib\.bst"
-% -codetitle ""
% -comment "databib\.bst"
-% -author "Nicola Talbot"
% -setambles "databib\.bst=>\nopreamble\nopostamble"
-% -doc "datatool-manual.tex"
% -src "datatool-base.sty\Z=>datatool-base.sty"
% -src "datatool-fp.sty\Z=>datatool-fp.sty"
% -src "datatool-pgfmath.sty\Z=>datatool-pgfmath.sty"
@@ -18,8 +15,11 @@
% -src "dataplot.sty\Z=>dataplot.sty"
% -src "person.sty\Z=>person.sty"
% -src "databib.bst\Z=>databib.bst"
+% -doc "datatool-manual.tex"
+% -author "Nicola Talbot"
+% -codetitle ""
% datatool
-% Created on 2016/7/20 19:31
+% Created on 2016/7/28 15:09
%\fi
%\iffalse
%<*package>
@@ -53,6 +53,8 @@ datatool-manual.tex is a stub file used by makedtx to create
datatool.dtx
\fi
+\DeleteShortVerb{|}
+
\usepackage{datatool}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
@@ -66,7 +68,7 @@ datatool.dtx
\doxitem{Counter}{counter}{counters}
\doxitem{Option}{option}{package options}
-\CheckSum{23620}
+\CheckSum{23739}
\RecordChanges
\PageIndex
@@ -79,11 +81,11 @@ datatool.dtx
%\fi
%\MakeShortVerb{"}
%
-%\title{Documented Code for datatool v2.26}
+%\title{Documented Code for datatool v2.27}
%\author{Nicola L. C. Talbot\\
%\url{http://www.dickimaw-books.com/}}
%
-%\date{2016-07-20}
+%\date{2016-07-28}
%\maketitle
%
%\pagenumbering{roman}
@@ -119,7 +121,7 @@ datatool.dtx
%
% \begin{macrocode}
\NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{datatool-base}[2016/07/20 v2.26 (NLCT)]
+\ProvidesPackage{datatool-base}[2016/07/28 v2.27 (NLCT)]
% \end{macrocode}
% Required packages:
% \begin{macrocode}
@@ -533,6 +535,19 @@ datatool.dtx
% \end{macrocode}
%\end{macro}
%
+%I made a bit of a blunder here. \cs{dtl@sortlist} was supposed to
+%work with commands like \cs{dtlcompare}, but those commands require
+%three arguments, the first being the register in which to store the
+%result. This contradicts the requirements of \cs{dtl@sortlist}. The
+%\qt{bug fix} in v2.26 fixed it to work with commands like
+%\cs{dtlcompare}, but that broke the documented design (which breaks
+%the \sty{glossaries} package). The other problem is that
+%\cs{dtl@insertinto} actually sorts in the reverse order.
+%So v2.27 undoes the change from v2.26 to ensure backward
+%compatibility and provides an alternative user-level command
+%\cs{dltsortlist}, that's designed to work with the three-argument
+%handler commands like \cs{dtlcompare}.
+%
%\begin{macro}{\dtl@sortlist}
%\begin{definition}
% \cs{dtl@sortlist}\marg{list}\marg{criteria cmd}
@@ -540,8 +555,8 @@ datatool.dtx
% Performs an insertion sort on \meta{list}, where \meta{criteria cmd}
% is a macro which takes two arguments \meta{a} and \meta{b}.
% \meta{criteria cmd} must set the count register \cs{dtl@sortresult}
-% to either $-1$ (\meta{a} less than \meta{b}), 0 (\meta{a} is
-% equal to \meta{b}) or 1 (\meta{a} is greater than \meta{b}.)
+% to either $-1$ (\meta{b} less than \meta{a}), 0 (\meta{a} is
+% equal to \meta{b}) or 1 (\meta{b} is greater than \meta{a}.)
% \begin{macrocode}
\newcommand{\dtl@sortlist}[2]{%
\def\@dtl@sortedlist{}%
@@ -565,6 +580,94 @@ datatool.dtx
\def\@dtl@newsortedlist{}%
\@dtl@insertdonefalse
\@for\dtl@srtelement:=#2\do{%
+ \if@dtl@insertdone
+ \expandafter\toks@\expandafter{\dtl@srtelement}%
+ \edef\@dtl@newstuff{{\the\toks@}}%
+ \else
+% \end{macrocode}
+%\changes{2.26}{2016-07-20}{fixed bug (missing \cs{dtl@sortresult})}
+%\changes{2.27}{2016-07-28}{undone the incorrect change in v2.26}
+% \begin{macrocode}
+ \expandafter#3\expandafter{\dtl@srtelement}{#1}%
+% \end{macrocode}
+%\changes{2.26}{2016-07-20}{fixed bug (incorrect inequality sign)}
+%\changes{2.27}{2016-07-28}{undone the incorrect change in v2.26}
+% \begin{macrocode}
+ \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
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\dtlsortlist}
+%\changes{2.27}{2016/07/28}{new}
+%\begin{definition}
+% \cs{dtlsortlist}\marg{list}\marg{criteria cmd}
+%\end{definition}
+% As \cs{dtl@sortlist} but the \meta{criteria} command must take
+% three arguments.
+% \begin{macrocode}
+\newcommand{\dtlsortlist}[2]{%
+\def\@dtl@sortedlist{}%
+\@for\@dtl@currentrow:=#1\do{%
+\expandafter\dtlinsertinto\expandafter
+ {\@dtl@currentrow}{\@dtl@sortedlist}{#2}%
+\@endforfalse}%
+\let#1=\@dtl@sortedlist
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\dtlinsertinto}
+%\changes{2.27}{2016/07/28}{new}
+%\begin{definition}
+% \cs{dtlinsertinto}\marg{element}\marg{sorted-list}\marg{criteria cmd}
+%\end{definition}
+% Inserts \meta{element} into the sorted list \meta{sorted-list}
+% according to the criteria given by \meta{criteria cmd}, which
+% should be a command that takes three arguments
+% \marg{reg}\marg{A}\marg{B}, where \meta{reg} is a count register
+% in which to store the result, \meta{A} is the first element and
+% \meta{B} is the second element to compare.
+% \begin{macrocode}
+\newcommand{\dtlinsertinto}[3]{%
+ \def\@dtl@newsortedlist{}%
+ \@dtl@insertdonefalse
+ \@for\dtl@srtelement:=#2\do{%
\expandafter\DTLifSubString\expandafter{\dtl@srtelement}{,}
{%
\expandafter\toks@\expandafter{\dtl@srtelement}%
@@ -575,14 +678,8 @@ datatool.dtx
\if@dtl@insertdone
\let\@dtl@newstuff\dtl@srtelement
\else
-% \end{macrocode}
-%\changes{2.26}{2016-07-20}{fixed bug (missing \cs{dtl@sortresult})}
-% \begin{macrocode}
- \expandafter#3\expandafter\dtl@sortresult\expandafter
- {\dtl@srtelement}{#1}%
-% \end{macrocode}
-%\changes{2.26}{2016-07-20}{fixed bug (incorrect inequality sign)}
-% \begin{macrocode}
+ \expandafter#3\expandafter\dtl@sortresult
+ \expandafter{\dtl@srtelement}{#1}%
\ifnum\dtl@sortresult>0\relax
\DTLifSubString{#1}{,}%
{%
@@ -641,6 +738,21 @@ datatool.dtx
}
% \end{macrocode}
%\end{macro}
+%
+%\begin{macro}{\edtlinsertinto}
+%\changes{2.27}{2016/07/28}{new}
+%\begin{definition}
+% \cs{edtlinsertinto}\marg{element}\marg{sorted-list}\marg{criteria cmd}
+%\end{definition}
+%First expands \meta{element} before inserting into the list.
+% \begin{macrocode}
+\newcommand*{\edtlinsertinto}[3]{%
+ \protected@edef\dtl@srtelement{#1}%
+ \expandafter\dtlinsertinto\expandafter{\dtl@srtelement}{#2}{#3}%
+}
+% \end{macrocode}
+%\end{macro}
+%
%\begin{macro}{\if@dtl@insertdone}
% Define conditional to indicate whether the new entry has
% been inserted into the sorted list.
@@ -5795,7 +5907,7 @@ datatool.dtx
% Definitions of fixed-point commands that use the \sty{fp} package.
% \begin{macrocode}
\NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{datatool-fp}[2016/07/20 v2.26 (NLCT)]
+\ProvidesPackage{datatool-fp}[2016/07/28 v2.27 (NLCT)]
% \end{macrocode}
% Required packages:
% \begin{macrocode}
@@ -6084,7 +6196,7 @@ datatool.dtx
% Definitions of fixed-point commands that use the \sty{pgfmath} package.
% \begin{macrocode}
\NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{datatool-pgfmath}[2016/07/20 v2.26 (NLCT)]
+\ProvidesPackage{datatool-pgfmath}[2016/07/28 v2.27 (NLCT)]
% \end{macrocode}
% Required packages:
% \begin{macrocode}
@@ -6425,7 +6537,7 @@ datatool.dtx
%\section{Package Declaration}
% \begin{macrocode}
\NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{datatool}[2016/07/20 v2.26 (NLCT)]
+\ProvidesPackage{datatool}[2016/07/28 v2.27 (NLCT)]
% \end{macrocode}
% Load required packages:
% \begin{macrocode}
@@ -14018,7 +14130,7 @@ datatool.dtx
% Declare package:
% \begin{macrocode}
\NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{datagidx}[2016/07/20 v2.26 (NLCT)]
+\ProvidesPackage{datagidx}[2016/07/28 v2.27 (NLCT)]
% \end{macrocode}
% Required packages:
% \begin{macrocode}
@@ -19927,7 +20039,7 @@ datatool.dtx
%\section{Package Declaration}
% \begin{macrocode}
\NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{databib}[2016/07/20 v2.26 (NLCT)]
+\ProvidesPackage{databib}[2016/07/28 v2.27 (NLCT)]
% \end{macrocode}
% Load required packages:
% \begin{macrocode}
@@ -22850,7 +22962,7 @@ already exists}{}}}}
% Declare package:
% \begin{macrocode}
\NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{databar}[2016/07/20 v2.26 (NLCT)]
+\ProvidesPackage{databar}[2016/07/28 v2.27 (NLCT)]
% \end{macrocode}
% Require \sty{xkeyval} package
% \begin{macrocode}
@@ -24157,7 +24269,7 @@ already exists}{}}}}
% Declare package:
% \begin{macrocode}
\NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{datapie}[2016/07/20 v2.26 (NLCT)]
+\ProvidesPackage{datapie}[2016/07/28 v2.27 (NLCT)]
% \end{macrocode}
% Require \sty{xkeyval} package
% \begin{macrocode}
@@ -24959,7 +25071,7 @@ already exists}{}}}}
% Declare package:
% \begin{macrocode}
\NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{dataplot}[2016/07/20 v2.26 (NLCT)]
+\ProvidesPackage{dataplot}[2016/07/28 v2.27 (NLCT)]
% \end{macrocode}
% Required packages
% \begin{macrocode}
@@ -26581,7 +26693,7 @@ east,southeast,south,southwest,west,northwest}[northeast]{%
% Package identification:
% \begin{macrocode}
\NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{person}[2016/07/20 v2.26 (NLCT)]
+\ProvidesPackage{person}[2016/07/28 v2.27 (NLCT)]
% \end{macrocode}
% Requires the \sty{ifthen} package.
% \begin{macrocode}