summaryrefslogtreecommitdiff
path: root/Master/texmf-dist
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist')
-rw-r--r--Master/texmf-dist/doc/latex/datatool/CHANGES60
-rw-r--r--Master/texmf-dist/doc/latex/datatool/README4
-rw-r--r--Master/texmf-dist/doc/latex/datatool/datatool-code.pdfbin0 -> 895574 bytes
-rw-r--r--Master/texmf-dist/doc/latex/datatool/datatool-user.pdfbin498420 -> 581788 bytes
-rw-r--r--Master/texmf-dist/doc/latex/datatool/datatool-user.tex1751
-rw-r--r--Master/texmf-dist/doc/latex/datatool/datatool.pdfbin732089 -> 0 bytes
-rw-r--r--Master/texmf-dist/doc/latex/datatool/samples/sample-barchart.pdfbin35087 -> 35075 bytes
-rw-r--r--Master/texmf-dist/doc/latex/datatool/samples/sample-dict.pdfbin0 -> 122644 bytes
-rw-r--r--Master/texmf-dist/doc/latex/datatool/samples/sample-dict.tex439
-rw-r--r--Master/texmf-dist/doc/latex/datatool/samples/sample-gidx.pdfbin0 -> 179583 bytes
-rw-r--r--Master/texmf-dist/doc/latex/datatool/samples/sample-gidx.tex644
-rw-r--r--Master/texmf-dist/doc/latex/datatool/samples/sample-glossary.pdfbin0 -> 104382 bytes
-rw-r--r--Master/texmf-dist/doc/latex/datatool/samples/sample-glossary.tex245
-rw-r--r--Master/texmf-dist/doc/latex/datatool/samples/sample-index.pdfbin0 -> 128860 bytes
-rw-r--r--Master/texmf-dist/doc/latex/datatool/samples/sample-index.tex735
-rw-r--r--Master/texmf-dist/doc/latex/datatool/samples/sample-mail-merge.pdfbin19543 -> 21893 bytes
-rw-r--r--Master/texmf-dist/doc/latex/datatool/samples/sample-mail-merge.tex2
-rw-r--r--Master/texmf-dist/doc/latex/datatool/samples/sample-piechart.pdfbin33969 -> 33957 bytes
-rw-r--r--Master/texmf-dist/doc/latex/datatool/samples/sample-sort.tex118
-rw-r--r--Master/texmf-dist/doc/latex/datatool/samples/sample-student-scores.pdfbin34628 -> 34615 bytes
-rw-r--r--Master/texmf-dist/doc/latex/datatool/samples/sample-two-per-row.pdfbin31764 -> 31752 bytes
-rw-r--r--Master/texmf-dist/source/latex/datatool/datatool.dtx7217
-rw-r--r--Master/texmf-dist/source/latex/datatool/datatool.ins8
-rw-r--r--Master/texmf-dist/tex/latex/datatool/databar.sty6
-rw-r--r--Master/texmf-dist/tex/latex/datatool/databib.sty6
-rw-r--r--Master/texmf-dist/tex/latex/datatool/datagidx.sty3147
-rw-r--r--Master/texmf-dist/tex/latex/datatool/datapie.sty6
-rw-r--r--Master/texmf-dist/tex/latex/datatool/dataplot.sty6
-rw-r--r--Master/texmf-dist/tex/latex/datatool/datatool-base.sty626
-rw-r--r--Master/texmf-dist/tex/latex/datatool/datatool-fp.sty6
-rw-r--r--Master/texmf-dist/tex/latex/datatool/datatool-pgfmath.sty6
-rw-r--r--Master/texmf-dist/tex/latex/datatool/datatool.sty232
-rw-r--r--Master/texmf-dist/tex/latex/datatool/person.sty6
33 files changed, 14842 insertions, 428 deletions
diff --git a/Master/texmf-dist/doc/latex/datatool/CHANGES b/Master/texmf-dist/doc/latex/datatool/CHANGES
index 10191efabdc..aafffbec6b0 100644
--- a/Master/texmf-dist/doc/latex/datatool/CHANGES
+++ b/Master/texmf-dist/doc/latex/datatool/CHANGES
@@ -1,5 +1,65 @@
+v2.13:
+
+ * Added new package `datagidx'
+
+ - create glossaries/indexes /without/ using an external tool such
+ as makeindex or xindy
+
+ * datatool.sty
+
+ - added \dtlsort (like \DTLsort but user supplies custom
+ comparison handler).
+
+ - added \DTLgnewdb, \DTLgdeletedb, \DTLgcleardb
+
+ - added \DTLsaverawdb
+
+ - added \ifDTLnewdbonload, \DTLnewdbonloadtrue,
+ \DTLnewdbonloadfalse
+
+ - added \dtlparsewords
+
+ - fixed bug in \@DTLnewrow (misspelt \PackageError command)
+
+ - removed spurious space in \@dtl@setheaderforindex
+
+ - removed spurious space in \DTLaddentryforrow
+
+ - removed spurious space in \DTLdisplaydb and \DTLdisplaylongdb
+
+ - removed spurious space in \@dtl@getsortdirection
+
+ - removed spurious space in \@dtl@readline
+
+ - removed spurious space in \DTLrawmap
+
+ - \dtl@setcharcode and \dtl@setlccharcode now check
+ for \@dtl@wordbreak instead of space and tilde
+
+ - \dtl@setlccharcode bug fix (characters without a lowercase
+ now correctly dealt with)
+
+ - \dtlicompare and \dtl@teststartswith now use
+ \dtl@setwordbreaksnohyphens to deal with spaces
+
+ - added \@dtlstringnull and \@dtlnumbernull and fixed bug in
+ \DTLifnull
+
+ - renamed datatool.pdf to datatool-code.pdf
+
+ * datatool-base.sty
+
+ - added \dtlwordindexcompare
+
v2.12:
+ * datatool.sty:
+
+ - fixed bug in \DTLiflastrow
+
+ - Fixed bug causing spurious space in \DTLloaddb
+
+
* datatool-pgfmath.sty:
- fixed bug in conditionals.
diff --git a/Master/texmf-dist/doc/latex/datatool/README b/Master/texmf-dist/doc/latex/datatool/README
index 8395e3a7e3c..b344b39a9bb 100644
--- a/Master/texmf-dist/doc/latex/datatool/README
+++ b/Master/texmf-dist/doc/latex/datatool/README
@@ -1,6 +1,6 @@
-LaTeX Bundle : datatool v2.11
+LaTeX Bundle : datatool v2.13
-Last Modified : 2012-09-25
+Last Modified : 2013-01-15
Author : Nicola Talbot
diff --git a/Master/texmf-dist/doc/latex/datatool/datatool-code.pdf b/Master/texmf-dist/doc/latex/datatool/datatool-code.pdf
new file mode 100644
index 00000000000..38a648fb1f4
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/datatool/datatool-code.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/latex/datatool/datatool-user.pdf b/Master/texmf-dist/doc/latex/datatool/datatool-user.pdf
index 96450e7b940..cc86ab5d26e 100644
--- a/Master/texmf-dist/doc/latex/datatool/datatool-user.pdf
+++ b/Master/texmf-dist/doc/latex/datatool/datatool-user.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/latex/datatool/datatool-user.tex b/Master/texmf-dist/doc/latex/datatool/datatool-user.tex
index 6560eb60c0c..a38dc6c7060 100644
--- a/Master/texmf-dist/doc/latex/datatool/datatool-user.tex
+++ b/Master/texmf-dist/doc/latex/datatool/datatool-user.tex
@@ -2,11 +2,13 @@
\usepackage{ifthen}
\usepackage[verbose=false]{datatool}
-\usepackage{datapie,databar,databib,person}
+\usepackage{datapie,databar,databib,person,datagidx}
\usepackage{textcomp}
\usepackage{graphicx}
\usepackage{colortbl}
+\usepackage{booktabs}
\usepackage{cmap}
+\usepackage{alltt}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\ifpdf
@@ -29,7 +31,7 @@
\setcounter{IndexColumns}{2}
\ifpdf
- \externaldocument{datatool}
+ \externaldocument{datatool-code}
\fi
\doxitem{Counter}{counter}{counters}
@@ -47,6 +49,39 @@
\DTLnewdbentry{docbib}{Publisher}{Addison-Wesley}
\DTLnewdbentry{docbib}{Year}{1994}
+ % datagidx index example database
+
+\newgidx{gidx-index}{Index}% define a database for the index
+
+\DTLgidxSetDefaultDB{gidx-index}% set this as the default
+
+\newterm{mac\'edoine}
+\newterm{macram\'e}
+\newterm[label=elite]{{\'e}lite}
+\newterm{reptile}
+\newterm[seealso={reptile}]{crocodylian}
+
+\newterm
+ [%
+ parent=crocodylian
+ ]
+ {crocodile}
+
+\newterm
+ [%
+ parent=crocodylian
+ ]
+ {alligator}
+
+\newterm
+ [%
+ parent=crocodylian,
+ description={(also cayman)}
+ ]
+ {caiman}
+
+\newterm[see={caiman}]{cayman}
+
\begin{document}
% Some of the commands are too long to produce nicely formatted
@@ -56,11 +91,11 @@
\MakeShortVerb{"}
\DeleteShortVerb{\|}
- \title{User Manual for datatool bundle version~2.11}
+ \title{User Manual for datatool bundle version~2.13}
\author{Nicola L.C. Talbot\\
\url{http://www.dickimaw-books.com/}}
- \date{2012-09-25}
+ \date{2013-01-15}
\maketitle
\pagenumbering{roman}
@@ -72,10 +107,10 @@ The \styfmt{datatool} bundle comes with the following documentation:
This document is the main user guide for the \styfmt{datatool}
bundle.
- \item[\url{datatool.pdf}]
+ \item[\url{datatool-code.pdf}]
Advanced users wishing to know more about the inner workings of
all the packages provided in the \styfmt{datatool} bundle should
- read \qt{Documented Code for datatool v2.11}
+ read \qt{Documented Code for datatool v2.13}
\item[INSTALL] Installation instructions.
@@ -85,11 +120,21 @@ The \styfmt{datatool} bundle comes with the following documentation:
\end{description}
\begin{important}
+There's an old adage, ``use the right tool for the right job.''
+A carpenter's fine chisel is the right tool for delicate carving,
+but if you try to use it to hack off a tree branch it will take a
+long time. That doesn't mean there's something wrong with the
+chisel. It just means you're using the wrong tool for the job.
+
The \styfmt{datatool} bundle is provided to help perform repetitive
commands, such as mail merging, but since \TeX\ is designed as a
typesetting language, don't expect this bundle to perform as
-efficiently as custom database systems or a dedicated mathematical or
-scripting language.
+efficiently as custom database systems or a dedicated mathematical
+or scripting language. If the provided packages take a frustratingly
+long time to compile your document, use another language to perform
+your calculations or data manipulation and save the results in a
+file that can be input into your document.
+
\end{important}
This bundle consists of the following packages:
@@ -1978,7 +2023,11 @@ from this package.
\begin{definition}[\DescribeMacro{\DTLnewdb}]%
\cs{DTLnewdb}\marg{db name}
\end{definition}
-This command creates a new empty database called \meta{db name}. You
+\begin{definition}[\DescribeMacro{\DTLgnewdb}]%
+\cs{DTLgnewdb}\marg{db name}
+\end{definition}
+This command creates a new empty database called \meta{db name}. The
+second form is for global definitions. You
can test if a database is empty using:
\begin{definition}[\DescribeMacro{\DTLifdbempty}]%
\cs{DTLifdbempty}\marg{db name}\marg{true part}\marg{false part}
@@ -2140,9 +2189,17 @@ in your document:
\usepackage[utf8]{inputenc}
\end{verbatim}
\end{important}
-This creates a new database called \meta{db name}, and fills
-it with the entries given in the file \meta{filename}.
-The filename may have a header row at the start of the file,
+By default, \cs{DTLloaddb} creates a new database called \meta{db
+name} before it loads the data given in the file \meta{filename}.
+If you want to append the data, use
+\begin{definition}[\DTLnewdbonloadfalse]
+\cs{DTLnewdbonloadfalse}
+\end{definition}
+before you use \cs{DTLloaddb}. You can reverse this using
+\begin{definition}[\DTLnewdbonloadtrue]
+\cs{DTLnewdbonloadtrue}
+\end{definition}
+The file (\meta{filename}) may have a header row at the start of the file,
which provides the \meta{key} when creating a new database entry
using \ics{DTLnewdbentry}. The optional argument \meta{options}
is a key=value list of options. Available options are:
@@ -2278,6 +2335,9 @@ is equivalent to:
\DTLnewdbentry{mydata}{Product}{Stationary}%
\DTLnewdbentry{mydata}{Cost}{\$0.80}%
\end{verbatim}
+As with \ics{DTLloaddb}, you can govern whether or not a new
+database should be created with \ics{DTLnewdbonloadtrue} and
+\ics{DTLnewdbonloadfalse}.
\begin{table}[htbp]
\caption[Special character mappings used by
@@ -2860,6 +2920,12 @@ the following conditionals may be used:
If the current row is the first row, then do \meta{true part},
otherwise do \meta{false part}.
+\begin{definition}[\DescribeMacro{\DTLiflastrow}]%
+\cs{DTLiflastrow}\marg{true part}\marg{false part}
+\end{definition}
+If the current row is the last row, then do \meta{true part},
+otherwise do \meta{false part}.
+
\begin{definition}[\DescribeMacro{\DTLifoddrow}]%
\cs{DTLifoddrow}\marg{true part}\marg{false part}
\end{definition}
@@ -2897,7 +2963,7 @@ until the end of the current iteration. There is no provision for
a "next" or "continue" style command.
Additional loop commands provided by \sty{datatool} are
-described in the documented code (datatool.pdf).
+described in the documented code (datatool-code.pdf).
\begin{example}{Student Scores---Labelling}{ex:label}
In the previous example, the student scores, stored in the
@@ -3048,6 +3114,54 @@ This produces \autoref{tab:Bscores}.
\end{example}
+\begin{example}{Checking for the First Row (booktabs)}{ex:iffirst}
+Suppose I want to use the \sty{booktabs} package and I want to use
+\ics{midrule} after the header row. I can use \ics{DTLiffirstrow} to
+check if the loop is on the first row of the iteration. (Remember
+that you need to load the \sty{booktabs} package in the preamble
+with \cs{usepackage}.) Using the same database as before:
+\begin{verbatim}
+\begin{table}[htbp]
+\caption{Student scores (booktabs)}
+\centering
+\begin{tabular}{llc}
+\toprule
+\bfseries First Name &
+\bfseries Surname &
+\bfseries Score (\%)%
+\DTLforeach*{scores}%
+ {\firstname=FirstName,\surname=Surname,\score=Score}%
+ {%
+ \DTLiffirstrow{\\\midrule}{\\}%
+ \firstname & \surname & \score
+ }% end of loop
+ \\\bottomrule
+\end{tabular}%
+\end{table}
+\end{verbatim}
+(The commands \ics{toprule}, \ics{midrule} and \ics{bottomrule} are
+all provided by \sty{booktabs}.) This produces
+\autoref{tab:iffirst}.
+
+\begin{table}[htbp]
+\caption{Student scores (booktabs)}
+\label{tab:iffirst}
+\centering
+\begin{tabular}{llc}
+\toprule
+\bfseries First Name &
+\bfseries Surname &
+\bfseries Score (\%)%
+\DTLforeach*{scores}{%
+\firstname=FirstName,\surname=Surname,\score=Score}{%
+\DTLiffirstrow{\\\midrule}{\\}%
+\firstname & \surname & \score}%
+\\\bottomrule
+\end{tabular}%
+\end{table}
+
+\end{example}
+
\begin{example}{Breaking Out of a Loop}{ex:dtlbreak}
Suppose I only want to display the first three rows of a database.
I could do:\footnote{Recall that \ctr{DTLrowi} is incremented
@@ -4219,11 +4333,9 @@ To determine a person's gender when mail merging, see
\section{Sorting a Database}
\label{sec:sort}
-\begin{definition}[\DescribeMacro{\DTLsort}]%
-\cs{DTLsort}\oarg{replacement key list}\marg{sort criteria}\marg{db name}
-\end{definition}
-\begin{definition}[\DescribeMacro{\DTLsort*}]%
-\cs{DTLsort*}\oarg{replacement key list}\marg{sort criteria}\marg{db name}
+\begin{definition}[\DescribeMacro{\dtlsort}]%
+\cs{dtlsort}\oarg{replacement key list}\marg{sort criteria}\marg{db
+name}\marg{handler}
\end{definition}
This will sort the database called \meta{db name} according to
the criteria given by \meta{sort criteria}, which must be a
@@ -4231,9 +4343,131 @@ comma separated list of keys and optionally "="\meta{order}, where
\meta{order} is either "ascending" or "descending". If the order
is omitted, "ascending" is assumed. The database keeps track of
the data type for a given key, and uses this to determine whether
-an alphabetical or numerical sort is required. (String comparisons
-are made using the command \cs{dtlcompare} or \cs{dtlicompare}
-described in \autoref{src:dtlcompare}.)
+an alphabetical or numerical sort is required.
+
+The final argument \meta{handler} is the command used for the
+comparisons. These handlers are described in more detail in
+\autoref{src:dtlcompare} of the documented code. The following
+handlers are provided:
+\begin{description}
+\item[\ics{dtlcompare}] A case-sensitive comparison.
+\item[\ics{dtlicompare}] A case-insensitive comparison.
+\item[\ics{dtlwordindexcompare}] English word-ordering comparison
+for indexes, as described by the Oxford Style Manual.
+\item[\ics{dtlletterindexcompare}] English letter-ordering
+comparison for indexes.
+\end{description}
+The last two handlers, \cs{dtlwordindexcompare} and
+\cs{dtlletterindexcompare}, assume that inversion commas are
+indicated using one of the following commands:
+\begin{itemize}
+\item To indicate name inversion:
+\begin{definition}[\DescribeMacro\datatoolpersoncomma]
+\cs{datatoolpersoncomma}
+\end{definition}
+Example: \verb|Knuth\datatoolpersoncomma Donald E.|
+
+\item To indicate place inversion:
+\begin{definition}[\DescribeMacro\datatoolplacecomma]
+\cs{datatoolplacecomma}
+\end{definition}
+Example:
+\verb|New York\datatoolplacecomma USA|
+
+\item To indicate subject inversion:
+\begin{definition}[\DescribeMacro\datatoolsubjectcomma]
+\cs{datatoolsubjectcomma}
+\end{definition}
+Example: \verb|New York\datatoolsubjectcomma population|
+\end{itemize}
+In addition, the start of parenthetical material should be indicated
+with
+\begin{definition}[\DescribeMacro\datatoolparenstart]
+\cs{datatoolparenstart}
+\end{definition}
+Example: \verb|High Water\datatoolparenstart play|
+
+Following the guidelines of the Oxford Style Manual, when sorting
+terms that have identical pre-inversion parts, the following
+ordering is applied: people, places, subjects, no inversions and
+parenthetical.
+
+\begin{example}{Sorting a Database---Dealing with
+Inversions}{ex:sortinversion}
+This uses the example given in Chapter~16 of the Oxford Style
+Manual. Suppose I~define my database as follows:
+\begin{verbatim}
+\DTLnewdb{inversiondata}
+\DTLnewrow{inversiondata}
+\DTLnewdbentry{inversiondata}{Term}{New York, New York}
+\DTLnewrow{inversiondata}
+\DTLnewdbentry{inversiondata}{Term}{New York\datatoolsubjectcomma
+population}
+\DTLnewrow{inversiondata}
+\DTLnewdbentry{inversiondata}{Term}{New York\datatoolplacecomma
+USA}
+\DTLnewrow{inversiondata}
+\DTLnewdbentry{inversiondata}{Term}{New York\datatoolpersoncomma
+Earl of}
+\end{verbatim}
+\DTLnewdb{inversiondata}
+\DTLnewrow{inversiondata}
+\DTLnewdbentry{inversiondata}{Term}{New York, New York}
+\DTLnewrow{inversiondata}
+\DTLnewdbentry{inversiondata}{Term}{New York\datatoolsubjectcomma
+population}
+\DTLnewrow{inversiondata}
+\DTLnewdbentry{inversiondata}{Term}{New York\datatoolplacecomma
+USA}
+\DTLnewrow{inversiondata}
+\DTLnewdbentry{inversiondata}{Term}{New York\datatoolpersoncomma
+Earl of}
+
+First of all, display the unsorted data:
+\begin{verbatim}
+\DTLdisplaydb{inversiondata}
+\end{verbatim}
+This produces:
+
+\DTLdisplaydb{inversiondata}
+
+Now sort the data using the \ics{dtlwordindexcompare} handler:
+\begin{verbatim}
+\dtlsort{Term}{inversiondata}{\dtlwordindexcompare}
+\end{verbatim}
+\dtlsort{Term}{inversiondata}{\dtlwordindexcompare}%
+and display again:
+\begin{verbatim}
+\DTLdisplaydb{inversiondata}
+\end{verbatim}
+which now produces:
+
+\DTLdisplaydb{inversiondata}
+
+~here are three entries with pre-inversion text as simply
+\texttt{New York}. Since each of these three entries has the same
+pre-inversion text, they need to be sorted according to the type of
+inversion: person, place, subject. The fourth entry (New York, New
+York) doesn't have an inversion since the comma is part of the title
+of the named work. It's therefore sorted according to \texttt{New
+York, New York} rather than just \texttt{New York} and so comes
+after all the \texttt{New York} entries.
+\end{example}
+
+If you want to write your own comparison handler, see the documented
+code for details on the syntax of the handler. (You may want to
+consider uploading your handler as a separate package to CTAN if you
+think it will be of general use.)
+
+There are two shortcut commands:
+\begin{definition}[\DescribeMacro{\DTLsort}]%
+\cs{DTLsort}\oarg{replacement key list}\marg{sort criteria}\marg{db name}
+\end{definition}
+\begin{definition}[\DescribeMacro{\DTLsort*}]%
+\cs{DTLsort*}\oarg{replacement key list}\marg{sort criteria}\marg{db name}
+\end{definition}
+these use the \ics{dtlcompare} and \ics{dtlicompare} handlers,
+respectively.
The optional argument \meta{replacement key list} is a list of
keys to use if the current key given in \meta{sort criteria}
@@ -4511,6 +4745,12 @@ This produces \autoref{tab:influencesort}.
\section{Saving a Database to an External File}
\label{sec:savedb}
+\begin{important}
+\TeX's write mechanism automatically inserts linebreaks every 80
+characters. This may cause problems if you have long entries in your
+database.
+\end{important}
+
\begin{definition}[\DescribeMacro{\DTLsavedb}]%
\cs{DTLsavedb}\marg{db name}\marg{filename}
\end{definition}
@@ -4532,7 +4772,15 @@ given entry contains the separator character.)
This writes the database called \meta{db name} to a \LaTeX\ file
called \meta{filename}, where the database is stored as
a combination of \ics{DTLnewdb}, \ics{DTLnewrow} and
-\ics{DTLnewdbentry} commands.
+\ics{DTLnewdbentry} commands. This means that the file is in a
+user-friendly format, but may be so to load, particularly if the
+database is large. If you are more concerned with speed rather than
+readability you can use:
+\begin{definition}[\DescribeMacro{\DTLsaverawdb}]%
+\cs{DTLsaverawdb}\marg{db name}\marg{filename}
+\end{definition}
+This saves the database to \meta{filename} in its internal
+representation, which makes it faster to load.
\section{Deleting or Clearing a Database}\label{sec:deletedb}
@@ -4541,19 +4789,42 @@ longer required.
\begin{definition}[\DescribeMacro{\DTLcleardb}]
\cs{DTLcleardb}\marg{db name}
\end{definition}
+\begin{definition}[\DescribeMacro{\DTLgcleardb}]
+\cs{DTLgcleardb}\marg{db name}
+\end{definition}
Clears the database given by \meta{db name}. The database is emptied
-but remains defined.
+but remains defined. The second form is required if you want a
+global effect.
\begin{definition}[\DescribeMacro{\DTLdeletedb}]
\cs{DTLdeletedb}\marg{db name}
\end{definition}
-Deletes (undefines) the database given by \meta{db name}.
+\begin{definition}[\DescribeMacro{\DTLgdeletedb}]
+\cs{DTLgdeletedb}\marg{db name}
+\end{definition}
+Deletes (undefines) the database given by \meta{db name}. The second
+form is required if you want a global effect.
+
+\begin{important}
+Although \cs{DTLdeletedb} and \cs{DTLgdeletedb} undefine the macros
+associated with the database, they don't unassign the registers
+used. (\TeX\ doesn't provide a command that performs the reverse of
+commands such as \cs{newcount}.) If you want to keep making
+temporary databases, it's better to just define a single database
+(called, say, \texttt{temp}) and then just clear it rather than
+delete it and define a new database. For example, if you are
+iterating through a loop and want to have a temporary database
+on each iteration. In that case, define the database before the
+start of the loop and clear it on each iteration. If you are loading
+data from an external file, remember to use \ics{DTLnewdbonloadfalse}
+before \ics{DTLloaddb} (or \ics{DTLloadrawdb}).
+\end{important}
\section{Advanced Database Commands}
\label{sec:advanced}
This section describes more advanced commands. Further details
-can be found in the documented code (datatool.pdf).
+can be found in the documented code (datatool-code.pdf).
\begin{definition}[\DescribeMacro{\DTLgetdatatype}]
\cs{DTLgetdatatype}\marg{cs}\marg{db}\marg{key}
@@ -4836,7 +5107,8 @@ argument} error if you specify a row index that is out of range.
\end{definition}
Like \cs{dtlgetrow}, but this gets the row where the entry in column
\meta{column index} matches \meta{value}. This command produces an
-error if no match is found.
+error if no match is found. \textbf{Note that no expansion is
+performed when matching \meta{value}.}
You can use the commands below to access or edit \cs{dtlcurrentrow}, but
they won't change the database. Instead, once you've finished
@@ -4857,7 +5129,7 @@ assume that you haven't altered \cs{dtlrownum}, \cs{dtldbname},
\begin{important}
\cs{dtlcurrentrow} stores the row information using \sty{datatool}'s
-internal row syntax, described in the documented code (datatool.pdf).
+internal row syntax, described in the documented code (datatool-code.pdf).
Don't explicitly modify \cs{dtlcurrentrow} unless you have a good
understanding of the syntax.
\end{important}
@@ -4905,6 +5177,1423 @@ Behaves like \cs{dtlappendentrytocurrentrow} if the current row
doesn't contain an entry for the column given by \meta{key},
otherwise behaves like \cs{dtlreplaceentryincurrentrow}.
+\chapter{Creating an index, glossary or list of acronyms
+(\texorpdfstring{\sty{datagidx}}{datagidx} package)}
+\label{sec:datagidx}
+
+The \sty{datagidx} package is provided as an alternative to the
+\sty{glossaries} package. Rather than relying on an external
+indexing application, such as \app{xindy} or
+\app{makeindex}, it uses the database mechanism of the
+\sty{datatool} package. \emph{\sty{datagidx} and \sty{glossaries}
+are not compatible.}
+
+First a repeat of the caveat at the start of this manual:
+\begin{important}
+Use the right tool for the right job.
+\end{important}
+Don't expect \sty{datagidx} to perform as efficiently as an
+application that is designed specifically to sort and collate entries.
+
+If, however, you are happy to exchange efficiency for the
+convenience of not having to invoke an external application in
+between \LaTeX\ runs, read on.
+
+\section{Defining Index/Glossary Databases}
+
+\begin{important}
+The databases and their associated entries described here can only
+be defined in the preamble. This is because the database must be set
+up before the auxiliary file is read. If you don't want to lose your
+place by constantly returning to the preamble to add a new term
+while you edit your document, consider putting all your definitions
+in a separate file which can be \cs{input} in the preamble.
+You can then switch between files without losing your place
+(provided you are using a decent text editor).
+\end{important}
+
+First you need to define a customised database that will be used to
+store the entries in your index, glossary or list of acronyms:
+\begin{definition}[\DescribeMacro\newgidx]
+\cs{newgidx}\marg{label}\marg{title}
+\end{definition}
+This defines a new database with a unique label and a title.
+For example:
+\begin{verbatim}
+\newgidx{index}{Index}
+\end{verbatim}
+I can now identify this database using the label \texttt{index}. The
+title ``Index'' is the default heading when the database is
+displayed using \cs{printterms} (see \autoref{sec:printterms}).
+
+\section{Locations}
+\label{sec:locations}
+
+Each term in an index or glossary database has an associated
+location list. This is initially null. When you display the database
+using \ics{printterms} (see \autoref{sec:printterms}) only those
+entries with a non-null location list or with a ``see''
+cross-reference are displayed. The location by default is the page
+number on which the entry has been used. This may be changed to
+another counter by redefining
+\begin{definition}[\DescribeMacro\DTLgidxCounter]
+\cs{DTLgidxCounter}
+\end{definition}
+to the name of the required counter. For example:
+\begin{verbatim}
+\renewcommand*{\DTLgidxCounter}{section}
+\end{verbatim}
+The \styfmt{datagidx} package knows about the following counter
+styles: \texttt{arabic}, \texttt{roman}, \texttt{Roman},
+\texttt{alph} and \texttt{Alph}. If your location counter uses a
+different style, you will need to add a new location type. This will
+only work if the counter uses a command that expands to another
+command that takes a number as its argument. For example, suppose I
+want to use small caps Roman numeral page numbering. I need to
+define a command (say \cs{myscroman}) that takes a counter name as
+its argument but expands to another command that takes a number as
+its argument, like this:
+\begin{verbatim}
+\newcommand*{\myscroman}[1]{\myscrromannum{\value{#1}}}
+\newcommand*{\myscromannum}[1]{\textsc{\romannumeral#1}}
+\end{verbatim}
+Note that the font changing command \cs{textsc} is in the definition
+of \cs{myscromannum} not in the definition of \cs{myscroman}.
+The page counter can now be changed so that it uses \cs{myscroman}:
+\begin{verbatim}
+\renewcommand*{\thepage}{\myscroman{page}}
+\end{verbatim}
+I now have to indicate that \cs{myscromannum} is a valid location
+type using:
+\begin{definition}[\DescribeMacro\DTLgidxAddLocationType]
+\cs{DTLgidxAddLocationType}\marg{cs name}
+\end{definition}
+where \meta{cs name} is the name of the control sequence without the
+initial backslash. Like this:
+\begin{verbatim}
+\DTLgidxAddLocationType{myscromannum}
+\end{verbatim}
+Note that this is the command that takes a number as its argument
+(\cs{myscromannum}) not the command that takes a counter name as its
+argument (\cs{myscroman}).
+
+As with \app{makeindex} and \app{xindy}, locations may have
+a compositor. The default compositor is a full stop but may be
+changed by redefining
+\begin{definition}[\DescribeMacro\DTLgidxSetCompositor]
+\cs{DTLgidxSetCompositor}
+\end{definition}
+Alternatively, you can use the package option \pkgopt{compositor}.
+
+\section{Defining Terms}
+\label{sec:newterm}
+
+Once you have defined the database, you can now define terms
+associated with that database using
+\begin{definition}[\DescribeMacro\newterm]
+\cs{newterm}\oarg{options}\marg{name}
+\end{definition}
+where \meta{name} is the term and \meta{options} is a
+comma-separated list of \meta{key}=\meta{value} options. The
+following keys are available:
+\begin{description}
+\item[\csopt{newterm}{database}] Identifies the database in which to
+store this term. For example:
+\begin{verbatim}
+\newterm[database=index]{reptile}
+\end{verbatim}
+It can be somewhat cumbersome having to keep typing the database for
+each new term. Instead you can identify the default database using
+\begin{definition}[\DescribeMacro\DTLgidxSetDefaultDB]
+\cs{DTLgidxSetDefaultDB}\marg{label}
+\end{definition}
+Example:
+\begin{verbatim}
+ % define two indexes:
+ \newgidx{index}{Index}
+ \newgidx{people}{People}
+ % Set "index" as the default database:
+ \DTLgidxSetDefaultDB{index}
+ % This batch of terms will be added to database "index":
+ \newterm{reptile}
+ \newterm{mammal}
+ \newterm{insect}
+ % Set "people" as the default database:
+ \DTLgidxSetDefaultDB{people}
+ % This batch of terms will be added to database "people":
+ \newterm{Bob}
+ \newterm{Mary}
+ \newterm{Jane}
+\end{verbatim}
+
+\item[\csopt{newterm}{label}] A unique identifying label. This
+should not contain any active characters. If omitted, the label is
+extracted from \meta{name} (see below).
+
+\item[\csopt{newterm}{sort}] The sort key. If omitted, this is
+extracted from \meta{name} (see below).
+
+\item[\csopt{newterm}{parent}] The parent entry, if this is a
+sub-term.
+
+\item[\csopt{newterm}{text}] How the entry should appear in the
+document text. This is \meta{name} by default. If this option is
+used, \meta{name} indicates how the entry should appear in the
+index, glossary or list of acronyms.
+
+\item[\csopt{newterm}{description}] An optional description. This is
+usually not required for an index but needed for a glossary.
+
+\item[\csopt{newterm}{plural}] The plural form of the term. If
+omitted this is formed by appending ``s'' to \meta{name} (or the
+value of the \csopt{newterm}{text} key if supplied).
+
+\item[\csopt{newterm}{symbol}] An associated symbol if required.
+
+\item[\csopt{newterm}{short}] An associated short form if required.
+(Default \meta{name}.)
+
+\item[\csopt{newterm}{long}] An associated long form if required.
+(Default \meta{name}.)
+
+\item[\csopt{newterm}{shortplural}] An associated short plural if
+required. (Default formed by appending ``s'' to the value of the
+\csopt{newterm}{short} key.)
+
+\item[\csopt{newterm}{longplural}] An associated long plural if
+required. (Default formed by appending ``s'' to the value of the
+\csopt{newterm}{long} key.)
+
+\item[\csopt{newterm}{see}] A cross-reference to a synonym. The
+value should be the label of another entry. This entry will not have
+a location list, just the reference to the other term.
+
+\item[\csopt{newterm}{seealso}] A cross-reference to a closely
+related term. This entry should have both a location list and a
+reference to the other term.
+
+\end{description}
+
+If the \csopt{label} or \csopt{sort} key are omitted, \sty{datagidx}
+tries to form sensible defaults. At the moment, this involves
+stripping certain commands (\ics{MakeUppercase},
+\ics{MakeLowercase},
+\ics{MakeTextUppercase}, \ics{MakeTextLowercase}, \ics{acronymfont},
+\ics{textsc}, \ics{textbf}, \ics{textmd}, \ics{textit},
+\ics{textsl}, \ics{textrm}, \ics{texttt}, \ics{textsf}, \ics{emph},
+\ics{ensuremath} and \ics{textsuperscript}), stripping accents
+and replacing certain control characters or control sequences
+(\verb|~| is replace with a space and \verb|\&| is replaced with
+\ics{andname} (if defined) or ``and'' (if \cs{andname} isn't
+defined)). The Greek letter commands (\ics{alpha} etc) are converted
+to their name.
+
+Examples:
+\begin{enumerate}
+\item \ics{ensuremath} is stripped and \ics{alpha} is converted to
+``alpha'' so the following:
+\begin{verbatim}
+\newterm{\ensuremath{\alpha}}
+\end{verbatim}
+sets both the label and sort to \texttt{alpha} but the name and text
+fields are set to \verb|\ensuremath{\alpha}|.
+
+\item Accent commands are stripped so the following:
+\begin{verbatim}
+\newterm{mac\'edoine}
+\end{verbatim}
+sets both the label and sort fields to \texttt{macedoine} but the
+name and text fields are set to \verb|mac\'edoine|.
+
+\begin{important}
+The first letter must be grouped if it's an accent or ligature or a
+character outside the range \texttt{a}\ldots\texttt{z} or
+\texttt{A}\ldots\texttt{Z}.
+\end{important}
+
+\item This example must have the sort and label fields set manually
+because the first letter has an accent:
+\begin{verbatim}
+\newterm[label=elite,sort=elite]{{\'e}lite}
+\end{verbatim}
+
+\item The same applies if you are using the \sty{inputenc} package:
+\begin{verbatim}
+\newterm[label=elite,sort=elite]{{é}lite}
+\end{verbatim}
+
+\item The same applies to plural terms set explicitly:
+\begin{verbatim}
+\newterm
+ [%
+ plural={{Å“}sophagi},%
+ label={oesophagus},%
+ sort={oesophagus}%
+ ]
+ {{Å“}sophagus}
+\end{verbatim}
+
+\item Commands such as \ics{oe} aren't dealt with, so you must
+manually set the label and sort key:
+\begin{verbatim}
+\newterm[label=manoeuvre,sort=manoeuvre]{man\oe uvre}
+\end{verbatim}
+
+\item The same applies if you are using the \sty{inputenc} package:
+\begin{verbatim}
+\newterm[label=manoeuvre,sort=manoeuvre]{manœuvre}
+\end{verbatim}
+
+\begin{important}
+Take care if any of the values to fields contain a comma or equal
+sign. The value must be grouped.
+\end{important}
+
+\item This term contains a comma in some of the fields:
+\begin{verbatim}
+\newterm
+ [%
+ label={comma},%
+ sort={,},%
+ text={comma (,)}%
+ plural={commas (,)}%
+ ]
+ {, (comma)}
+\end{verbatim}
+In the text, the entry is \texttt{comma (,)} but in the index the
+entry is sorted according to the comma symbol and is displayed as
+\texttt{, (comma)}.
+
+\end{enumerate}
+
+\subsection{Commands to Assist Sorting}
+
+There are some situations where you will have to specify the sort
+key, for example:
+\begin{verbatim}
+\newterm
+[
+ sort={Ten Downing Street}
+]
+{10 Downing Street}
+\end{verbatim}
+
+However, there are some commands provided to help set the default
+sort for entries that are sorted differently from the way they are
+typeset in the index/glossary, which can help reduce the number of times you
+need to explicitly set the sort field.
+
+\begin{definition}[\DescribeMacro\DTLgidxParen]
+\cs{DTLgidxParen}\marg{text}
+\end{definition}
+This command is provided for parenthetical material that should be
+typeset in the index, but should not contribute to the sort unless
+there is an identical entry without parenthetical material.
+
+For example:
+\begin{verbatim}
+\newterm{0\DTLgidxParen{zero}}
+\end{verbatim}
+This term is typeset as \texttt{0 (zero)}, but has the sort and
+label fields set to \texttt{0}.
+
+The default sort used is word-order sorting. This has a special
+number group for entries where the sort field consists solely of
+digits and they are sorted numerically rather than by string
+comparison. Using \cs{DTLgidxParen} in this manner, the following
+terms will appear in numerical order in the index:
+\begin{verbatim}
+\newterm{0\DTLgidxParen{zero}}
+\newterm{1\DTLgidxParen{one}}
+\newterm{2\DTLgidxParen{two}}
+\newterm{3\DTLgidxParen{three}}
+\newterm{10\DTLgidxParen{ten}}
+\newterm{100\DTLgidxParen{one hundred}}
+\newterm{20\DTLgidxParen{twenty}}
+\end{verbatim}
+If \cs{DTLgidxParen} was not used and the parentheses were
+explicitly included, e.g.\ \texttt{0 (zero)}, then the entries would
+be placed in the symbol group instead and be sorted according to
+string (so \texttt{10 (ten)} would come before \texttt{2 (two)}).
+
+\begin{definition}[\DescribeMacro\DTLgidxPlace]
+\cs{DTLgidxPlace}\marg{country/county}\marg{city/town}
+\end{definition}
+Use this command to indicate a place. For example:
+\begin{verbatim}
+\newterm{\DTLgidxPlace{USA}{New York}}
+\end{verbatim}
+This sets the label and name to \texttt{New York, USA}, the text
+field is set to just \texttt{New York} and the sort field is set to
+\verb|New York\datatoolplacecomma USA| (see \autoref{sec:sort}).
+
+\begin{definition}[\DescribeMacro\DTLgidxSubject]
+\cs{DTLgidxSubject}\marg{subject}\marg{text}
+\end{definition}
+Use this to indicate a subject, concept or object. Example:
+\begin{verbatim}
+\newterm{\DTLgidxSubject{population}{New York}}
+\end{verbatim}
+Both the label and name fields default to \texttt{New York,
+population}, the text field defaults to \texttt{population} and the
+sort field is set to \verb|New York\datatoolsubjectcomma population|
+(see \autoref{sec:sort}).
+
+\begin{definition}[\DescribeMacro\DTLgidxName]
+\cs{DTLgidxName}\marg{forename(s)}\marg{surname}
+\end{definition}
+Use this command to index a person. The entry will be sorted
+according to the surname then the forenames. The entry will be
+displayed as \meta{surname}, \meta{forename(s)} in the index but
+will be displayed as \meta{forename(s)} \meta{surname} when
+referenced in the document. The label, on the other hand, is set to
+just the surname. Example:
+\begin{verbatim}
+\newterm{\DTLgidxName{Donald E.}{Knuth}}
+\end{verbatim}
+This sets the name field to \texttt{Knuth, Donald E.}, the text
+field to \texttt{Donald E. Knuth}, the label to \texttt{Knuth} and the sort field to
+\texttt{Knuth\ics{datatoolpersoncomma} Donald E.} (see
+\autoref{sec:sort}).
+
+A person's title (such as ``Dr'') should typically not affect the
+sort, unless there is another person with the same surname and
+forenames (or initials) without a title. To assist this, you can
+identify a person's title using:
+\begin{definition}[\DescribeMacro\DTLgidxRank]
+\cs{DTLgidxRank}\marg{title}\marg{forename(s)/initial(s)}
+\end{definition}
+Using examples from the Oxford Style Manual:
+\begin{verbatim}
+\newterm[label=AliceMeynell]{\DTLgidxName{Meynell}{Alice}}
+\newterm[label=DrMeynell]{\DTLgidxName{Meynell}{\DTLgidxRank{Dr}{A.}}}
+\newterm[label=AMeynell]{\DTLgidxName{Meynell}{A.}}
+\end{verbatim}
+Here the labels must be set as the surnames are identical for each
+entry, but the entries will be sorted in the order: ``Meynell, A.'',
+``Meynell, Dr~A.'' and ``Meynell, Alice''.
+
+You can use
+\begin{definition}[\DescribeMacro\DTLgidxNameNum]
+\cs{DTLgidxNameNum}\marg{number}
+\end{definition}
+to indicate a number associated with a name. The number is typeset
+as an uppercase Roman numeral in the text, but is sorted
+numerically.
+
+For example:
+\begin{verbatim}
+\newterm{James~\DTLgidxNameNum{1}}
+\end{verbatim}
+This is typeset as \verb|James~I|, but gets the label
+\texttt{James I} (note no tilde) and the sort field is set to
+\texttt{James 01}. This means that if I want to index all the Kings
+whose name is James, they will appear in the correct order in the
+index.
+
+If a term contains a variant of ``Mac'' you can also use:
+\begin{definition}[\DescribeMacro\DTLgidxMac]
+\cs{DTLgidxMac}\marg{text}
+\end{definition}
+The entry will be typeset with \meta{text} but the sort key will
+have \meta{text} replaced with \texttt{Mac}. Examples:
+\begin{verbatim}
+\newterm{\DTLgidxName{Joe}{\DTLgidxMac{Mc}Cullers}}
+\newterm{\DTLgidxName{Bob}{\DTLgidxMac{M'}Fingal}}
+\newterm{\DTLgidxMac{Mc}Carthyism}
+\newterm{\DTLgidxMac{Mc}Guffin}
+\end{verbatim}
+
+Similarly saints can be identified using:
+\begin{definition}[\DescribeMacro\DTLgidxSaint]
+\cs{DTLgidxSaint}\marg{text}
+\end{definition}
+Examples:
+\begin{verbatim}
+\newterm{\DTLgidxSaint{St} Julian}
+\newterm{\DTLgidxName{Q.}{\DTLgidxSaint{St}~John-Smythe}}
+\newterm{\DTLgidxPlace{\DTLgidxSaint{St}~Andrews}{Fife}}
+\end{verbatim}
+These will be sorted according to \texttt{Saint Julian},
+\verb|Saint John-Smythe\datatoolpersoncomma Q.| and
+\verb|Saint Andrews\datatoolplacecomma Fife|.
+
+Particles, such as ``de'', ``von'' or ``of'' are usually ignored
+when sorting. These can be identified using:
+\begin{definition}[\DescribeMacro\DTLgidxParticle]
+\cs{DTLgidxParticle}\marg{text}
+\end{definition}
+Examples:
+\begin{verbatim}
+\newterm{\DTLgidxName{Fred}{\DTLgidxParticle{de}{Winter}}}
+\newterm{\DTLgidxName{Gustav}{\DTLgidxParticle{von}{Aschenbach}}}
+\end{verbatim}
+Here the names are sorted according to
+\verb|Winter\datatoolpersoncomma Fred| and
+\verb|Aschenbach\datatoolpersoncomma Gustav| but the labels are set
+to \texttt{deWinter} and \texttt{vonAschenbach}.
+
+A person can also be indicated by their office, for example ``Henry,
+scribe of Bury St~Edmunds''. For this, you can use:
+\begin{definition}[\DescribeMacro\DTLgidxOffice]
+\cs{DTLgidxOffice}\marg{office}\marg{name}
+\end{definition}
+Here the label defaults to just \meta{name}, so you may need to set
+the label manually to ensure uniqueness. Examples:
+\begin{verbatim}
+\newterm
+[
+ label={HenrySonJohn}
+]
+{\DTLgidxOffice{son \DTLgidxParticle{of}{John}}{Henry}}
+
+\newterm
+[
+ label={HenryBeaumont}
+]
+{\DTLgidxOffice{bishop \DTLgidxParticle{of}{Bayeux}}{Henry
+\DTLgidxParticle{de}{Beaumont}}}
+
+\newterm
+[
+ label={HenryScribe}
+]
+{\DTLgidxOffice{scribe \DTLgidxParticle{of}{Bury}
+ \DTLgidxSaint{St}~Edmunds}{Henry}}
+
+
+\end{verbatim}
+
+You can hook into the mechanism that sets the default sort key by
+adding to the definition of
+\begin{definition}[\DescribeMacro\newtermlabelhook]
+\cs{newtermlabelhook}
+\end{definition}
+You can use \sty{etoolbox's} \ics{appto} command to append to this
+hook. For example, suppose you want to index the terms \verb|\TeX|,
+\verb|e\TeX| and \verb|pdf\TeX|, but you want the terms to have the
+label and sort fields to be just \verb|TeX|, \verb|eTeX| and
+\verb|pdfTeX|, then you can add to the hook so that it automatically
+converts \ics{TeX} to just \texttt{TeX}:
+\begin{verbatim}
+\appto\newtermlabelhook{\def\TeX{TeX}}
+\end{verbatim}
+(Note that it's important to use the local \ics{def} rather than the
+global \ics{gdef} to ensure the redefinition is localised.)
+
+Now the terms can simply be defined using:
+\begin{verbatim}
+\newterm{\TeX}
+\newterm{e\TeX}
+\newterm{pdf\TeX}
+\end{verbatim}
+
+To assist in using this mechanism, the following commands are
+available (these commands may also be used in the mandatory argument
+of \cs{newterm}):
+\begin{definition}[\DescribeMacro\DTLgidxNoFormat]
+\cs{DTLgidxNoFormat}\marg{text}
+\end{definition}
+This commands simply does its argument, so any commands that should
+be stripped from the label or sort field without the loss of their
+argument can be \ics{let} to \cs{DTLgidxNoFormat}. For example,
+suppose you want to define a command called, say, \cs{appname} that
+you want to use to identify application names, like this:
+\begin{verbatim}
+\newcommand*{\app}[1]{\texttt{#1}}
+\end{verbatim}
+This command needs to be stripped from the label and sort, so it can
+be added to the hook like this:
+\begin{verbatim}
+\appto\newtermlabelhook{\let\app\DTLgidxNoFormat}
+\end{verbatim}
+Now you can define terms like this:
+\begin{verbatim}
+\newterm{\app{makeindex}}
+\newterm{\app{xindy}}
+\end{verbatim}
+The label and sort keys are then set to \texttt{makeindex} (for the
+first term) and \texttt{xindy} (for the second term).
+
+\begin{definition}[\DescribeMacro\DTLgidxGobble]
+\cs{DTLgidxGobble}\marg{text}
+\end{definition}
+This command discards its argument, so it can be used if you not
+only want to strip a command but also its argument from the label
+and sort fields.
+
+For example, suppose you want some terms to have a footnote (both in the
+index/glossary and in the document text) but the footnote shouldn't
+form part of the sort or label fields. You can add to the hook like
+this:
+\begin{verbatim}
+\appto\newtermlabelhook{\let\footnote\DTLgidxGobble}
+\end{verbatim}
+Now you can define some terms with footnotes:
+\begin{verbatim}
+\newterm{foo\footnote{a note about foo}}
+\newterm{bar\footnote{a note about bar}}
+\end{verbatim}
+The label and sort keys are then set to \texttt{foo} (for the first
+term) and \texttt{bar} (for the second term).
+
+\begin{definition}[\DescribeMacro\DTLgidxIgnore]
+\cs{DTLgidxIgnore}
+\end{definition}
+This is similar to \cs{DTLgidxGobble} but only affects the sort key
+not the label. Example:
+\begin{verbatim}
+\newterm{de\DTLgidxIgnore{-}escalate}
+\end{verbatim}
+This is displayed as \texttt{de-escalate} and gets the label
+\texttt{de-escalate} but is sorted according to \texttt{deescalate}.
+
+\begin{definition}[\DescribeMacro\DTLgidxStripBackslash]
+\cs{DTLgidxStripBackslash}\marg{control sequence}
+\end{definition}
+This can be used to ``stringify'' a control sequence and remove the
+leading backslash. For example, suppose you want to index the
+ampersand symbol (\&) but you want to sort it according to the
+actual symbol \verb|&|, you can do:
+\begin{verbatim}
+\newterm
+ [%
+ label={amp},
+ sort={\DTLgidxStripBackslash{\&}},
+ text={ampersand (\&)},
+ plural={ampersands (\&)},
+ ]
+ {\& (ampersand)}
+\end{verbatim}
+
+\section{Referencing Terms}
+\label{sec:useentry}
+
+You can reference terms using
+\begin{definition}[\DescribeMacro\useentry]
+\cs{useentry}\marg{label}\marg{field}
+\end{definition}
+This fetches the given field for the term identified by
+\meta{label}, displays it and marks the term as having been used.
+Example, suppose I have previous (in the preamble) defined the term
+``reptile'' using:
+\begin{verbatim}
+\newterm{reptile}
+\end{verbatim}
+I can now reference this term in the document:
+\begin{verbatim}
+\useentry{reptile}{Text}
+\end{verbatim}
+or if I want the plural, I can use:
+\begin{verbatim}
+\useentry{reptile}{Plural}
+\end{verbatim}
+There are also uppercase versions:
+\begin{definition}[\DescribeMacro\Useentry]
+\cs{Useentry}\marg{label}\marg{field}
+\end{definition}
+This makes the first letter uppercase (using the \sty{mfirstuc}
+package) or to make the whole text uppercase use:
+\begin{definition}[\DescribeMacro\USEentry]
+\cs{USEentry}\marg{label}\marg{field}
+\end{definition}
+
+If you use the \sty{hyperref} package, the above commands will
+automatically create hyperlinks to the relevant entry in the
+index/glossary. You can suppress this action by using one of the
+following analogous commands instead:
+\begin{definition}[\DescribeMacro\useentrynl]
+\cs{useentrynl}\marg{label}\marg{field}
+\end{definition}
+\begin{definition}[\DescribeMacro\Useentrynl]
+\cs{Useentrynl}\marg{label}\marg{field}
+\end{definition}
+\begin{definition}[\DescribeMacro\USEentrynl]
+\cs{USEentrynl}\marg{label}\marg{field}
+\end{definition}
+
+In all the above commands, the \meta{label} argument may optionally
+start with \oarg{format}, where format is the name of a control
+name \emph{without} the preceding backslash. This command will be
+applied to this location in the entry's location list when it's
+displayed in the index/glossary.
+
+For example:
+\begin{verbatim}
+\useentry{[textbf]reptile}{Text}
+\end{verbatim}
+Note that the command (\cs{textbf} in the above example) should take
+one argument (the location). If you attempt to use, say, a
+declaration (such as \cs{bfseries}) the effect won't be localised.
+
+You can display the value of a field without indexing it using:
+\begin{definition}[\DescribeMacro\glsdispentry]
+\cs{glsdispentry}\marg{label}\marg{field}
+\end{definition}
+To make the first letter uppercase, use:
+\begin{definition}[\DescribeMacro\Glsdispentry]
+\cs{Glsdispentry}\marg{label}\marg{field}
+\end{definition}
+The above commands aren't expandable. If you want to fetch a value
+without displaying or using it, you can use:
+\begin{definition}[\DescribeMacro\DTLgidxFetchEntry]
+\cs{DTLgidxFetchEntry}\marg{cs}\marg{label}\marg{field}
+\end{definition}
+where \meta{cs} is a control sequence, \meta{label} is the label
+that uniquely identifies the entry and \meta{field} is the required
+field. The value of that field is stored in \meta{cs}.
+
+The predefined database fields are:
+\begin{description}
+\item[Name] How the term appears in the index/glossary (as specified
+by the mandatory argument of \ics{newterm}).
+\item[Text] The value of the \csopt{newterm}{text} field.
+\item[Plural] The value of the \csopt{newterm}{plural} field.
+\item[Description] The value of the \csopt{newterm}{description}
+field.
+\item[Symbol] The value of the \csopt{newterm}{symbol} field.
+\item[Long] The value of the \csopt{newterm}{long} field.
+\item[Short] The value of the \csopt{newterm}{short} field.
+\item[LongPlural] The value of the \csopt{newterm}{longplural}
+field.
+\item[ShortPlural] The value of the \csopt{newterm}{shortplural}
+field.
+\item[See] The value of the \csopt{newterm}{see} field.
+\item[SeeAlso] The value of the \csopt{newterm}{seealso} field.
+\item[Sort] The value of the \csopt{newterm}{sort} field.
+\item[Parent] The value of the \csopt{newterm}{parent} field.
+\item[Label] The entry's unique identifying label.
+\item[Used] Has the value 1 (entry has been used) or either 0 or
+undefined (entry hasn't been used).
+\item[Location] The entry's location list (picked up from the last
+\LaTeX\ run).
+\end{description}
+
+In addition, there are some fields designed for internal use:
+\texttt{Child}, \texttt{FirstId} and \texttt{CurrentLocation}.
+
+You can add an entry to the index/glossary without displaying any
+text using:
+\begin{definition}[\DescribeMacro\glsadd]
+\cs{glsadd}\marg{label}
+\end{definition}
+As with \cs{useentry}, \meta{label} maybe in the form
+\oarg{format}\marg{label} where \meta{format} is the name of a
+control sequence \emph{without} the leading backslash.
+
+You can also add all entries from a particular database using
+\begin{definition}[\DescribeMacro\glsaddall]
+\cs{glsaddall}\marg{db name}
+\end{definition}
+where \meta{db name} is the name of the database.
+
+Unlike the commands of the same name provided by the
+\sty{glossaries} package, here there is a difference between
+\cs{glsaddall} and using \cs{glsadd} on all entries in the database.
+In the case of \cs{glsadd} a location is added to the location list
+for that entry. However in the case of \cs{glsaddall} no location is
+added to each entry's location list, but the location list is set to
+non-null so the entry will appear in the index/glossary.
+
+\subsection{Shortcut Commands}
+
+There are some shortcuts to common fields (if you are used to the
+\sty{glossaries} package, note that these commands have different
+formats to the commands provided by \sty{glossaries} with the same
+name):
+\begin{definition}[\DescribeMacro\gls]
+\cs{gls}\marg{label}
+\end{definition}
+This is equivalent to \cs{useentry}\marg{label}\verb|{Text}|.
+\begin{definition}[\DescribeMacro\glspl]
+\cs{glspl}\marg{label}
+\end{definition}
+This is equivalent to \cs{useentry}\marg{label}\verb|{Plural}|.
+\begin{definition}[\DescribeMacro\glsnl]
+\cs{glsnl}\marg{label}
+\end{definition}
+This is equivalent to \cs{useentrynl}\marg{label}\verb|{Text}|.
+\begin{definition}[\DescribeMacro\glsplnl]
+\cs{glsplnl}\marg{label}
+\end{definition}
+This is equivalent to \cs{useentrynl}\marg{label}\verb|{Plural}|.
+
+\begin{definition}[\DescribeMacro\Gls]
+\cs{Gls}\marg{label}
+\end{definition}
+This is equivalent to \cs{Useentry}\marg{label}\verb|{Text}|.
+\begin{definition}[\DescribeMacro\Glspl]
+\cs{Glspl}\marg{label}
+\end{definition}
+This is equivalent to \cs{Useentry}\marg{label}\verb|{Plural}|.
+\begin{definition}[\DescribeMacro\Glsnl]
+\cs{Glsnl}\marg{label}
+\end{definition}
+This is equivalent to \cs{Useentrynl}\marg{label}\verb|{Text}|.
+\begin{definition}[\DescribeMacro\Glsplnl]
+\cs{Glsplnl}\marg{label}
+\end{definition}
+This is equivalent to \cs{Useentrynl}\marg{label}\verb|{Plural}|.
+
+\begin{definition}[\DescribeMacro\glssym]
+\cs{glssym}\marg{label}
+\end{definition}
+This is equivalent to \cs{useentry}\marg{label}\verb|{Symbol}|.
+\begin{definition}[\DescribeMacro\Glssym]
+\cs{Glssym}\marg{label}
+\end{definition}
+This is equivalent to \cs{Useentry}\marg{label}\verb|{Symbol}|.
+
+\section{Adding Extra Fields}
+
+You can add new fields to the index/glossary database using:
+\begin{definition}[\DescribeMacro\newtermaddfield]
+\cs{newtermaddfield}\oarg{db list}\marg{field name}\marg{key
+name}\marg{default value}
+\end{definition}
+The optional argument \meta{db list} is a comma-separated list of
+databases that should have this new field. If omitted, the field
+will be added to all the defined databases. The argument \meta{field
+name} is the label to give this new column in the database(s). The
+argument \meta{key name} is the name of the new key to use in the
+optional argument of \ics{newterm}. The final argument \meta{default
+value} is the default value if the key isn't used. Within
+\meta{default value}, you may use
+\begin{definition}[\DescribeMacro\field]
+\cs{field}\marg{key}
+\end{definition}
+to indicate the value of another key.
+
+
+For example, suppose I want to be able to specify an alternative
+plural. I can add a new field like this:
+\begin{verbatim}
+\newtermaddfield{AltPlural}{altplural}{}
+\end{verbatim}
+This adds a new column with the label \texttt{AltPlural} to each
+defined index/glossary database and adds a new key called
+\texttt{altplural} that I can now use in \ics{newterm}. The default
+is set to empty. Now I can define terms with an alternative plural:
+\begin{verbatim}
+\newterm[altplural=kine]{cow}
+\end{verbatim}
+In the document, I can use \verb|\gls{cow}| to display ``cow'',
+\verb|\glspl{cow}| to display ``cows'' and
+\verb|\useentry{cow}{AltPlural}| to display ``kine''. To make life a
+little easier, I can define a new command to save typing:
+\begin{verbatim}
+\newcommand*{\glsaltpl}[1]{\useentry{#1}{AltPlural}}
+\end{verbatim}
+Now I can just do \verb|\glsaltpl{cow}| to display ``kine''.
+
+Here's another example. Suppose I want to add a field that produces
+the past tense of a verb. In this case, the default should be formed
+by appending ``ed'' to the \csopt{newterm}{text} field. The new
+field can be defined as follows:
+\begin{verbatim}
+\newtermaddfield{Ed}{ed}{\field{text}ed}
+\end{verbatim}
+This adds a new column labelled ``Ed'' and defines a new key called
+``ed'' that can be used with \ics{newterm}. Now I can defined some
+verbs:
+\begin{verbatim}
+\newterm{jump}
+\newterm[ed=went]{go}
+\end{verbatim}
+
+Let's define a convenience command to access this field:
+\begin{verbatim}
+\newcommand*{\glsed}[1]{\useentry{#1}{Ed}}
+\end{verbatim}
+This new field can now be referenced in the document:
+\begin{verbatim}
+He \glsed{jump} over the gate.
+She \glsed{go} to the shop.
+\end{verbatim}
+The above will be displayed as: He jumped over the gate. She went to
+the shop.
+
+\section{Acronyms}
+
+You may have noticed that you can specify \csopt{newterm}{short} and
+\csopt{newterm}{long} fields when you define a new term. There is a
+convenient shortcut command which uses \ics{newterm} to define an
+acronym. The syntax is:
+\begin{definition}[\DescribeMacro\newacro]
+\cs{newacro}\oarg{options}\marg{short}\marg{long}
+\end{definition}
+This is a shortcut for
+\begin{alltt}
+\ics{newterm}
+ [%
+ description=\{\ics{capitalisewords}\marg{long}\},%
+ short=\{\cs{acronymfont}\marg{short}\},%
+ long=\marg{long},%
+ text=\{\cs{DTLgidxAcrStyle}\marg{long}\{\cs{acronymfont}\marg{short}\}\},%
+ plural=\{\cs{DTLgidxAcrStyle}\{\meta{long}s\}\{\cs{acronymfont}\{\meta{short}s\}\}\},%
+ sort=\marg{short},%
+ \meta{options}%
+ ]%
+ {\ics{MakeTextUppercase}\marg{short}}
+\end{alltt}
+where \ics{capitalisewords} is defined in \sty{mfirstuc}
+(automatically loaded by \styfmt{datagidx}) and
+\ics{MakeTextUppercase} is defined in \sty{textcase} (automatically
+loaded by \styfmt{datagidx}). The other commands used are defined by
+\styfmt{datagidx}:
+\begin{definition}[\DescribeMacro\acronymfont]
+\cs{acronymfont}
+\end{definition}
+By default this just typesets its argument but can be redefined if
+the acronyms need to be typeset in a certain style (such as small
+caps).
+\begin{definition}[\DescribeMacro\DTLgidxAcrStyle]
+\cs{DTLgidxAcrStyle}\marg{long}\marg{short}
+\end{definition}
+This governs how the acronym is typeset in the \csopt{newterm}{text}
+field. This defaults to: \meta{long} (\meta{short}).
+
+\subsection{Using Acronyms}
+
+You can use terms that represent acronyms via commands such as
+\ics{useentry}. For example, if you define the following in the
+preamble:
+\begin{verbatim}
+\newacro{css}{cascading style sheet}
+\end{verbatim}
+then later in the text you can use:
+\begin{verbatim}
+\useentry{css}{Short}
+\end{verbatim}
+to access the short form and
+\begin{verbatim}
+\useentry{css}{Long}
+\end{verbatim}
+to access the long form. You can also use
+\begin{verbatim}
+\useentry{css}{Text}
+\end{verbatim}
+(or \verb|\gls{css}|) to access the full version. However with
+acronyms you generally only want the full form on first use and just
+the short form on subsequent use. The following commands are
+provided to do that. The singular form is obtained using:
+\begin{definition}[\DescribeMacro\acr]
+\cs{acr}\marg{label}
+\end{definition}
+The plural form is obtained using:
+\begin{definition}[\DescribeMacro\acrpl]
+\cs{acrpl}\marg{label}
+\end{definition}
+
+Note that, unlike the \sty{glossaries} package, \cs{acr} isn't the
+same as \cs{gls}. With \styfmt{datagidx}, \cs{gls} always references
+the \csopt{newterm}{text} field. There is no ``first'' field.
+
+As a general rule, you're not supposed to capitalise the first
+letter of an acronym (especially if it is displayed in small caps) but if you need to
+you can use:
+\begin{definition}[\DescribeMacro\Acr]
+\cs{Acr}\marg{label}
+\end{definition}
+and
+\begin{definition}[\DescribeMacro\Acrpl]
+\cs{Acrpl}\marg{label}
+\end{definition}
+
+\subsection{Unsetting and Resetting Acronyms}
+
+You can reset a term so it's marked as not used with:
+\begin{definition}[\DescribeMacro\glsreset]
+\cs{glsreset}\marg{label}
+\end{definition}
+or you can unset a term so it's marked as used with:
+\begin{definition}[\DescribeMacro\glsunset]
+\cs{glsunset}\marg{label}
+\end{definition}
+
+You can reset all the terms defined in a given database using:
+\begin{definition}[\DescribeMacro\glsresetall]
+\cs{glsresetall}\marg{db name}
+\end{definition}
+or unset all the terms defined in a given database using:
+\begin{definition}[\DescribeMacro\glsunsetall]
+\cs{glsunsetall}\marg{db name}
+\end{definition}
+where \meta{db name} is the name of the database as supplied when
+the database was defined using \ics{newgidx}.
+
+\section{Conditionals}
+
+You can test if a term exists using
+\begin{definition}[\DescribeMacro\iftermexists]
+\cs{iftermexists}\marg{label}\marg{true part}\marg{false part}
+\end{definition}
+You can test if a term has been used using:
+\begin{definition}[\DescribeMacro\ifentryused]
+\cs{ifentryused}\marg{label}\marg{true part}\marg{false part}
+\end{definition}
+
+\section{Displaying the Index or Glossary}
+\label{sec:printterms}
+
+The index or glossary can be displayed using
+\begin{definition}[\DescribeMacro\printterms]
+\cs{printterms}\oarg{options}
+\end{definition}
+You will need to run \LaTeX\ at least twice to ensure your
+index/glossary is up-to-date. The first run will only display any
+entries that have a ``See'' field defined.
+
+The optional argument \meta{options} is a comma-separated list of
+\meta{key}=\meta{value} options. Available keys:
+\begin{description}
+\item[\csopt{printterms}{database}] The name of the database (as
+given in \ics{newgidx}).
+
+\item[\csopt{printterms}{postdesc}] This may have the value
+\textsf{dot} (put a full stop after the description) or
+\textsf{none} (don't put a full stop after the description).
+
+\item[\csopt{printterms}{prelocation}] This indicates what to put
+before the location list. Available values:
+\begin{description}
+\item[\textsf{none}] Nothing.
+\item[\textsf{enspace}] An en-space.
+\item[\textsf{space}] An ordinary space.
+\item[\textsf{dotfill}] A dotted line (\ics{dotfill}).
+\item[\textsf{hfill}] Expandable space (\ics{hfill}).
+\end{description}
+
+\item[\csopt{printterms}{location}] This indicates how to display
+the location list. Available values:
+\begin{description}
+\item[\textsf{hide}] Don't display the location list.
+\item[\textsf{list}] Display the location list.
+\item[\textsf{first}] Only display the first location in the list.
+\end{description}
+
+\item[\csopt{printterms}{symboldesc}] How to format the symbol in
+relation to the description. Available values:
+\begin{description}
+\item[\textsf{symbol}] Display the symbol but not the description.
+\item[\textsf{desc}] Display the description but not the symbol
+field.
+\item[\textsf{(symbol) desc}] Display the symbol (if defined) in parentheses
+followed by the description.
+\item[\textsf{desc (symbol)}] Display the description followed by
+the symbol (if defined) in parentheses.
+\item[\textsf{symbol desc}] Display the symbol (if defined) followed
+by the description.
+\item[\textsf{desc symbol}] Display the description followed by the
+symbol (if defined).
+\end{description}
+
+\item[\csopt{printterms}{columns}] This should be a positive number
+that indicates the page column layout. If the value is greater
+than~1, the \env{multicols} environment is used (defined in the
+\sty{multicol} package, which is automatically loaded).
+
+\item[\csopt{printterms}{namecase}] Indicates whether any case
+change should be applied to the entry's name field. Available
+values:
+\begin{description}
+\item[\textsf{nochange}] Don't apply a case change.
+\item[\textsf{uc}] Convert the name to uppercase.
+\item[\textsf{lc}] Convert the name to lowercase.
+\item[\textsf{firstuc}] Convert the first letter to uppercase (using
+\ics{makefirstuc} defined in \sty{mfirstuc}).
+\item[\textsf{capitalise}] Capitalise initial letters of each word
+in the name (using \ics{capitalisewords} defined in \sty{mfirstuc}).
+\end{description}
+
+\item[\csopt{printterms}{namefont}] The font changing command to
+apply to the name. (Include the initial backslash.) Declarations may
+be used.
+
+\item[\csopt{printterms}{postname}] What to put after the name.
+
+\item[\csopt{printterms}{see}] Indicates how the cross-reference
+(given in the ``See'' field) should be displayed. Available values:
+\begin{description}
+\item[\textsf{comma}] Insert a comma followed by a space in front of
+the cross-reference.
+\item[\textsf{brackets}] Insert a space before the cross-reference
+and put the cross-reference in parentheses.
+\item[\textsf{dot}] Insert a full stop followed by a space in front
+of the cross-reference.
+\item[\textsf{space}] Insert a space before the cross-reference.
+\item[\textsf{nosep}] Don't insert anything before the
+cross-reference.
+\item[\textsf{semicolon}] Insert a semi-colon followed by a space in
+front of the cross-reference.
+\item[\textsf{location}] Display the cross-reference in the same way
+as a location.
+\end{description}
+
+\item[\csopt{printterms}{child}] Indicates whether child entries
+should have their name displayed. Available values: \textsf{named}
+(display the child's name) and \textsf{noname} (don't display the
+child's name).
+
+\item[\csopt{printterms}{showgroups}] Boolean option that indicates
+whether or not to insert group headings (and a group separator)
+between index groups, if headings are supported by the given style.
+If no value is supplied, \textsf{true} is assumed.
+
+\item[\csopt{printterms}{style}] The style to use. The value should
+be the name of the style. Available styles are listed in
+\autoref{sec:indexstyles}.
+
+\item[\csopt{printterms}{symbolwidth}] Some of the styles allow you
+to specify a width for the symbol field. This width can be specified
+with this option. The value will be ignored by some of the styles.
+
+\item[\csopt{printterms}{locationwidth}] Some of the styles allow you
+to specify a width for the location field. This width can be specified
+with this option. The value will be ignored by some of the styles.
+
+\item[\csopt{printterms}{childsort}] A boolean option that indicates
+whether or not the child entries should be sorted. If \textsf{true}, the
+child entries are listed using the same sort order as the sort
+applied to the database. If \textsf{false}, the child entries are
+listed in the order they were defined. If the value is missing,
+\textsf{true} is assumed.
+
+\item[\csopt{printterms}{heading}] The heading at the start of the
+index/glossary.
+
+\item[\csopt{printterms}{postheading}] What to put immediately after
+the heading.
+
+\item[\csopt{printterms}{sort}] How to sort the database. See
+\autoref{sec:indexsort} for further details.
+
+\item[\csopt{printterms}{balance}] This is a boolean option that
+is only applied if \csopt{printterms}{columns} is greater than~1.
+If \textsf{true}, the columns are balanced. If \textsf{false}, the
+columns aren't balanced. If no value is specified, \textsf{true} is
+assumed.
+
+\end{description}
+
+\subsection{Index or Glossary Styles}
+\label{sec:indexstyles}
+
+The index or glossary style is given by the
+\csopt{newgidx,printterms}{style} key in the optional argument of
+\ics{newgidx} or \ics{printterms}. The following styles are
+available:
+
+\begin{description}
+\item[index]
+The ``index'' style is a basic style for an index. This style
+accepts the \csopt{printterms}{locationwidth} and
+\csopt{printterms}{symbolwidth} keys in \ics{printterms}. This is
+the default style.
+
+\item[indexalign]
+The ``indexalign'' style is similar to the ``index'' style but
+aligns the descriptions.
+
+\item[align]
+The ``align'' style aligns the fields. This style
+accepts the \csopt{printterms}{locationwidth} and
+\csopt{printterms}{symbolwidth} keys in \ics{printterms}.
+
+\item[gloss]
+The ``gloss'' style is a basic glossary style. This style uses
+\begin{definition}[\DescribeMacro\DTLgidxChildSep]
+\cs{DTLgidxChildSep}
+\end{definition}
+as the separator between child entries (defaults to a space) and
+\begin{definition}[\DescribeMacro\DTLgidxPostChild]
+\cs{DTLgidxPostChild}
+\end{definition}
+to indicate what to put after the list of child entries (defaults to
+nothing).
+
+\item[dict]
+The ``dict'' style is designed for dictionary-like glossaries. This
+assumes a hierarchical structure where the top level entries have a
+name. The next level is used to indicate a category (such as
+``adjective'' or ``noun''). If there is only one meaning for the
+term, this level also has a description. If there is more than one
+meaning, each meaning should be a child of the category entry. Only
+third level entries are numbered. No further levels are expected.
+The symbol field is ignored.
+
+If \csopt{printterms}{showgroups} is set, the group headers will be
+placed in a \ics{chapter} (if defined) or in a \ics{section} (if
+\ics{chapter} isn't defined).
+
+This style uses:
+\begin{definition}[\DescribeMacro\DTLgidxCategoryNameFont]
+\cs{DTLgidxCategoryNameFont}\marg{text}
+\end{definition}
+The font used to display the name of the category (first child
+level).
+\begin{definition}[\DescribeMacro\DTLgidxCategorySep]
+\cs{DTLgidxCategorySep}
+\end{definition}
+The category separator. (Defaults to a space).
+\begin{definition}[\DescribeMacro\DTLgidxSubCategorySep]
+\cs{DTLgidxSubCategorySep}
+\end{definition}
+The category separator. (Defaults to a space).
+\begin{definition}[\DescribeMacro\DTLgidxDictPostItem]
+\cs{DTLgidxDictPostItem}
+\end{definition}
+Indicates what to do at the end of each top-level item. (Defaults to
+\cs{par}).
+
+The indentation is given by the length register
+\begin{definition}[\DescribeMacro\datagidxdictindent]
+\cs{datagidxdictindent}
+\end{definition}
+This value defaults to 1em.
+
+\end{description}
+
+For additional commands that affect the style of the indexes or
+glossaries, see the documented code \texttt{datatool-code.pdf}.
+
+\subsection{Sorting the Index or Glossary Database}
+\label{sec:indexsort}
+
+By default the index/glossary databases are sorted according to the
+\texttt{Sort} field using the \ics{dtlwordindexcompare} handler (see
+\autoref{sec:sort}). Note that the \emph{entire} database is sorted,
+which is less efficient that using external indexing applications,
+such as \app{makeindex} or \app{xindy}, which only sort the
+terms that have been used in the document. In addition, the sorting
+algorithm used by \styfmt{datatool} is less efficient than that used
+by a custom-built sorting and collation application.
+
+The database is sorted at the start of \ics{printterms} according to
+the value of the \csopt{printterms}{sort} key supplied by
+\ics{printterms}. To completely suppress the sorting, set this key
+to empty. Example:
+\begin{verbatim}
+\printterms[database=index,sort={},showgroups=false]
+\end{verbatim}
+Note that in the above, I also switched off the group headers as
+they don't make sense with an unsorted index or glossary.
+
+If you want to use a different comparison handler, you can set the
+\csopt{printterms}{sort} key to the required sort command, where you
+can use
+\begin{definition}[\DescribeMacro\DTLgidxCurrentdb]
+\cs{DTLgidxCurrentdb}
+\end{definition}
+to indicate the current database.
+
+For example, to sort using letter rather than word comparison:
+\begin{verbatim}
+\printterms[database=index,
+ sort={\dtlsort{Sort}{\DTLgidxCurrentdb}{\dtlletterindexcompare}}]
+\end{verbatim}
+
+You may recall from earlier that the index/glossary databases have a
+column labelled ``FirstId''. This can be used if you want to sort
+the database according to the order of usage. Example:
+\begin{verbatim}
+\printterms[database=index,
+ sort={\dtlsort{FirstId}{\DTLgidxCurrentdb}{\dtlcompare}}]
+\end{verbatim}
+Note that here I've used the \ics{dtlcompare} handler (which is the
+fastest handler) as I'm only concerned with a numerical rather than
+a string comparison.
+
+The default value of the \csopt{printterms}{sort} key is actually:
+\begin{verbatim}
+\dtlsort{Sort,FirstId}{\DTLgidxCurrentdb}{\dtlwordindexcompare}}
+\end{verbatim}
+This means that entries with duplicate ``Sort'' fields are then
+sorted according to use.
+
+\subsubsection{Optimization}
+\label{sec:optimize}
+
+If you have used \app{xindy} or \app{makeindex}, you'll be
+familiar with the document creation process. The document is first
+compiled, then the indexing application is run to sort and collate
+the entries, then the document is compiled again (and possible once
+more). This involves two (or three) \LaTeX\ runs and one sort and
+collate run. With the \styfmt{datagidx} package, the sorting and
+collation is done every \LaTeX\ run. For a large index, this can be
+quite slow. If you're not editing the index or glossary, you might
+prefer not to have to keep sorting the database whenever you update
+the document. To assist this, \styfmt{datagidx} provides the
+\pkgopt{optimize} package option. This may take the following
+values:
+\begin{description}
+\item[\pkgoptval{off}{optimize}] Don't use the optimize facility.
+(The index/glossary databases will be sorted every run, unless the
+sort is switched off by setting the \csopt{printterms}{sort} key to
+empty.)
+
+\item[\pkgoptval{low}{optimize}] Use the ``low'' optimize setting.
+This only sorts the index/glossary databases every other run.
+(Assuming that the sorting is done via the \cs{printterms}{sort} key
+rather than explicitly using \ics{dtlsort} or \ics{DTLsort}
+somewhere else in the document.) Don't use this option if sorting
+the databases makes the document out-of-date. (For example, the
+group headers use sectioning commands.)
+
+\item[\pkgoptval{high}{optimize}] Use the ``high'' optimize setting.
+This sorts the index/glossary databases on the first run, then
+writes the sorted databases to external files, which are read in on
+subsequent runs. Again this assumes that the sorting is done via the
+\cs{printterms}{sort} key. Don't use this option if you want to edit
+the index/glossary database.
+\end{description}
+
+\section{Package Options}
+\label{sec:datagidxoptions}
+
+The following package options are available for \styfmt{datagidx}:
+\begin{description}
+\item[\pkgopt{optimize}] Sets the optimization. (See
+\autoref{sec:optimize}.)
+
+\item[\pkgopt{columns}] Sets the default number of columns to use
+for the indexes or glossaries. (See \autoref{sec:printterms}.)
+
+\item[\pkgopt{child}] Sets whether or not to show the name in child
+entries, where the style supports this option. (See \autoref{sec:printterms}.)
+
+\item[\pkgopt{namecase}] Sets the case change for the entry's name.
+(See \autoref{sec:printterms}.)
+
+\item[\pkgopt{namefont}] Sets the font for the entry's name.
+(See \autoref{sec:printterms}.)
+
+\item[\pkgopt{postname}] Indicates what to put after the entry's name.
+(See \autoref{sec:printterms}.)
+
+\item[\pkgopt{postdesc}] Indicates what to put after the entry's
+description. (See \autoref{sec:printterms}.)
+
+\item[\pkgopt{prelocation}] Indicates what to put before the entry's
+location. (See \autoref{sec:printterms}.)
+
+\item[\pkgopt{location}] Indicates how to display the entry's
+location. (See \autoref{sec:printterms}.)
+
+\item[\pkgopt{see}] Indicates how to display the entry's
+cross-reference list. (See \autoref{sec:printterms}.)
+
+\item[\pkgopt{symboldesc}] Indicates how to display the entry's
+symbol in relation to the description. (See \autoref{sec:printterms}.)
+
+\item[\pkgopt{compositor}] Sets the location compositor. (See
+\autoref{sec:locations}.)
+
+\item[\pkgopt{draft}] Displays additional information, such as
+target names.
+
+\item[\pkgopt{final}] Hides the draft information.
+
+\item[\pkgopt{verbose}] Use \sty{datatool}'s verbose mode.
+
+\end{description}
+
+\begin{example}{Creating an Index}{ex:index}
+In this document, I have used the \sty{datagidx} package and the
+\sty{hyperref} package. In the preamble, I have the following:
+\begin{verbatim}
+\usepackage{datagidx}
+\usepackage[colorlinks]{hyperref}
+
+\newgidx{index}{Index}% define a database for the index
+
+\DTLgidxSetDefaultDB{index}% set this as the default
+
+\newterm{mac\'edoine}
+\newterm{macram\'e}
+\newterm[label=elite]{{\'e}lite}
+\newterm{reptile}
+\newterm[seealso={reptile}]{crocodylian}
+
+\newterm
+ [%
+ parent=crocodylian
+ ]
+ {crocodile}
+
+\newterm
+ [%
+ parent=crocodylian
+ ]
+ {alligator}
+
+\newterm
+ [%
+ parent=crocodylian,
+ description={(also cayman)}
+ ]
+ {caiman}
+
+\newterm[see={caiman}]{cayman}
+\end{verbatim}
+
+Now here's some code to go in the document:
+\begin{verbatim}
+Here are some words containing accents: \gls{macedoine},
+\gls{macrame} and \gls{elite}. \Gls{elite} requires extra care as it
+starts with an accented letter. A \gls{crocodylian} is a family of
+\glspl{reptile} consisting of \glspl{crocodile}, \glspl{alligator} and
+\glspl{caiman}.
+\end{verbatim}
+This produces the following:
+
+Here are some words containing accents: \gls{macedoine},
+\gls{macrame} and \gls{elite}. \Gls{elite} requires extra care as it
+starts with an accented letter. A \gls{crocodylian} is a family of
+\glspl{reptile} consisting of \glspl{crocodile}, \glspl{alligator} and
+\glspl{caiman}.
+
+The index can then be displayed using:
+\begin{verbatim}
+\printterms
+ [
+ heading={\section*},
+ database=index
+ ]
+\end{verbatim}
+This requires two runs to ensure the index is up-to-date. The
+resulting index is as follows:
+
+\newpage
+\printterms
+ [
+ heading={\section*},
+ database={gidx-index}
+ ]
+
+\par\vskip\baselineskip\noindent
+Here's the code if you want to add the letter groups (I've also
+added a dotted line before the location):
+\begin{verbatim}
+\printterms
+ [
+ heading={\section*},
+ database=index,
+ prelocation=dotfill,
+ showgroups
+ ]
+\end{verbatim}
+which produces:
+\printterms
+ [
+ heading={\section*},
+ database=gidx-index,
+ prelocation=dotfill,
+ showgroups
+ ]
+
+\end{example}
+
\chapter{Pie Charts (\texorpdfstring{\sty{datapie}}{datapie} package)}
\label{sec:datapie}
@@ -5081,7 +6770,9 @@ Now create a pie chart in a figure:
\caption{A pie chart}
\end{figure}
\end{verbatim}
-This creates \autoref{fig:piechart}.
+This creates \autoref{fig:piechart}. The colours used are the
+defaults. See \autoref{ex:piecolours} for an example that changes
+the default colours.
\begin{figure}[htbp]
\centering
@@ -8174,7 +9865,7 @@ Whereas the body of the second letter appears as follows:
This section describes additional commands provided by the
\sty{person} package. More detail can be found in
-the documented code (datatool.pdf).
+the documented code (datatool-code.pdf).
\subsection{Conditionals}
@@ -8242,7 +9933,7 @@ name, full name, gender and label, respectively. (These arguments
must all be command names.) Note that the gender is set to
the definition of \DescribeMacro{\malename}\cs{malename} or
\DescribeMacro{\femalename}\cs{femalename}, as appropriate.\footnote{Predefined names provided by the \sty{person} package are described
-in the documented code (datatool.pdf).} Once these
+in the documented code (datatool-code.pdf).} Once these
commands are set, \meta{body} is applied.
If you only want to iterate through a subset of defined people,
diff --git a/Master/texmf-dist/doc/latex/datatool/datatool.pdf b/Master/texmf-dist/doc/latex/datatool/datatool.pdf
deleted file mode 100644
index 480ffef9ddf..00000000000
--- a/Master/texmf-dist/doc/latex/datatool/datatool.pdf
+++ /dev/null
Binary files differ
diff --git a/Master/texmf-dist/doc/latex/datatool/samples/sample-barchart.pdf b/Master/texmf-dist/doc/latex/datatool/samples/sample-barchart.pdf
index 89ea8bf27c2..60711b2cfcd 100644
--- a/Master/texmf-dist/doc/latex/datatool/samples/sample-barchart.pdf
+++ b/Master/texmf-dist/doc/latex/datatool/samples/sample-barchart.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/latex/datatool/samples/sample-dict.pdf b/Master/texmf-dist/doc/latex/datatool/samples/sample-dict.pdf
new file mode 100644
index 00000000000..90a504b882b
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/datatool/samples/sample-dict.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/latex/datatool/samples/sample-dict.tex b/Master/texmf-dist/doc/latex/datatool/samples/sample-dict.tex
new file mode 100644
index 00000000000..5f2dbee76dc
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/datatool/samples/sample-dict.tex
@@ -0,0 +1,439 @@
+\documentclass[oneside]{scrbook}
+
+\usepackage[T1]{fontenc}
+\usepackage[utf8]{inputenc}
+\usepackage{mathpazo}
+
+% The low optimize setting won't work for this example
+\usepackage[optimize=high]{datagidx}
+
+\usepackage[colorlinks]{hyperref}
+
+% This is an example document that uses datagidx to create a
+% sorted dictionary, using datatool to do the sorting.
+
+% Make a database labelled 'index' with the given title
+
+\newgidx[heading={\title}]{index}{Sample Dictionary Created Using datagidx}
+
+% Define some terms for the dictionary
+
+% First set the default database, so we don't have to keep using the
+% "database" key:
+\DTLgidxSetDefaultDB{index}
+
+% Add some custom fields
+
+\newtermaddfield{Derivatives}{derivatives}{}
+
+\newtermaddfield{Origin}{origin}{}
+
+\newtermaddfield{Phrases}{phrases}{}
+
+\newtermaddfield{Subject}{subject}{}
+
+\newtermaddfield{Variation}{variation}{}
+
+\newtermaddfield{Phonetic}{phonetic}{}
+
+\newtermaddfield{AltPlural}{altplural}{}
+
+\newtermaddfield{Parenthetical}{parenthetical}{}
+
+% Provide a convenient interface to define words:
+
+% Syntax: \newentry[main option list][cat opt list]{word}{category}{definition}
+
+\newcommand*{\newentry}[1][]{%
+ \def\newentryopts{#1}%
+ \nnewentry
+}
+
+\newcommand*{\nnewentry}[4][]{%
+ \expandafter\newterm\expandafter[\newentryopts]{#2}%
+ \newterm
+ [%
+ label={\datagidxlastlabel-#3},%
+ parent={\datagidxlastlabel},%
+ description={#4},%
+ text={#3},%
+ #1%
+ ]%
+ {#3}%
+ \setcounter{newentrysubcat}{0}%
+}
+
+% Syntax: \newentrycat{parent label}{category}{definition}
+
+\newcommand*{\newentrycat}[3]{%
+ \newterm
+ [%
+ label={#1-#2},%
+ parent={#1},%
+ description={#3}%
+ ]%
+ {#2}%
+ \setcounter{newentrysubcat}{0}%
+}
+
+% Syntax: \newentrysubcat[option list]{parent label}{description}
+
+\newcounter{newentrysubcat}
+
+\newcommand*{\newentrysubcat}[3][]{%
+ \stepcounter{newentrysubcat}%
+ \newterm
+ [%
+ label={#2-\arabic{newentrysubcat}},%
+ sort={#2-\arabic{newentrysubcat}},%
+ parent={#2},%
+ description={#3},%
+ #1%
+ ]
+ {}%
+}
+
+\newcommand*{\categoryand}{ \& }
+
+% hook into the mechanism that constructs the label and sort fields from
+% the name:
+
+\appto\newtermlabelhook{\def\categoryand{+}}
+
+\newcommand*{\namefont}[1]{\textbf{\sffamily #1}}
+\newcommand*{\subjectfont}[1]{\textsf{#1}}
+\newcommand*{\categoryfont}[1]{\namefont{#1}}
+\newcommand*{\originfont}[1]{\emph{#1}}
+\newcommand*{\derivativeformat}[2]{\textbf{#1}\space\textsf{#2}}
+\newcommand*{\phoneticformat}[1]{/#1/}
+
+\newcommand*{\stress}[1]{\textbf{#1}}
+
+\newcommand*{\crossref}[1]{\textbf{\useentry{#1}{Name}}}
+\newcommand*{\Crossref}[1]{\textbf{\textsc{\useentry{#1}{Name}}}}
+
+% Words and their definitions taken from the Compact Oxford English
+% Dictionary
+
+% label and sort must both be specified here as \newterm can't cope
+% with {\ae} when automatically generating the label and sort from
+% the name
+\newentry
+ [%
+ phonetic={ee-\stress{oh}-li-uhn},
+ origin={from \originfont{\AE olus}, the Greek god of the winds},
+ label=aeolian,
+ sort=aeolian
+ ]
+ {{\ae}olian harp}{noun}{a stringed instrument that produces musical
+sounds when a current of air passes through it}
+
+% Similarly label and sort are needed here
+\newentry
+ [%
+ phonetic={i-\stress{sof}-fuh-guhss},
+ plural={{Å“}sophagi},
+ origin={Greek \originfont{oisophagos}},
+ label={oesophagus},
+ sort={oesophagus}
+ ]
+ {{Å“}sophagus}{noun}{the muscular tube which connects throat to
+stomach}
+
+\newentry
+ [% additional info
+ origin={Old English}
+ ]%
+ [%
+ subject={literary}
+ ]
+ {asunder}{adverb}{apart}
+
+\newentry
+ [% additional info
+ origin={Old English},
+ parenthetical={\subjectfont{US} \namefont{adz}}
+ ]
+ {adze}{noun}{a tool similar to an axe, with an arched blade at right angles to
+ the handle}
+
+\newentry
+ [% additional info
+ origin={Latin \originfont{astutus}},
+ derivatives={\derivativeformat{astutely}{adverb}
+ \derivativeformat{astuteness}{noun}}
+ ]
+ {astute}{adjective}{good at making accurate judgements; shrewd}
+
+\newentry{astern}{adverb}{behind or towards the rear of a ship}
+
+\newentry{thunderbolt}{noun}{flash of lightning with a crash of
+thunder at the same time}
+
+\newentry{thunderclap}{noun}{a crash of thunder}
+
+\newentry
+ [%
+ origin={Italian \originfont{ticchio}}
+ ]
+ {tic}{noun}{a recurring spasm of the muscles, most often in
+the face}
+
+\newentry
+ [%
+ phonetic={thwort},
+ origin={from Old Norse, `transverse'}
+ ]
+ {thwart}{verb}{}
+
+\newentrysubcat{thwart-verb}{prevent someone from accomplishing
+something}
+
+\newentrysubcat{thwart-verb}{prevent something from succeeding}
+
+\newentrycat{thwart}{noun}{a crosspiece forming a seat for a rower
+in a boat}
+
+\newentry
+ [% additional info
+ origin={from an old sense of \Crossref{thwart}, meaning
+`across'},
+ phonetic={uh-\stress{thwart}}
+ ]
+ {athwart}{preposition\categoryand adverb}{from side to side of something;
+ across}
+
+\newentry
+ [%
+ phonetic={aw-\stress{bree}-shuh},
+ parenthetical={also \namefont{aubrietia}},
+ origin={named after the French botanist Claude \originfont{Aubriet}}
+ ]
+ {aubretia}{noun}{a trailing plant with purple, pink, or white
+flowers}
+
+\newentry
+ [%
+ phonetic={aw-\stress{day}-shuhss},
+ derivatives={\derivativeformat{audaciously}{adverb}
+ \derivativeformat{audaciousness}{noun}
+ \derivativeformat{audacity}{noun}},
+ origin={Latin \originfont{audax} `bold'}
+ ]
+ {audacious}{adjective}{}
+
+\newentrysubcat{audacious-adjective}{willing to take daring risks}
+\newentrysubcat{audacious-adjective}{showing lack of respect; rude
+or impudent}
+
+\newentry
+ [%
+ parenthetical={pl.\ \namefont{attorneys}},
+ phonetic={uh-\stress{ter}-ni},
+ origin={Old French \originfont{atorner} `assign'}
+ ]
+ {attorney}{noun}{}
+
+\newentrysubcat{attorney-noun}{a person appointed to act for another
+in legal matters}
+
+\newentrysubcat
+ [%
+ subject={chiefly US}%
+ ]
+ {attorney-noun}{a lawyer}
+
+\newentry
+ [
+ phonetic={\stress{ay}-tri-uhm},
+ altplural={atria},
+ parenthetical={pl.\ \namefont{atria}
+ \phoneticformat{\stress{ay}-tri-uh}
+ or \namefont{atriums}},
+ derivatives={\derivativeformat{atrial}{adjective}},
+ origin={Latin}
+ ]
+ {atrium}{noun}{}
+
+\newentrysubcat{atrium-noun}{a central hall rising through several
+storeys and having a glazed roof}
+
+\newentrysubcat{atrium-noun}{an open area in the centre of an
+ancient Roman house}
+
+\newentrysubcat{atrium-noun}{each of the two cavities of the heart}
+
+\newentry
+ [%
+ plural={austerities},
+ phonetic={oss-\stress{te}-ri-ti}
+ ]
+ {austerity}{noun}{}
+
+\newentrysubcat{austerity-noun}{strictness or severity of appearance
+or manner}
+\newentrysubcat{austerity-noun}{difficult economic conditions
+resulting from a cut in public spending}
+
+\newentry
+[
+ plural={cacti},
+ altplural={cactuses},
+ origin={Greek \originfont{kaktos} `cardoon'}
+]
+{cactus}{noun}{a succulent plant with thick fleshy stems bearing
+spikes but no leaves}
+
+\newentry
+ [%
+ phonetic={chahf},
+ phrases={\namefont{separate} (or \namefont{sort}) \namefont{the
+ wheat from the chaff} distinguish valuable people or things from
+ worthless ones},
+ origin={Old English}
+ ]
+ {chaff\textsuperscript{1}}{noun}{}
+
+\newentrysubcat{chaff1-noun}{the husks of grain from the seed by
+winnowing or threshing}
+
+\newentrysubcat{chaff1-noun}{chopped hay and straw used in cattle
+fodder}
+
+\newentry
+ [
+ phonetic={chaff},
+ ]
+ {chaff\textsuperscript{2}}{noun}{light-hearted joking}
+
+\newentrycat{chaff2}{verb}{tease someone}
+
+\newterm
+[
+ plural={elves},%
+ derivatives={\derivativeformat{elfish}{adjective}
+ \derivativeformat{elven}{adjective (literary)}
+ \derivativeformat{elvish}{adjective}},%
+ origin={Old English},%
+ description={a supernatural creature of folk tales, represented as
+ a small human figure with pointed ears}
+]
+{elf}
+
+% Be careful of words starting with an accent.
+
+\newterm
+ [
+ label={elite},%
+ phonetic={i-\stress{leet}},%
+ origin={French, `selection, choice'}%
+ ]
+ {{é}lite}
+
+\newentrycat{elite}{noun}{a group of people regarded as the best in a
+particular society or organisation}
+
+\newterm
+ [
+ description={plural of \Crossref{elf}}%
+ ]
+ {elves}
+
+% Add all entries
+
+\glsaddall{index}
+
+% Customise index format
+
+\renewcommand{\DTLgidxNameFont}[1]{\namefont{\large#1}}
+
+\newcommand{\postnamespace}{\space}
+
+\renewcommand{\DTLgidxPostName}{%
+ \ifdefempty\Subject
+ {%
+ }%
+ {%
+ \space\subjectfont{\Subject}%
+ }%
+ \ifdefempty\Phonetic
+ {%
+ }%
+ {%
+ \space\phoneticformat{\Phonetic}%
+ }%
+ \ifdefempty\Parenthetical
+ {%
+ \ifdefempty\AltPlural
+ {%
+ \ifthenelse{\equal{\Plural}{\Text s}}%
+ {%
+ }%
+ {%
+ \space (pl.\ \namefont{\Plural})%
+ }%
+ }%
+ {%
+ \space (pl. \namefont{\Plural} or \namefont{\AltPlural})%
+ }%
+ }%
+ {%
+ \space (\Parenthetical)%
+ }%
+ \postnamespace
+}
+
+\renewcommand{\DTLgidxCategoryNameFont}[1]{\categoryfont{#1}}
+\renewcommand{\DTLgidxCategorySep}{\space\textbullet\space}
+\renewcommand*{\DTLgidxChildCountLabel}{%
+ \def\postnamespace{~\def\postnamespace{\space}}%
+ \textbf{\sffamily\theDTLgidxChildCount}%
+}
+
+\renewcommand{\DTLgidxDictPostItem}{%
+ \ifdefempty\Derivatives
+ {}
+ {%
+ \par
+ \datagidxdictparshape
+ -- \textsc{derivatives} \Derivatives.
+ }%
+ \ifdefempty\Phrases
+ {}
+ {%
+ \par
+ \datagidxdictparshape
+ -- \textsc{phrases} \Phrases.
+ }%
+ \ifdefempty\Origin
+ {}
+ {%
+ \par
+ \datagidxdictparshape
+ -- \textsc{origin} \Origin.
+ }%
+ \par
+}
+
+% Title information
+\author{}
+\date{}
+
+\begin{document}
+% don't number the chapters
+\setcounter{secnumdepth}{-1}
+
+\printterms
+[
+ database=index,
+ postheading={\maketitle This is an example document illustrating
+ the use of the datagidx package. The examples here are taken from
+ the Compact Oxford English Dictionary.
+ },
+ columns=2,
+ postdesc=dot,%
+ childsort=false,% don't sort the child lists
+ style={dict} % use the 'dict' style
+]
+
+\end{document}
diff --git a/Master/texmf-dist/doc/latex/datatool/samples/sample-gidx.pdf b/Master/texmf-dist/doc/latex/datatool/samples/sample-gidx.pdf
new file mode 100644
index 00000000000..eb3c2b9f78f
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/datatool/samples/sample-gidx.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/latex/datatool/samples/sample-gidx.tex b/Master/texmf-dist/doc/latex/datatool/samples/sample-gidx.tex
new file mode 100644
index 00000000000..e5c0d2eafb5
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/datatool/samples/sample-gidx.tex
@@ -0,0 +1,644 @@
+\documentclass{book}
+
+\usepackage{datagidx}
+
+\usepackage[colorlinks]{hyperref}
+
+\usepackage{fmtcount}
+
+\DTLgidxAddLocationType{numberstringnum}
+
+ % Define some convenient commands
+
+\newcommand*{\principleloc}[1]{\textbf{#1}}
+\newcommand*{\glossaryloc}[1]{\textit{#1}}
+\newcommand*{\appname}[1]{\texttt{#1}}
+
+ % Don't let \appname interfere with the sorting and labelling of
+ % terms:
+
+\appto\newtermlabelhook{\let\appname\DTLgidxNoFormat}
+
+ % (datagidx also does this for \MakeUppercase, \MakeTextUppercase,
+ % \MakeLowercase, \MakeTextLowercase, \textsc and \acronymfont.)
+
+ % Make an index database labelled 'index' with given title.
+ % (Omit optional argument to affect all indexing databases
+ % or use a comma-separated list of labels for each database
+ % to affect.)
+
+\newgidx[heading=\chapter]{index}{Index}
+
+ % Add custom fields to the 'index' database
+
+\newtermaddfield[index]{Ed}{ed}{\field{text}ed}
+
+\newtermaddfield[index]{Ing}{ing}{\field{text}ing}
+
+\newtermaddfield[index]{AltPlural}{altplural}{}% no default value
+
+ % Define some convenience commands to access these fields
+
+\newcommand*{\glsed}[1]{\useentry{#1}{Ed}}
+\newcommand*{\glsing}[1]{\useentry{#1}{Ing}}
+\newcommand*{\glsaltpl}[1]{\useentry{#1}{AltPlural}}
+
+ % Make a glossary database labelled 'glossary' with given title.
+
+\newgidx[heading=\section]{glossary}{Glossary}
+
+ % Make an acronym database labelled 'acronyms' with given title.
+ % A different heading for the table of contents is supplied.
+
+\newgidx[heading={\section[Acronyms]}]{acronyms}{List of Acronyms}
+
+ % Make a notation database labelled 'notation' with given title
+
+\newgidx[heading=\section]{notation}{Notation}
+
+ % Define some terms for the index
+
+ % Either use "database" key in optional argument
+ % or set the default database. It's less typing to set the default
+ % database, so let's do that:
+
+\DTLgidxSetDefaultDB{index}
+
+ % These definitions will add terms to the "index" database:
+
+\newterm{singular}
+\newterm{plural}
+\newterm
+ [% options
+ label=pluralalt,
+ parent=plural,
+ see={altplural}
+ ]
+ {alternative}
+\newterm[label=altplural]{alternative plural}
+\newterm{group}
+\newterm[see=group]{scope}
+\newterm[label={ind-glossary}]{glossary}
+\newterm
+ [%
+ label={ind-index},
+ seealso={ind-glossary},
+ ]
+ {index}
+\newterm
+ [
+ seealso={ind-glossary}
+ ]
+ {acronym}
+\newterm[parent=acronym]{reset}
+\newterm
+ [%
+ parent=acronym,
+ label={firstuse},
+ ]
+ {first use}
+\newterm
+ [%
+ parent=acronym,
+ label={acronymlist},
+ text={list of acronyms},
+ plural={lists of acronyms}
+ ]
+ {list}
+
+ % Be careful if a value contains a comma or an equal sign. The
+ % entire value must be grouped.
+\newterm
+ [%
+ label={comma},
+ sort={,},
+ text={comma (,)},
+ plural={commas (,)}
+ ]%
+ {, (comma)}
+
+\newterm
+ [%
+ label={equals},
+ sort={=},
+ text={equal sign (=)},
+ plural={equal signs (=)},
+ ]%
+ {= (equal sign)}
+
+ % Don't need to worry about makeindex's special characters (since
+ % we're not using makeindex!)
+\newterm
+ [%
+ label={"},
+ sort={"},
+ text={double quote (")},
+ plural={double quotes (")},
+ ]%
+ {" (double quote)}
+
+\newterm
+ [%
+ label={!},
+ sort={!},
+ text={exclamation mark (!)},
+ plural={exclamation marks (!)},
+ ]%
+ {! (exclamation mark)}
+
+\newterm
+ [%
+ label={|},
+ sort={|},
+ text={vertical bar (\textbar)},
+ plural={vertical bars (\textbar)},
+ ]%
+ {\textbar\ (vertical bar)}
+
+
+ % Be careful of special characters
+
+\newterm
+ [%
+ label={amp},
+ sort={\DTLgidxStripBackslash{\&}},
+ text={ampersand (\&)},
+ plural={ampersands (\&)},
+ ]
+ {\& (ampersand)}
+
+\newterm
+ [%
+ label={underscore},
+ sort={\DTLgidxStripBackslash{\_}},
+ text={underscore (\_)},
+ plural={underscores (\_)},
+ ]
+ {\_ (underscore)}
+
+\newterm
+ [%
+ label={dollar},
+ sort={\DTLgidxStripBackslash{\$}},
+ text={dollar (\$)},
+ plural={dollars (\$)},
+ ]
+ {\$ (dollar)}
+
+\newterm
+ [%
+ label={circum},
+ sort={\DTLgidxStripBackslash{\^}},
+ text={circumflex (\textasciicircum)},
+ plural={circumflexes (\textasciicircum)},
+ ]
+ {\textasciicircum\ (circumflex)}
+
+\newterm
+ [%
+ label={tilde},
+ sort={\string~},
+ text={tilde (\textasciitilde)},
+ plural={tildes (\textasciitilde)},
+ ]
+ {\textasciitilde\ (tilde)}
+
+\newterm
+ [
+ label={0},
+ sort={0},
+ ]
+ {0 (zero)}
+
+\newterm
+ [
+ label={1},
+ sort={1},
+ ]
+ {1 (one)}
+
+\newterm
+ [
+ label={2},
+ sort={2},
+ ]
+ {2 (two)}
+
+\newterm
+ [
+ label={3},
+ sort={3},
+ ]
+ {3 (three)}
+
+ % Let's index a person
+\newterm
+ [%
+ label={knuth},
+ text={Knuth},
+ ]
+ {Knuth, Donald E.}
+
+ % and have a few more entries in the same letter group to test case
+ % ordering:
+\newterm{kite}
+\newterm{koala}
+
+ % Earlier I modified \newtermlabelhook so
+ % that \appname won't interfere with the sorting
+ % and labelling mechanism, so I don't need to specify separate sort
+ % and label keys here:
+
+\newterm{\appname{makeindex}}% label and sort both set to just 'makeindex'
+\newterm{\appname{xindy}}% label and sort both set to just 'xindy'
+
+ % Define some terms for the glossary
+
+\DTLgidxSetDefaultDB{glossary}
+
+\newterm[description={sea mammal with flippers that eats fish}]{seal}
+\newterm[description={large seal}]{sea lion}
+
+\newterm{bravo}
+\newterm
+ [%
+ label=bravocry,
+ description={cry of approval (pl.\ bravos)},
+ parent=bravo
+ ]
+ {bravo}
+\newterm
+ [% options
+ label=bravokiller,
+ description={hired ruffian or killer (pl.\ bravoes)},
+ plural=bravoes,
+ parent=bravo
+ ]
+ {bravo}
+
+\newterm
+ [% options
+ text={glossary\glsadd{ind-glossary}},
+ plural={glossaries\glsadd{ind-glossary}},
+ ]%
+ {glossary\glsadd{ind-glossary}}
+
+\newterm
+ [% options
+ label=glossarycol,
+ text={glossary\glsadd{ind-glossary}},
+ plural={glossaries\glsadd{ind-glossary}},
+ description={collection of glosses},
+ parent=glossary
+ ]
+ {glossary\glsadd{[glossaryloc]ind-glossary}}
+
+\newterm
+ [% options
+ label=glossarylist,
+ text={glossary\glsadd{ind-glossary}},
+ plural={glossaries\glsadd{ind-glossary}},
+ description={list of technical words},
+ parent=glossary
+ ]
+ {glossary\glsadd{[glossaryloc]ind-glossary}}
+
+\newterm
+ [%
+ plural={indices\glsadd{ind-index}},
+ altplural={indexes},
+ text={index\glsadd{ind-index}},
+ description={an alphabetical list of names or subjects with
+ references to their location in the document (pl.\ indices or
+ indexes)}
+ ]
+ {index\glsadd{[glossaryloc]ind-index}}
+
+\newterm
+ [% options
+ label=pglist,
+ % description contains commas so it must be grouped
+ description={a list of individual pages or page ranges
+ (e.g.\ 1,2,4,7--9)}
+ ]
+ {page list}
+
+ % define some acronyms
+
+\DTLgidxSetDefaultDB{acronyms}
+
+ % Let's redefine \newacro so that the short form is also indexed:
+
+\renewcommand{\newacro}[3][]{%
+ \newterm[database=index,label={ind-#2-long},see={ind-#2}]{#3}%
+ \newterm[database=index,label={ind-#2}]{\acronymfont{#2}}%
+ \newterm
+ [%
+ description={\capitalisewords{#3}},% long form capitalised
+ text={\DTLgidxAcrStyle{#3}{\acronymfont{#2}}},% produced via \gls
+ plural={\DTLgidxAcrStyle{#3}{\acronymfont{#2}}},% produced via \glspl
+ short={\acronymfont{#2}\glsadd{ind-#2}},% short form
+ long={#3},% long form
+ sort={#2},% sort on short form
+ #1%
+ ]%
+ {#2\glsadd{[glossaryloc]ind-#2}}
+}
+
+\newacro{html}{hyper-text markup language}
+\newacro{css}{cascading style sheet}
+\newacro{xml}{extensible markup language}
+
+% define some notation
+
+\DTLgidxSetDefaultDB{notation}
+
+\newterm
+ [%
+ symbol={\ensuremath{\mathcal{S}}},
+ description={a collection of distinct objects},
+ ]%
+ {set}
+
+\newterm
+ [%
+ parent=set,
+ symbol={\ensuremath{\mathcal{U}}},
+ text={universal set},
+ description={the set containing everything}
+ ]%
+ {universal}
+
+\newterm
+ [%
+ parent=set,
+ symbol={\ensuremath{\emptyset}},
+ text={empty set},
+ description={the set with no elements}
+ ]%
+ {empty}
+
+\newterm
+ [%
+ symbol={\ensuremath{|\mathcal{S}|}},
+ description={the number of elements in the set \ensuremath{\mathcal{S}}}
+ ]%
+ {cardinality}
+
+\title{Sample Document Using the datagidx Package}
+\author{Nicola L. C. Talbot}
+
+\begin{document}
+\pagenumbering{alph}% Stop hyperref complaining about duplicate page identifiers
+\maketitle
+\thispagestyle{empty}%
+
+\frontmatter
+
+\tableofcontents
+
+\chapter{Summary}
+
+This is a sample document illustrating the use of the
+\texttt{datagidx} package to create document \glspl{index},
+\glspl{glossarylist} and \glspl{acronymlist} without the use of
+external \glsing{index} % custom command defined earlier
+applications, such as \gls{makeindex} or
+\gls{xindy}. Please read the user guide (datatool-user.pdf) for
+further guidance.
+
+\mainmatter
+
+\chapter{Introduction}
+%\renewcommand{\thepage}{\numberstring{page}}
+
+Words can be \glsed{index}. % custom command defined earlier.
+
+A \gls{glossarylist}\glsadd{[principleloc]ind-glossary} is a useful addition to any technical document,
+although a \gls{glossarycol} can also simply be a collection of
+glosses, which is another thing entirely. Some documents have
+multiple \glspl{glossarylist}.
+
+A \gls{bravocry} is a cry of approval (plural \glspl{bravocry}) but a
+\gls{bravokiller} can also be a hired ruffian or killer (plural
+\glspl{bravokiller}).
+
+\section{Characters}
+
+When defining entries be careful of \glspl{comma} and \glspl{equals}
+so they don't interfere with the key=value mechanism. The sort and
+label keys get expanded so be careful of special characters, such as
+\gls{amp}, \gls{underscore}, \gls{circum}, \gls{dollar} and \gls{tilde}.
+
+Since we're not using \gls{makeindex}, we don't need to worry about
+\gls{makeindex}'s special characters, such as \gls{"}, \gls{!} and
+\gls{|}. (Unless they've been made active by packages such as
+\texttt{ngerman} or \texttt{babel}.)
+
+Non-alphabetical characters are usually grouped at the start of an
+index, and are usually followed by the number group. That is, the
+group of entries that are numerical, such as \gls{0}, \gls{1},
+\gls{2} and \gls{3}.
+
+\section{Custom Fields}
+
+You can add custom fields. For example, this document has added
+three custom fields to the `index' database.
+
+\section{Plurals}
+
+The \gls{plural} of \gls{glossarylist} is
+\glspl{glossarylist}. The \gls{plural} of \gls{index} is
+\glspl{index}. Some words have an \gls{altplural}. For example,
+an alternative to \glspl{index} is
+\glsaltpl{index}.% custom command defined earlier
+
+\section{Sorting}
+
+The only type of sorting available is letter sorting. If you want
+word sorting you'll need to use \gls{makeindex} or \gls{xindy}.
+So ``\gls{sea lion}'' comes after ``\gls{seal}''.
+
+The default sort is case-insensitive so \gls{kite} before
+\gls{knuth} and \gls{knuth} before \gls{koala}.
+
+\section{Using without indexing}
+
+Here's a defined entry that won't get into the glossary.
+Name: \glsdispentry{pglist}{Name}.
+Description: \glsdispentry{pglist}{Description}.
+(Unless I~later reference it using a command like \verb|\gls|.)
+
+\section{Links to Entries}
+
+You can reference and index entries using \verb|\gls|, \verb|\Gls|,
+\verb|\glspl|, \verb|\Glspl|, \verb|\glssym| and \verb|\Glssym|.
+(Note, if you're used to using the \texttt{glossaries} package
+the syntax is different.)
+
+Or you can reference a particular field using \verb|\useentry| or
+\verb|\Useentry|. So here's the description for \gls{seal}:
+\useentry{seal}{Description}.
+
+If the \texttt{hyperref} package has been loaded, commands like
+\verb|\gls| will link to the relevant entry in the glossary or
+index. Referencing using \verb|\glsdispentry| and
+\verb|\Glsdispentry| won't have hyperlinks.
+
+\subsection{Enabling and Disabling Hyperlinks}
+
+If the \texttt{hyperref} package has been loaded, hyperlinks can be
+enabled and disabled. Either globally
+\DTLgidxDisableHyper
+(here's a reference to \gls{seal} without a hyperlink
+\DTLgidxEnableHyper
+ and here's a reference to \gls{seal} with a hyperlink)
+or locally
+({%
+ \DTLgidxDisableHyper
+ here's a reference to \gls{seal} without a hyperlink
+}%
+and here's a reference to \gls{seal} with a hyperlink).
+
+\section{Acronyms}
+
+\glsadd{firstuse}Here's an \gls{acronym} referenced using \verb|\acr|: \acr{html}. And here
+it is again: \acr{html}. If you're used to the \texttt{glossaries}
+package, note the difference in using \verb|\gls|: \gls{html}.
+And again (no difference): \gls{html}.
+
+Now let's switch to displaying acronyms with a footnote.
+ % syntax: \DTLgidxAcrStyle{long}{short}
+\renewcommand*{\DTLgidxAcrStyle}[2]{%
+ #2\footnote{#1.}%
+}%
+First use: \acr{xml}. Next use: \acr{xml}.
+
+However it would look better if the footnote text started with a
+capital letter, so let's tweak things a bit.
+ % syntax: \DTLgidxFormatAcr{label}{long field}{short field}
+\renewcommand*{\DTLgidxFormatAcr}[3]{%
+ \DTLgidxAcrStyle{\Glsdispentry{#1}{#2}}{\useentry{#1}{#3}}%
+}%
+ % syntax: \DTLgidxFormatAcr{label}{long field}{short field}
+\renewcommand*{\DTLgidxFormatAcrUC}[3]{%
+ \DTLgidxAcrStyle{\Glsdispentry{#1}{#2}}{\Useentry{#1}{#3}}%
+}%
+Try with another acronym: \acr{css}. Next use: \acr{css}.
+
+\glsadd{reset}Reset: \glsresetall{acronyms}%
+\renewcommand*{\DTLgidxAcrStyle}[2]{#1 (#2)}%
+\renewcommand*{\DTLgidxFormatAcr}[3]{%
+ \DTLgidxAcrStyle{\glsdispentry{#1}{#2}}{\useentry{#1}{#3}}%
+}%
+\renewcommand*{\DTLgidxFormatAcrUC}[3]{%
+ \DTLgidxAcrStyle{\Glsdispentry{#1}{#2}}{\useentry{#1}{#3}}%
+}%
+Here are the acronyms again:
+\acr{html}, \acr{xml} and \acr{css}.
+Next use:
+\acr{html}, \acr{xml} and \acr{css}.
+Full form:
+\gls{html}, \gls{xml} and \gls{css}.
+
+Reset again. \glsresetall{acronyms}%
+Start with a capital. \Acr{html}.
+Next: \Acr{html}. Full: \Gls{html}.
+
+Prefer small-caps?
+\renewcommand{\acronymfont}[1]{\textsc{#1}}%
+\Acr{css}. Next: \acr{css}. Full: \gls{css}.
+
+Prefer capitals?
+\renewcommand{\acronymfont}[1]{\MakeTextUppercase{#1}}%
+\Acr{xml}. Next: \acr{xml}. Full: \gls{xml}.
+
+\section{Conditionals}
+
+You can test if a term has been defined using \verb|\iftermexists|.
+For example: \iftermexists{seal}{seal exists}{seal doesn't exist}.
+Another example: \iftermexists{jabberwocky}{jabberwocky
+exists}{jabberwocky doesn't exist}.
+
+You can test if a term has been used via \verb|ifentryused|.
+For example: \ifentryused{seal}{seal has been used}{seal hasn't been
+used.}
+Another example: \ifentryused{pglist}{pglist has been used}{pglist
+hasn't been used}.
+
+
+\section{Symbols}
+
+Terms may have an associated symbol. The symbol can be accessed
+using \verb|\glssym| or if you don't want to add information to the
+location list you can use \verb|\glsdispentry|. Here's the symbol
+associated with the \gls{cardinality} entry:
+\glsdispentry{cardinality}{Symbol}.
+
+A \gls{set} (denoted \glssym{set}) is a collection of objects.
+The \gls{universal} is the set of everything.
+The \gls{empty} contains no elements.
+The \gls{cardinality} of a set (denoted \glssym{cardinality}) is the
+number of elements in the set.
+
+\section{Location Ranges}
+
+A range is formed if a location sequence contains more than 2
+locations. Here's \gls{seal} again.
+
+\backmatter
+ % suppress section numbering
+\setcounter{secnumdepth}{-1}
+
+\chapter{Glossaries}
+
+\printterms
+ [
+ database=glossary,% 'glossary' database
+ columns=1,% one column page layout
+ postdesc=dot,% put a full stop after the description
+ style=gloss,% use 'gloss' style (sub-entries numbered)
+ namefont={\textbf},% put the name in bold
+ namecase=firstuc,% make the first letter of the name upper case
+ child=noname,% don't print sub item names
+ childsort=false,% don't sort the child lists
+% location=hide% hide the location list
+ ]
+
+\printterms
+ [
+ database=acronyms,% 'acronyms' database
+ postdesc=dot,% put a full stop after the description
+ columns=1,% one column page layout
+ namefont={\textbf},% put the name (i.e. the abbreviation) in bold
+ namecase=uc,% make the name upper case
+ style=align,% use the 'align' style
+% location=hide% hide the location list
+ ]
+
+\printterms
+ [
+ database=notation,% 'notation' database
+ postdesc=dot,% put a full stop after the description
+ columns=1,% one page column layout
+ namefont={\textbf},% make the name bold
+ style=indexalign,
+ namecase=firstuc,% make first letter of name a capital
+ symboldesc={desc (symbol)},% put symbol to the right of the description
+ sort={}% don't sort
+ ]
+
+\printterms
+ [
+ database=index,% 'index' database
+ prelocation=dotfill,% put a dotted line before the location list
+ columns=2,% page layout
+ style=index,% use 'index' style
+ %balance=false,% don't balance columns
+ postheading={Locations in bold indicate primary reference.
+ Locations in italic indicate definitions in the
+ glossaries.}
+ ]
+
+
+\end{document}
diff --git a/Master/texmf-dist/doc/latex/datatool/samples/sample-glossary.pdf b/Master/texmf-dist/doc/latex/datatool/samples/sample-glossary.pdf
new file mode 100644
index 00000000000..df054ced862
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/datatool/samples/sample-glossary.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/latex/datatool/samples/sample-glossary.tex b/Master/texmf-dist/doc/latex/datatool/samples/sample-glossary.tex
new file mode 100644
index 00000000000..b24fa252894
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/datatool/samples/sample-glossary.tex
@@ -0,0 +1,245 @@
+\documentclass{article}
+
+\usepackage{datagidx}
+
+\usepackage[colorlinks]{hyperref}
+
+ % Make a glossary database labelled 'glossary' with given title.
+
+\newgidx[heading=\section]{glossary}{Glossary}
+
+ % Make an acronym database labelled 'acronyms' with given title.
+ % A different heading for the table of contents is supplied.
+
+\newgidx[heading={\section[Acronyms]}]{acronyms}{List of Acronyms}
+
+ % Make a notation database labelled 'notation' with given title
+ % Make it an unnumbered section
+
+\newgidx[heading=\section*]{notation}{Notation}
+
+ % Define some terms for the glossary
+
+\DTLgidxSetDefaultDB{glossary}
+
+\newterm[description={sea mammal with flippers that eats
+fish}]{seal}
+\newterm[description={large seal}]{sea lion}
+
+\newterm{bravo}
+\newterm
+ [%
+ label=bravocry,
+ description={cry of approval (pl.\ bravos)},
+ parent=bravo
+ ]
+ {bravo}
+\newterm
+ [% options
+ label=bravokiller,
+ description={hired ruffian or killer (pl.\ bravoes)},
+ plural=bravoes,
+ parent=bravo
+ ]
+ {bravo}
+
+\newterm
+ [% options
+ plural={glossaries},
+ ]%
+ {glossary}
+
+\newterm
+ [% options
+ label=glossarycol,
+ plural={glossaries},
+ description={collection of glosses},
+ parent=glossary
+ ]
+ {glossary}
+
+\newterm
+ [% options
+ label=glossarylist,
+ plural={glossaries},
+ description={list of technical words},
+ parent=glossary
+ ]
+ {glossary}
+
+\newterm
+ [% options
+ % description contains commas so it must be grouped
+ description={a list of individual pages or page ranges
+ (e.g.\ 1,2,4,7--9)}
+ ]
+ {page list}
+
+\newterm
+ [%
+ plural={indices},
+ description={an alphabetical list of names or subjects with
+ references to their location in the document (pl.\ indices or
+ indexes)}
+ ]
+ {index}
+
+ % define some acronyms
+
+\DTLgidxSetDefaultDB{acronyms}
+
+\newacro{html}{hyper-text markup language}
+\newacro{css}{cascading style sheet}
+
+% override default description on this one:
+\newacro[description={eXtensible Markup Language}]{xml}{extensible markup language}
+
+% define some notation
+
+\DTLgidxSetDefaultDB{notation}
+
+\newterm
+ [%
+ symbol={\ensuremath{\mathcal{S}}},
+ description={a collection of distinct objects},
+ ]%
+ {set}
+
+\newterm
+ [%
+ symbol={\ensuremath{\mathcal{U}}},
+ description={the set containing everything}
+ ]%
+ {universal set}
+
+\newterm
+ [%
+ symbol={\ensuremath{\emptyset}},
+ description={the set with no elements}
+ ]%
+ {empty set}
+
+\newterm
+ [%
+ symbol={\ensuremath{|\mathcal{S}|}},
+ description={the number of elements in the set
+\ensuremath{\mathcal{S}}}
+ ]%
+ {cardinality}
+
+\title{Sample Document Using the datagidx Package}
+\author{Nicola L. C. Talbot}
+
+\begin{document}
+
+\maketitle
+
+Here's an acronym referenced using \verb|\acr|: \acr{html}.
+And here
+it is again: \acr{html}. If you're used to the \texttt{glossaries}
+package, note the difference in using \verb|\gls|: \gls{html}.
+And again (no difference): \gls{html}.
+
+Here are some more entries:
+
+\acr{xml} and \acr{css}.
+Next use:
+\acr{xml} and \acr{css}.
+Full form:
+\gls{xml} and \gls{css}.
+
+Reset again. \glsresetall{acronyms}%
+Start with a capital. \Acr{html}.
+Next: \Acr{html}. Full: \Gls{html}.
+
+Prefer capitals?
+\renewcommand{\acronymfont}[1]{\MakeTextUppercase{#1}}%
+\Acr{xml}. Next: \acr{xml}. Full: \gls{xml}.
+
+Prefer small-caps?
+\renewcommand{\acronymfont}[1]{\textsc{#1}}%
+\Acr{css}. Next: \acr{css}. Full: \gls{css}.
+
+A \gls{set} (denoted \glssym{set}) is a collection of objects.
+The \gls{universal set} is the set of everything.
+The \gls{empty set} contains no elements.
+The \gls{cardinality} of a set (denoted \glssym{cardinality}) is the
+number of elements in the set.
+
+A \gls{glossarylist} is a useful
+addition to any technical document,
+although a \gls{glossarycol} can also simply be a collection of
+glosses, which is another thing entirely. Some documents have
+multiple \glspl{glossarylist}. Entries in a \gls{glossarylist} or
+\gls{index} have an associated \gls{page list}.
+
+A \gls{bravocry} is a cry of approval (plural \glspl{bravocry}) but
+a
+\gls{bravokiller} can also be a hired ruffian or killer (plural
+\glspl{bravokiller}).
+
+\newpage
+
+Resetting all acronyms.\glsresetall{acronyms}
+
+Here are the acronyms again:
+
+\Acr{html}, \acr{xml} and \acr{css}.
+
+Next use:
+\Acr{html}, \acr{xml} and \acr{css}.
+
+Full form:
+\Gls{html}, \gls{xml} and \gls{css}.
+
+
+\newpage
+
+\printterms
+ [
+ database=glossary,% 'glossary' database
+ columns=1,% one column page layout
+ postdesc=dot,% put a full stop after the description
+ style=gloss,% use 'gloss' style (sub-entries numbered)
+ namefont={\textbf},% put the name in bold
+ namecase=firstuc,% make the first letter of the name upper case
+ child=noname,% don't print sub item names
+ location=hide% hide the location list
+ ]
+
+\printterms
+ [
+ database=acronyms,% 'acronyms' database
+ postdesc=dot,% put a full stop after the description
+ columns=1,% one column page layout
+ namefont={\textbf},% put the name (i.e. the abbreviation) in bold
+ namecase=uc,% make the name upper case
+ style=align,% use the 'align' style
+ ]
+
+% Change the way the description is formatted (the argument to
+% \DTLgidxFormatDesc will always be a control sequence so
+% \xmakefirstuc is needed instead of \makefirstuc)
+\renewcommand{\DTLgidxFormatDesc}[1]{\xmakefirstuc{#1}}
+
+\printterms
+ [
+ database=notation,% 'notation' database
+ postdesc=dot,% put a full stop after the description
+ columns=1,% one page column layout
+ namefont={\textbf},% make the name bold
+ style=indexalign,
+ namecase=firstuc,% make first letter of name a capital
+ symboldesc={symbol desc},% put symbol to the left of description
+ %symboldesc={desc (symbol)},% put symbol to the right of the description
+ sort={},% don't sort
+% If the following widths are 0 (default) they take up their natural
+% amount of space. If the widths are greater than 0, those fields
+% are put in a box of the given width.
+ symbolwidth={2cm},% width taken up by symbol
+ locationwidth={1cm},% width taken up by location list
+ ]
+
+
+
+\end{document}
diff --git a/Master/texmf-dist/doc/latex/datatool/samples/sample-index.pdf b/Master/texmf-dist/doc/latex/datatool/samples/sample-index.pdf
new file mode 100644
index 00000000000..03e95157250
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/datatool/samples/sample-index.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/latex/datatool/samples/sample-index.tex b/Master/texmf-dist/doc/latex/datatool/samples/sample-index.tex
new file mode 100644
index 00000000000..2a2673d0cc7
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/datatool/samples/sample-index.tex
@@ -0,0 +1,735 @@
+\documentclass{article}
+
+\usepackage[T1]{fontenc}
+\usepackage[utf8]{inputenc}
+
+ % Two LaTeX runs are required to ensure this document is up-to-date
+
+ % It can take a long time to sort the index, so use the optimize
+ % option. This has values: off (no optimize, sorting is done every
+ % run), low (sort every second run) or high (write sorted database
+ % to file and read in next time round). Don't modify the
+ % index/glossary databases while the optimize option is set to
+ % high. Do the modifications while the optimize option is set to
+ % low or off. Alternatively, delete the .aux and .gidx files before rerunning
+ % LaTeX.
+
+%\usepackage[optimize=high]{datagidx}
+\usepackage[optimize=off]{datagidx}
+
+\usepackage[colorlinks]{hyperref}
+
+ % Define some convenient commands
+
+\newcommand*{\principleloc}[1]{\textbf{#1}}
+\newcommand*{\appname}[1]{\texttt{#1}}
+
+ % Later we'll switch to a fancy small caps Roman page numbering
+
+\newcommand*{\myscroman}[1]{%
+ \myscromannum{\value{#1}}%
+}
+
+\newcommand*{\myscromannum}[1]{%
+ \textsc{\romannumeral#1}%
+}
+
+ % Now we need to add this as a possible location type
+
+\DTLgidxAddLocationType{myscromannum}
+
+ % Don't let \appname interfere with the sorting and labelling of
+ % terms:
+
+\appto\newtermlabelhook{\let\appname\DTLgidxNoFormat}
+
+ % (datagidx also does this for \MakeUppercase, \MakeTextUppercase,
+ % \MakeLowercase, \MakeTextLowercase, \textsc and \acronymfont.)
+
+ % Make an index database labelled 'index' with given title.
+
+\newgidx{index}{Index}
+
+ % Define some terms for the index (entries must be defined in the
+ % preamble).
+
+ % Either use "database" key in optional argument
+ % or set the default database. It's less typing to set the default
+ % database, so let's do that:
+
+\DTLgidxSetDefaultDB{index}
+
+ % All the following definitions will add terms to the "index" database:
+
+ % accent commands get stripped from the default label and sort
+ % so the following gets both the label and sort set to 'macedoine'
+\newterm{mac\'edoine}
+
+ % The following gets both the label and sort set to 'macrame'
+ % (This is only tested with utf8. It most likely won't work with
+ % other encodings.)
+\newterm{macramé}
+
+ % Take care if the first letter starts with an accent.
+ % The initial accented letter must be grouped to ensure it works
+ % with \makefirstuc, but this will make the default label '{e}lite'
+ % rather than 'elite', so let's override the default:
+
+\newterm[label=elite]{{é}lite}
+
+ % Sometimes the default sort may not suit your requirements. In
+ % which case you can override it:
+
+\newterm
+[
+ sort={Ten Downing Street}
+]
+{10 Downing Street}
+
+\newterm{singular}
+\newterm{plural}
+\newterm{group}
+\newterm[see=group]{scope}
+\newterm[label={glossary}]{glossary}
+\newterm
+ [%
+ label={index},
+ seealso={glossary},
+ ]
+ {index}
+\newterm
+ [
+ seealso={glossary}
+ ]
+ {acronym}
+
+\newterm[parent=acronym]{reset}
+\newterm[parent=acronym]{unset}
+
+\newterm
+ [%
+ parent=acronym,
+ label={firstuse},
+ ]
+ {first use}
+\newterm
+ [%
+ parent=acronym,
+ label={acronymlist},
+ text={list of acronyms},
+ plural={lists of acronyms}
+ ]
+ {list}
+
+\newterm{reptile}
+
+\newterm
+ [%
+ seealso={reptile}
+ ]
+ {crocodylian}
+
+\newterm
+ [%
+ parent=crocodylian
+ ]
+ {crocodile}
+
+\newterm
+ [%
+ parent=crocodylian
+ ]
+ {caiman}
+
+\newterm
+ [%
+ parent=crocodylian
+ ]
+ {alligator}
+
+\newterm{seal}
+\newterm{sea lion}
+\newterm{sea}
+\newterm{sea anchor}
+\newterm{sea urchin}
+\newterm{seam bowler}
+\newterm{seam}
+
+ % Be careful if a value contains a comma or an equal sign. The
+ % entire value must be grouped.
+\newterm
+ [%
+ label={comma},
+ sort={,},
+ text={comma (,)},
+ plural={commas (,)}
+ ]%
+ {, (comma)}
+
+\newterm
+ [%
+ label={equals},
+ sort={=},
+ text={equal sign (=)},
+ plural={equal signs (=)},
+ ]%
+ {= (equal sign)}
+
+ % Don't need to worry about makeindex's special characters (since
+ % we're not using makeindex!)
+\newterm
+ [%
+ label={"},
+ sort={"},
+ text={double quote (")},
+ plural={double quotes (")},
+ ]%
+ {" (double quote)}
+
+\newterm
+ [%
+ label={!},
+ sort={!},
+ text={exclamation mark (!)},
+ plural={exclamation marks (!)},
+ ]%
+ {! (exclamation mark)}
+
+\newterm
+ [%
+ label={|},
+ sort={|},
+ text={vertical bar (\textbar)},
+ plural={vertical bars (\textbar)},
+ ]%
+ {\textbar\ (vertical bar)}
+
+
+ % Be careful of special characters
+
+\newterm
+ [%
+ label={amp},
+ sort={\DTLgidxStripBackslash{\&}},
+ text={ampersand (\&)},
+ plural={ampersands (\&)},
+ ]
+ {\& (ampersand)}
+
+\newterm
+ [%
+ label={underscore},
+ sort={\DTLgidxStripBackslash{\_}},
+ text={underscore (\_)},
+ plural={underscores (\_)},
+ ]
+ {\_ (underscore)}
+
+\newterm
+ [%
+ label={dollar},
+ sort={\DTLgidxStripBackslash{\$}},
+ text={dollar (\$)},
+ plural={dollars (\$)},
+ ]
+ {\$ (dollar)}
+
+\newterm
+ [%
+ label={circum},
+ sort={\DTLgidxStripBackslash{\^}},
+ text={circumflex (\textasciicircum)},
+ plural={circumflexes (\textasciicircum)},
+ ]
+ {\textasciicircum\ (circumflex)}
+
+\newterm
+ [%
+ label={tilde},
+ sort={\string~},
+ text={tilde (\textasciitilde)},
+ plural={tildes (\textasciitilde)},
+ ]
+ {\textasciitilde\ (tilde)}
+
+\newterm{0\DTLgidxParen{zero}}
+
+\newterm{1\DTLgidxParen{one}}
+
+\newterm{2\DTLgidxParen{two}}
+
+\newterm{3\DTLgidxParen{three}}
+
+\newterm{10\DTLgidxParen{ten}}
+
+\newterm{100\DTLgidxParen{one hundred}}
+
+\newterm{20\DTLgidxParen{twenty}}
+
+\newterm{alpine}
+
+ % Let's index a person
+ % The label is formed from the surname.
+ % If you are indexing more than one person with the same surname,
+ % you'll have to provide your own labels via the label key.
+
+\newterm{\DTLgidxName{Donald E.}{Knuth}}
+
+ % Let's have some examples from the Oxford Style Manual:
+
+\newterm{highwater}
+\newterm{highlights}
+\newterm{highbrow}
+\newterm{Highclere Castle}
+\newterm{highball}
+\newterm{high chair}
+\newterm{high heels}
+\newterm{high-fliers}
+
+ % parenthetical material
+\newterm{high\DTLgidxParen{light-headed}}
+
+\newterm
+[% label needed to distinguish from previous entry
+ label=highheight,
+]
+{high\DTLgidxParen{height}}
+
+\newterm{\emph{High Water}\DTLgidxParen{play}}
+
+\newterm{high water}
+
+\newterm{\emph{New York, New York}}
+
+ % Using \DTLgidxName allows the sort key to work with \dtlwordindexcompare
+
+\newterm{\DTLgidxName{J.}{High}}
+
+\newterm{\DTLgidxName{P.}{High-Smith}}
+
+\newterm{\DTLgidxName{A.}{Highsmith}}
+
+\newterm{\DTLgidxName{Earl of}{New York}}
+
+ % Some more examples from the Oxford Style Manual
+
+\newterm
+ [
+ label={DrMeynell}
+ ]
+ {\DTLgidxName{\DTLgidxRank{Dr}{A.}}{Meynell}}
+
+\newterm
+ [%
+ label={AliceMeynell}
+ ]
+ {\DTLgidxName{Alice}{Meynell}}
+
+\newterm
+ [%
+ label={AMeynell}
+ ]
+ {\DTLgidxName{A}{Meynell}}
+
+\newterm
+ [%
+ label={FMeynell}
+ ]
+ {\DTLgidxName{F.}{Meynell}}
+
+\newterm
+ [%
+ label={WGMeynell}
+ ]
+ {\DTLgidxName{W.~G.}{Meynell}}
+
+\newterm
+ [%
+ label={WMeynell}
+ ]
+ {\DTLgidxName{W.}{Meynell}}
+
+\newterm
+ [%
+ label={SirMeynell}
+ ]
+ {\DTLgidxName{\DTLgidxRank{Sir}{F.}}{Meynell}}
+
+
+ % Using \DTLgidxMac allows the sort key to sort on ``Mac'' rather
+ % than the argument to \DTLgidxMac
+
+\newterm{\DTLgidxName{Joe}{\DTLgidxMac{Mc}Cullers}}
+
+\newterm{\DTLgidxName{Bob}{\DTLgidxMac{M'}Fingal}}
+
+ % The labels need to be set here as we have identical surnames
+
+\newterm
+ [%
+ label={TomMacFarlane}
+ ]%
+ {\DTLgidxName{Tom}{\DTLgidxMac{Mac}Farlane}}
+
+\newterm
+ [%
+ label={DickMacFarlane}
+ ]%
+ {\DTLgidxName{Dick}{\DTLgidxMac{Mac}Farlane}}
+
+\newterm{\DTLgidxName{Harry}{\DTLgidxMac{Mc}Namee}}
+
+\newterm{\DTLgidxMac{Mc}Carthyism}
+\newterm{\DTLgidxMac{Mc}Guffin}
+\newterm{\DTLgidxMac{Mc}Coy}
+
+\newterm{macadam}
+\newterm{ma'am}
+\newterm{ma}
+\newterm{macabre}
+\newterm{machete}
+
+
+\newterm{deem}
+\newterm{demote}
+\newterm{deerstalker}
+\newterm{deface}
+\newterm{de facto}
+
+ % Don't let the hyphen be considered a word boundary:
+\newterm{de\DTLgidxIgnore{-}escalate}
+
+ % Ignore particles such as "de", "von", "of"
+ % The label defaults to deWinter but the name is displayed as
+ % de~Winter
+
+\newterm{\DTLgidxName{Fred}{\DTLgidxParticle{de}{Winter}}}
+
+\newterm{\DTLgidxName{Wilma}{Winter}}
+
+\newterm{\DTLgidxName{Betty}{Winters}}
+
+ % these all need labels added to ensure uniqueness:
+
+\newterm
+[
+ label={HenrySonJohn}
+]
+{\DTLgidxOffice{son \DTLgidxParticle{of}{John}}{Henry}}
+
+\newterm
+[
+ label={HenryBeaumont}
+]
+{\DTLgidxOffice{bishop \DTLgidxParticle{of}{Bayeux}}{Henry
+\DTLgidxParticle{de}{Beaumont}}}
+
+\newterm
+[
+ label={HenryScribe}
+]
+{\DTLgidxOffice{scribe \DTLgidxParticle{of}{Bury}
+ \DTLgidxSaint{St}~Edmunds}{Henry}}
+
+\newterm
+[
+ label={HenryKing}
+]
+{\DTLgidxOffice{king \DTLgidxParticle{of}{England}}{Henry}}
+
+\newterm
+[
+ label={HenryBlois}
+]
+{\DTLgidxOffice{bishop \DTLgidxParticle{of}{Winchester}}{Henry
+\DTLgidxParticle{of}{Blois}}}
+
+\newterm
+[
+ label={HenryBlund}
+]
+{Henry Blund}
+
+\newterm
+[
+ label={HenryEssex}
+]
+{Henry \DTLgidxParticle{of}{Essex}}
+
+\newterm
+[
+ label={HenryLittle}
+]
+{Henry \DTLgidxParticle{the}{Little}}
+
+\newterm
+[
+ label={HenryMowbray}
+]
+{Henry \DTLgidxParticle{de}{Mowbray}}
+
+\newterm
+[
+ label={HenryFitzRobert}
+]
+{Henry \DTLgidxParticle{Fitz}{Robert}}
+
+\newterm
+[
+ label={JBSaint}
+]
+{\DTLgidxName{J.~B.}{Saint}}
+
+\newterm
+[
+ label={StAndrews}
+]
+{\DTLgidxPlace{\DTLgidxSaint{St}~Andrews}{Fife}}
+
+\newterm
+[
+ label={StBenetsHall}
+]
+{\DTLgidxSaint{St}~Benet's Hall}
+
+\newterm
+[
+ label={StJamesInfirmary}
+]
+{\DTLgidxSaint{St}~James Infirmary}
+
+\newterm
+[
+ label={QStJohnSmythe}
+]
+{\DTLgidxName{Q.}{\DTLgidxSaint{St}~John-Smythe}}
+
+\newterm
+[
+ label={SaintJulian}
+]
+{\DTLgidxSaint{Saint}-Julian}
+
+\newterm
+[
+ label={StJustinRoseland}
+]
+{\DTLgidxSaint{St}~Just-in-Roseland}
+
+ % Names with an associated number
+
+ % The following gets the label 'James I' and sort 'James 01'
+
+\newterm{James~\DTLgidxNameNum{1}}
+
+ % The following gets the label 'James II' and sort 'James 02'
+
+\newterm{James~\DTLgidxNameNum{2}}
+
+ % etc
+\newterm{James~\DTLgidxNameNum{3}}
+\newterm{James~\DTLgidxNameNum{4}}
+\newterm{James~\DTLgidxNameNum{5}}
+
+ % In the following, the label and name default to 'New York, population'
+ % The text defaults to 'population'.
+ % Using \DTLgidxSubject allows the sort key to work with \dtlwordindexcompare
+ % Here both the label and the text have been changed from their
+ % defaults.
+\newterm
+[
+ label={popNY},% give it a short, easy to type label
+ text={population of New York}
+]
+{\DTLgidxSubject{population}{New York}}
+
+ % In the following, the label and name become 'New York, USA'
+ % The text becomes 'New York'.
+ % The sort key is adjusted to work with \dtlwordindexcompare
+\newterm{\DTLgidxPlace{USA}{New York}}
+
+\newterm{\ensuremath{\alpha}-iron}% gets label and sort keys 'alpha-iron'
+
+\newterm{\ensuremath{\alpha} chain}% label & sort -> 'alpha chain'
+
+\newterm{\ensuremath{\alpha} Centauri}% label & sort -> 'alpha Centauri'
+
+\newterm{alphabet}
+
+\newterm{\ensuremath{\Lambda} calculus}% label & sort -> 'Lambda calculus'
+
+ % and have a few more entries in the same letter group to test case
+ % ordering:
+\newterm{kite}
+\newterm{koala}
+
+ % Earlier I modified \newtermlabelhook so
+ % that \appname won't interfere with the sorting
+ % and labelling mechanism, so I don't need to specify separate sort
+ % and label keys here:
+
+\newterm{\appname{makeindex}}% label and sort both set to just 'makeindex'
+\newterm{\appname{xindy}}% label and sort both set to just 'xindy'
+
+\title{Sample Document Using the datagidx Package}
+\author{Nicola L. C. Talbot}
+
+\begin{document}
+\pagenumbering{roman}
+
+The datagidx package was developed to follow the word order indexing
+style described by the Oxford Style Manual. Many of the examples
+here are taken from that manual. Two \LaTeX\ runs are required. If
+you get a pdfTeX warning that a destination has been referenced but
+does not exist, this may mean the index is out-of-date and you need
+to do another \LaTeX\ run.
+
+With word ordering a word break (space or hyphen) comes before all
+other letters of the alphabet (\gls{sea lion} comes before \gls{seal}).
+With letter ordering word breaks are ignored (so \gls{seal} comes
+before \gls{sea lion}).
+
+Use a few terms here: \gls{index}, \gls{group}, \gls{singular}, \gls{plural}.
+
+\newpage
+
+\Gls{singular}, \glspl{plural}. \gls{glossary}.
+\Gls{acronym}: \gls{reset}, \gls{firstuse}.
+
+\newpage
+\pagenumbering{arabic}
+
+Switched page numbering style. \Gls{singular}, \gls{kite},
+\gls{koala}, \gls{crocodile}, \gls{seal}.
+
+\Gls{sea},
+\gls{sea anchor},
+\gls{sea urchin}.
+
+Some characters: \gls{comma}, \gls{equals}, \gls{"}, \gls{!}, \gls{|}
+\gls{amp}, \gls{underscore}, \gls{dollar}, \gls{circum},
+\gls{tilde}.
+
+Some numbers: \gls{0}, \gls{1}, \gls{2}, \gls{3}, \gls{20}, \gls{10}.
+
+\newpage
+
+Some numbers again: \gls{0}, \gls{1}, \gls{2}, \gls{3}, \gls{100},
+\gls{10}, \gls{20}.
+
+Case mixture: \gls{kite},
+\gls{Knuth} and
+\gls{[principleloc]koala}.
+
+\Gls{de-escalate}, \gls{deem}, \gls{demote}.
+
+We don't need to use \gls{makeindex} or \gls{xindy}!
+However, \TeX\ takes longer to sort and collate than either
+\gls{makeindex} or \gls{xindy}, so document compilation time will
+take longer.
+
+\newpage
+
+\Gls{kite}, \gls{highwater}, \gls{koala}, \gls{caiman}, \gls{sea
+lion}, \gls{high},
+\gls{highbrow}, \gls{high chair}, \gls{highball}, \gls{reptile},
+\gls{highlights}, \gls{high heels}, \gls{high-fliers}.
+\Gls{seam} and \gls{seam bowler}.
+
+\gls{New York, New York}. \gls{New York}.
+\Gls{popNY}. \gls{New York, USA}.
+\gls{Highclere Castle}.
+
+\gls{High}. \gls{High-Smith}, \gls{Highsmith}, \gls{High Water}
+as opposed to \gls{high water}. \Gls{alphabet}. \Gls{alpine}.
+
+Some terms with Greek letters: \gls{alpha-iron},
+\gls{Lambda calculus}, \gls{alpha chain}, \gls{alpha Centauri}.
+
+\newpage
+
+\renewcommand{\thepage}{\myscroman{page}}%
+Switching to small caps Roman page numbering.
+
+\Gls{kite}. \Glspl{alligator}. \Gls{highheight}.
+
+\gls{deWinter}.
+\gls{Winter}.
+\gls{Winters}.
+
+\gls{McCullers}.
+
+\gls{M'Fingal}.
+
+\gls{TomMacFarlane}.
+
+\gls{DickMacFarlane}.
+
+\gls{McNamee}.
+
+\gls{McCarthyism},
+\gls{McGuffin},
+\gls{McCoy}.
+
+\Gls{macadam},
+\gls{ma'am},
+\gls{ma},
+\gls{macabre},
+\gls{macrame},
+\gls{macedoine}.
+
+\Gls{elite},
+\gls{deem},
+\gls{demote},
+\gls{deerstalker},
+\gls{deface},
+\gls{de facto}.
+
+
+\gls{AliceMeynell}.
+\gls{AMeynell}.
+\gls{DrMeynell}.
+\gls{SirMeynell}.
+\gls{FMeynell}.
+\gls{WGMeynell}.
+\gls{WMeynell}.
+
+\gls{HenrySonJohn}. \gls{HenryBlois}.
+\gls{HenryBeaumont}. \gls{HenryBlund}.
+\gls{HenryLittle}. \gls{HenryEssex}. \gls{HenryMowbray}.
+\gls{HenryFitzRobert}.
+\gls{HenryKing}. \gls{HenryScribe}.
+
+\gls{James V}.
+\gls{James I}.
+\gls{James IV}.
+\gls{James III}.
+\gls{James II}.
+
+\gls{JBSaint}.
+\gls{StAndrews}.
+\gls{StBenetsHall}.
+\gls{StJamesInfirmary}.
+\gls{QStJohnSmythe}.
+\gls{SaintJulian}.
+\gls{StJustinRoseland}.
+
+\gls{10 Downing Street}.
+
+\newpage
+
+% This will take a while as the sorting algorithm is complex.
+
+\printterms
+ [
+ heading={\section[Word Sorted Index]},% make a numbered section
+ database=index,% 'index' database
+ prelocation=dotfill,% put a dotted line before the location list
+ columns=3,% page layout
+ style=index,% use 'index' style
+ %balance=false,% don't balance columns
+ postheading={Locations in bold indicate primary reference.
+ (Word sort.)}
+ ]
+
+\end{document}
diff --git a/Master/texmf-dist/doc/latex/datatool/samples/sample-mail-merge.pdf b/Master/texmf-dist/doc/latex/datatool/samples/sample-mail-merge.pdf
index 73fb2f1c83e..bbc7a7dfb5f 100644
--- a/Master/texmf-dist/doc/latex/datatool/samples/sample-mail-merge.pdf
+++ b/Master/texmf-dist/doc/latex/datatool/samples/sample-mail-merge.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/latex/datatool/samples/sample-mail-merge.tex b/Master/texmf-dist/doc/latex/datatool/samples/sample-mail-merge.tex
index 384584e540e..12566e4aba0 100644
--- a/Master/texmf-dist/doc/latex/datatool/samples/sample-mail-merge.tex
+++ b/Master/texmf-dist/doc/latex/datatool/samples/sample-mail-merge.tex
@@ -1,5 +1,5 @@
% This file is public domain.
-\documentclass{scrlttr2}
+\documentclass{letter}
\usepackage{datatool}
diff --git a/Master/texmf-dist/doc/latex/datatool/samples/sample-piechart.pdf b/Master/texmf-dist/doc/latex/datatool/samples/sample-piechart.pdf
index 43d1a30f341..99d2c261975 100644
--- a/Master/texmf-dist/doc/latex/datatool/samples/sample-piechart.pdf
+++ b/Master/texmf-dist/doc/latex/datatool/samples/sample-piechart.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/latex/datatool/samples/sample-sort.tex b/Master/texmf-dist/doc/latex/datatool/samples/sample-sort.tex
new file mode 100644
index 00000000000..bce750819dc
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/datatool/samples/sample-sort.tex
@@ -0,0 +1,118 @@
+% This file is public domain
+
+\documentclass{article}
+
+\usepackage{datatool}
+
+% Sample database
+
+\DTLnewdb{data}
+
+% Add a word to the database. (The Definition column is provided to
+% distinguish the entries when the database is displayed. The
+% Definition column is not used by the sort code.)
+
+% Syntax: \newword{string}
+
+\makeatletter
+\newcommand*{\newword}[1]{%
+ \DTLnewrow{data}%
+ \DTLnewdbentry{data}{Word}{#1}%
+% Convert word to its definition and add
+ {%
+ \def\thisword{#1}\@onelevel@sanitize\thisword
+ \dtlexpandnewvalue % ensure \theword gets expanded
+ \DTLnewdbentry{data}{Definition}{\thisword}%
+ }%
+}
+\makeatother
+
+\newword{High Water}
+\newword{!}
+\newword{[}
+\newword{~}
+\newword{\#define}
+\newword{High water}
+\newword{highwater}
+\newword{1st Street}
+\newword{high water}
+\newword{1st~Street}
+\newword{10~Downing Street}
+\newword{10~Downing Avenue}
+\newword{10 Downing Road}
+\newword{\#include}
+\newword{1 (one)}
+\newword{1\datatoolparenstart(one)}
+\newword{10\datatoolparenstart(ten)}
+\newword{10 (ten)}
+\newword{42\datatoolparenstart(forty-two)}
+\newword{42 (forty-two)}
+\newword{100\datatoolparenstart(one hundred)}
+\newword{100 (one hundred)}
+\newword{4\datatoolparenstart(four)}
+\newword{4 (four)}
+\newword{The Ten Samurai}
+\newword{London, Jack}
+\newword{London}
+\newword{10 Samurai, The}
+\newword{10 Samurai}
+\newword{Ten Samurai, The}
+\newword{Ten Samurai}
+\newword{10 Samurai\datatoolsubjectcomma The}
+\newword{Ten Samurai\datatoolsubjectcomma The}
+\newword{London\datatoolpersoncomma Jack}
+\newword{London\datatoolplacecomma UK}
+\newword{London\datatoolsubjectcomma History of}
+\newword{Zebra}
+\newword{zebra}
+\newword{alpha}
+\newword{Alpha}
+\newword{seal}
+\newword{sea lion}
+
+\begin{document}
+
+\section{Unsorted data}
+
+\begin{tabular}{ll}
+\bfseries Word & \bfseries Definition
+\DTLforeach*{data}{\Word=Word,\Definition=Definition}{%
+\\\Word & \ttfamily \Definition
+}
+\end{tabular}
+
+\section{Case-Insensitive Sort}
+
+\DTLsort*{Word}{data}
+
+\begin{tabular}{ll}
+\bfseries Word & \bfseries Definition
+\DTLforeach*{data}{\Word=Word,\Definition=Definition}{%
+\\\Word & \ttfamily \Definition
+}
+\end{tabular}
+
+
+\section{Case-Sensitive Sort}
+
+\DTLsort{Word}{data}
+
+\begin{tabular}{ll}
+\bfseries Word & \bfseries Definition
+\DTLforeach*{data}{\Word=Word,\Definition=Definition}{%
+\\\Word & \ttfamily \Definition
+}
+\end{tabular}
+
+\section{Word-Order Sort}
+
+\dtlsort{Word}{data}{\dtlwordindexcompare}
+
+\begin{tabular}{ll}
+\bfseries Word & \bfseries Definition
+\DTLforeach*{data}{\Word=Word,\Definition=Definition}{%
+\\\Word & \ttfamily \Definition
+}
+\end{tabular}
+
+\end{document}
diff --git a/Master/texmf-dist/doc/latex/datatool/samples/sample-student-scores.pdf b/Master/texmf-dist/doc/latex/datatool/samples/sample-student-scores.pdf
index 1abee68d126..6e640ed055c 100644
--- a/Master/texmf-dist/doc/latex/datatool/samples/sample-student-scores.pdf
+++ b/Master/texmf-dist/doc/latex/datatool/samples/sample-student-scores.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/latex/datatool/samples/sample-two-per-row.pdf b/Master/texmf-dist/doc/latex/datatool/samples/sample-two-per-row.pdf
index 17676a1093f..2f9b601552d 100644
--- a/Master/texmf-dist/doc/latex/datatool/samples/sample-two-per-row.pdf
+++ b/Master/texmf-dist/doc/latex/datatool/samples/sample-two-per-row.pdf
Binary files differ
diff --git a/Master/texmf-dist/source/latex/datatool/datatool.dtx b/Master/texmf-dist/source/latex/datatool/datatool.dtx
index 32bb1dc4705..2b0a0fe9044 100644
--- a/Master/texmf-dist/source/latex/datatool/datatool.dtx
+++ b/Master/texmf-dist/source/latex/datatool/datatool.dtx
@@ -6,6 +6,7 @@
% -src "datatool-fp.sty\Z=>datatool-fp.sty"
% -src "datatool-pgfmath.sty\Z=>datatool-pgfmath.sty"
% -src "datatool.sty\Z=>datatool.sty"
+% -src "datagidx.sty\Z=>datagidx.sty"
% -src "databib.sty\Z=>databib.sty"
% -src "databar.sty\Z=>databar.sty"
% -src "datapie.sty\Z=>datapie.sty"
@@ -16,7 +17,7 @@
% -author "Nicola Talbot"
% -codetitle ""
% datatool
-% Created on 2012/10/6 20:31
+% Created on 2013/1/15 15:04
%\fi
%\iffalse
%<*package>
@@ -39,11 +40,11 @@
%\fi
% \iffalse
% Doc-Source file to use with LaTeX2e
-% Copyright (C) 2012 Nicola Talbot, all rights reserved.
+% Copyright (C) 2013 Nicola Talbot, all rights reserved.
% \fi
% \iffalse
%<*driver>
-\documentclass[report]{nlctdoc}
+\documentclass[report,widecs]{nlctdoc}
\iffalse
datatool-manual.tex is a stub file used by makedtx to create
@@ -63,7 +64,7 @@ datatool.dtx
\doxitem{Counter}{counter}{counters}
\doxitem{Option}{option}{package options}
-\CheckSum{17056}
+\CheckSum{22429}
\RecordChanges
\PageIndex
@@ -76,11 +77,11 @@ datatool.dtx
%\fi
%\MakeShortVerb{"}
%
-%\title{Documented Code for datatool v2.11}
+%\title{Documented Code for datatool v2.13}
%\author{Nicola L. C. Talbot\\
%\url{http://www.dickimaw-books.com/}}
%
-%\date{2012-09-25}
+%\date{2013-01-15}
%\maketitle
%
%\pagenumbering{roman}
@@ -115,7 +116,7 @@ datatool.dtx
%
% \begin{macrocode}
\NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{datatool-base}[2012/10/06 v2.12 (NLCT)]
+\ProvidesPackage{datatool-base}[2013/01/15 v2.13 (NLCT)]
% \end{macrocode}
% Required packages:
% \begin{macrocode}
@@ -237,6 +238,59 @@ datatool.dtx
% \end{macrocode}
%\end{macro}
%
+%\begin{macro}{\dtlifintopenbetween}
+%\begin{definition}
+%\cs{dtlifintopenbetween}\marg{num}\marg{min}\marg{max}\marg{true
+%part}\marg{false part}
+%\end{definition}
+% If we're dealing with integers it's more efficient to use \TeX's
+% \cs{ifnum}.
+% \begin{macrocode}
+\newcommand{\dtlifintopenbetween}[5]{%
+ \ifnum#1>#2\relax
+% \end{macrocode}
+% Greater than minimum value. Is it less than the maximum?
+% \begin{macrocode}
+ \ifnum#1<#3\relax
+ #4%
+ \else
+ #5%
+ \fi
+ \else
+ #5%
+ \fi
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\dtlifintclosedbetween}
+%\begin{definition}
+%\cs{dtlifintclosedbetween}\marg{num}\marg{min}\marg{max}\marg{true
+%part}\marg{false part}
+%\end{definition}
+% If we're dealing with integers it's more efficient to use \TeX's
+% \cs{ifnum}.
+% \begin{macrocode}
+\newcommand{\dtlifintclosedbetween}[5]{%
+ \dtlifintopenbetween{#1}{#2}{#3}{#4}%
+ {%
+% \end{macrocode}
+% Check end points.
+% \begin{macrocode}
+ \ifnum#1=#2\relax
+ #4%
+ \else
+ \ifnum#1=#3\relax
+ #4%
+ \else
+ #5%
+ \fi
+ \fi
+ }%
+}
+% \end{macrocode}
+%\end{macro}
+%
%\begin{macro}{\long@collect@body}
% Need long versions of \isty{amsmath}'s \cs{collect@body}. These macros are
% adapted from the macros defined by \sty{amsmath}.
@@ -909,12 +963,12 @@ datatool.dtx
%
%\begin{macro}{\@dtl@decimaltolocalefrac}
% Convert the fractional part (store in \cs{@dtl@fracpart})
-% \begin{macrocode}
-% \end{macrocode}
+% \begin{macrocode}
\def\@dtl@decimaltolocalefrac#1.\relax{%
\def\@dtl@fracpart{#1}%
\@dtl@choptrailingzeroes{\@dtl@fracpart}%
}
+% \end{macrocode}
%\end{macro}
%
%\begin{macro}{\DTLdecimaltocurrency}
@@ -2807,20 +2861,30 @@ datatool.dtx
\newcommand*{\dtl@setcharcode}[2]{%
\ifstrempty{#1}%
{%
+% \end{macrocode}
+% Empty argument. Set code to $-1$.
+% \begin{macrocode}
#2=-1\relax
}%
{%
- \ifx#1\space\relax
+ \ifx#1\@dtl@wordbreak\relax
+% \end{macrocode}
+% Reached a word break. Set to character code of a space.
+%\changes{2.13}{2013-01-15}{change from check for space and tilde to check
+%for \cs{@dtl@wordbreak}}
+% \begin{macrocode}
#2=`\ \relax
\else
- \ifx#1~\relax
- #2=`\ \relax
+ \ifcat\noexpand#1\relax
+% \end{macrocode}
+% Argument is a control sequence, so set to 0.
+% \begin{macrocode}
+ #2=0\relax
\else
- \ifcat\noexpand#1\relax
- #2=-1\relax
- \else
- #2=`#1\relax
- \fi
+% \end{macrocode}
+% Argument is a character, so set to the character code.
+% \begin{macrocode}
+ #2=`#1\relax
\fi
\fi
}%
@@ -2840,19 +2904,38 @@ datatool.dtx
\newcommand*{\dtl@setlccharcode}[2]{%
\ifstrempty{#1}%
{%
+% \end{macrocode}
+% String is empty so set to $-1$.
+% \begin{macrocode}
#2=-1\relax
}%
{%
- \ifx#1\space\relax
+% \end{macrocode}
+% Do we have a word break?
+%\changes{2.13}{2013-01-15}{changed to test for \cs{@dtl@wordbreak} instead
+%of \cs{space} and tilde}
+% \begin{macrocode}
+ \ifx#1\@dtl@wordbreak\relax
#2=`\ \relax
\else
- \ifx#1~\relax
- #2=`\ \relax
+ \ifcat\noexpand#1\relax%
+% \end{macrocode}
+% Argument is a control sequence, so set to 0.
+% \begin{macrocode}
+ #2=0\relax
\else
- \ifcat\noexpand#1\relax%
- #2=-1\relax
- \else
- #2=\lccode`#1\relax
+% \end{macrocode}
+% Argument is a character, so set to the lower case code.
+% \begin{macrocode}
+ #2=\lccode`#1\relax
+% \end{macrocode}
+% If the result is zero, which means the character doesn't have a lower case
+% equivalent. So set to the character code.
+%\changes{2.13}{2013-01-15}{fixed bug where characters without a lower case
+%equivalent were all considered equal}
+% \begin{macrocode}
+ \ifnum#2=0\relax
+ #2=`#1\relax
\fi
\fi
\fi
@@ -2874,90 +2957,687 @@ datatool.dtx
{%
\ifdefempty{\@dtl@argB}%
{%
+% \end{macrocode}
+% Both are empty, so they are equal.
+% \begin{macrocode}
#1=0\relax
}%
{%
+% \end{macrocode}
+% The first string is empty, but the second isn't. Therefore the
+% first string is less than the second string.
+% \begin{macrocode}
#1=-1\relax
}%
}%
{%
\ifdefempty{\@dtl@argB}%
{%
+% \end{macrocode}
+% The second string is empty, but the first isn't. Therefore the
+% first string is greater than the second string.
+% \begin{macrocode}
#1=1\relax
}%
{%
- \DTLsubstituteall{\@dtl@argA}{ }{\space }%
- \DTLsubstituteall{\@dtl@argB}{ }{\space }%
+% \end{macrocode}
+% Identify all word breaks.
+%\changes{2.13}{2013-01-15}{now using \cs{dtl@setwordbreaksnohyphens} to
+%deal with spaces}
+% \begin{macrocode}
+ \dtl@setwordbreaksnohyphens{\@dtl@argA}{\@dtl@wordbreak}%
+ \let\@dtl@argA\dtl@string
+ \dtl@setwordbreaksnohyphens{\@dtl@argB}{\@dtl@wordbreak}%
+ \let\@dtl@argB\dtl@string
+% \end{macrocode}
+% Get the first object and the remaining text.
+% \begin{macrocode}
\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
+% \end{macrocode}
+% Is the first object of \meta{string1} a single character or a group?
+% \begin{macrocode}
+ \expandafter\dtl@ifsingle\expandafter{\dtl@firstA}%
+ {%
+% \end{macrocode}
+% It's a single character. Is the first object of \meta{string2} a
+% single character or a group?
+% \begin{macrocode}
+ \expandafter\dtl@ifsingle\expandafter{\dtl@firstB}%
+ {%
+% \end{macrocode}
+% Both are a single character. Get the lower case character code.
+% \begin{macrocode}
+ \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
+ }%
+ {%
+% \end{macrocode}
+% The first object in \meta{string1} is a single character, but the
+% first object in \meta{string2} isn't a single character.
+% \begin{macrocode}
+ \protected@edef\dtl@donext{%
+ \noexpand\dtlicompare
+ {\noexpand#1}{\dtl@firstA\dtl@restA}{\dtl@firstB\dtl@restB}}%
+ \dtl@donext
+ }%
+ }%
+ {%
+% \end{macrocode}
+% Neither object is a single character.
+% \begin{macrocode}
+ \protected@edef\dtl@donext{%
+ \noexpand\dtlicompare
+ {\noexpand#1}{\dtl@firstA\dtl@restA}{\dtl@firstB\dtl@restB}}%
+ \dtl@donext
+ }%
+ }%
+ }%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\dtlwordindexcompare}
+% Word breaks come before all other letters of the alphabet.
+% \begin{macrocode}
+\newcommand*{\dtlwordindexcompare}[3]{%
+ \@dtldictcompare{#1}{#2}{#3}{\@dtl@wordbreak}%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\dtlletterindexcompare}
+% Word breaks are ignored.
+% \begin{macrocode}
+\newcommand*{\dtlletterindexcompare}[3]{%
+ \@dtldictcompare{#1}{#2}{#3}{}%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\@dtldictcompare}
+% Word or letter compare. Fourth argument should be
+% \cs{@dtl@wordbreak} for word compare or empty for letter compare.
+% \begin{macrocode}
+\newcommand*{\@dtldictcompare}[4]{%
+ \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
+ }%
+ {%
+% \end{macrocode}
+% Alphabetizing continues until a comma indicates inverted order.
+% This assumes that an actual comma indicates that the comma forms part of
+% the text (e.g.\ in a title of a play). Inversion commas should be
+% indicated using commands such as \ics{datatoolpersoncomma}.
+% There are three types of
+% inverted order: people, places and subjects (concepts or objects).
+% We also need to treat parenthetical material in a similar way.
+% Find if the first string has an inverted order.
+% \begin{macrocode}
+ \expandafter\DTLsplitstring\expandafter
+ {\@dtl@argA}{\datatoolpersoncomma}{\@dtl@beforepart}{\@dtl@afterpart}%
+ \ifdefempty{\@dtl@replaced}%
+ {%
+ \expandafter\DTLsplitstring\expandafter
+ {\@dtl@argA}{\datatoolplacecomma}{\@dtl@beforepart}{\@dtl@afterpart}%
+ \ifdefempty{\@dtl@replaced}%
+ {%
+ \expandafter\DTLsplitstring\expandafter
+ {\@dtl@argA}{\datatoolsubjectcomma}{\@dtl@beforepart}{\@dtl@afterpart}%
+ \ifdefempty{\@dtl@replaced}%
+ {%
+ \expandafter\DTLsplitstring\expandafter
+ {\@dtl@argA}{\datatoolparenstart}{\@dtl@beforepart}{\@dtl@afterpart}%
+ \ifdefempty{\@dtl@replaced}%
+ {%
+ \def\@dtl@A@comma{0}%
+ \let\@dtl@A@before\@dtl@argA
+ \def\@dtl@A@after{}%
+ }%
+ {%
+ \let\@dtl@A@comma\@dtl@replaced
+ \let\@dtl@A@before\@dtl@beforepart
+ \let\@dtl@A@after\@dtl@afterpart
+ }%
+ }%
+ {%
+ \let\@dtl@A@comma\@dtl@replaced
+ \let\@dtl@A@before\@dtl@beforepart
+ \let\@dtl@A@after\@dtl@afterpart
+ }%
+ }%
+ {%
+ \let\@dtl@A@comma\@dtl@replaced
+ \let\@dtl@A@before\@dtl@beforepart
+ \let\@dtl@A@after\@dtl@afterpart
+ }%
+ }%
+ {%
+ \let\@dtl@A@comma\@dtl@replaced
+ \let\@dtl@A@before\@dtl@beforepart
+ \let\@dtl@A@after\@dtl@afterpart
+ }%
+% \end{macrocode}
+% Now find if the second string has an inverted order.
+% \begin{macrocode}
+ \expandafter\DTLsplitstring\expandafter
+ {\@dtl@argB}{\datatoolpersoncomma}{\@dtl@beforepart}{\@dtl@afterpart}%
+ \ifdefempty{\@dtl@replaced}%
+ {%
+ \expandafter\DTLsplitstring\expandafter
+ {\@dtl@argB}{\datatoolplacecomma}{\@dtl@beforepart}{\@dtl@afterpart}%
+ \ifdefempty{\@dtl@replaced}%
+ {%
+ \expandafter\DTLsplitstring\expandafter
+ {\@dtl@argB}{\datatoolsubjectcomma}{\@dtl@beforepart}{\@dtl@afterpart}%
+ \ifdefempty{\@dtl@replaced}%
+ {%
+ \expandafter\DTLsplitstring\expandafter
+ {\@dtl@argB}{\datatoolparenstart}{\@dtl@beforepart}{\@dtl@afterpart}%
+ \ifdefempty{\@dtl@replaced}%
+ {%
+ \def\@dtl@B@comma{0}%
+ \let\@dtl@B@before\@dtl@argB
+ \def\@dtl@B@after{}%
+ }%
+ {%
+ \let\@dtl@B@comma\@dtl@replaced
+ \let\@dtl@B@before\@dtl@beforepart
+ \let\@dtl@B@after\@dtl@afterpart
+ }%
+ }%
+ {%
+ \let\@dtl@B@comma\@dtl@replaced
+ \let\@dtl@B@before\@dtl@beforepart
+ \let\@dtl@B@after\@dtl@afterpart
+ }%
+ }%
+ {%
+ \let\@dtl@B@comma\@dtl@replaced
+ \let\@dtl@B@before\@dtl@beforepart
+ \let\@dtl@B@after\@dtl@afterpart
+ }%
+ }%
+ {%
+ \let\@dtl@B@comma\@dtl@replaced
+ \let\@dtl@B@before\@dtl@beforepart
+ \let\@dtl@B@after\@dtl@afterpart
+ }%
+% \end{macrocode}
+% Get the first letter and find out if it's a letter, digit or
+% symbol.
+% \begin{macrocode}
+ \expandafter\dtl@ifcasechargroup\@dtl@A@before\dtl@end@ifcasechargroup
+ {\def\@dtl@A@chargroup{2}}%
+ {\def\@dtl@A@chargroup{1}}%
+ {\def\@dtl@A@chargroup{0}}%
+ \expandafter\dtl@ifcasechargroup\@dtl@B@before\dtl@end@ifcasechargroup
+ {\def\@dtl@B@chargroup{2}}%
+ {\def\@dtl@B@chargroup{1}}%
+ {\def\@dtl@B@chargroup{0}}%
+% \end{macrocode}
+% Are they in the same group?
+% \begin{macrocode}
+ \ifnum\@dtl@A@chargroup<\@dtl@B@chargroup
+ #1=-1\relax
\else
- \ifnum\dtl@codeB=-1\relax
- \protected@edef\dtl@donext{%
- \noexpand\dtlicompare
- {\noexpand#1}{\dtl@firstA\dtl@restA}{\dtl@restB}}%
- \dtl@donext
+ \ifnum\@dtl@A@chargroup>\@dtl@B@chargroup
+ #1=1\relax
\else
- \ifnum\dtl@codeA<\dtl@codeB
- #1=-1\relax
- \else
- \ifnum\dtl@codeA>\dtl@codeB
- #1=1\relax
+% \end{macrocode}
+% In the same group. Which group are they in?
+% \begin{macrocode}
+ \ifcase\@dtl@A@chargroup
+% \end{macrocode}
+% Symbol group
+% \begin{macrocode}
+ \protected@edef\dtl@donext{%
+ \noexpand\dtlcompare
+ {\noexpand#1}{\@dtl@A@before}{\@dtl@B@before}}%
+ \dtl@donext
+% \end{macrocode}
+% Number.
+% \begin{macrocode}
+ \or
+ \ifnum\@dtl@A@before<\@dtl@B@before\relax
+ #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
- }%
- }%
+ \ifnum\@dtl@A@before>\@dtl@B@before\relax
+ #1=1\relax
+ \else
+ #1=0\relax
+ \fi
+ \fi
+ \or
+% \end{macrocode}
+% Word or phrase.
+% \begin{macrocode}
+ \@dtlwordindexcompare{#1}{\@dtl@A@before}{\@dtl@B@before}
+ {\dtlicomparewords}{#4}%
+% \end{macrocode}
+% If they are equal, do we have an inverted order?
+% \begin{macrocode}
+ \ifnum#1=0\relax
+% \end{macrocode}
+% Temporarily redefine the inversion commas to numbers to make the
+% comparisons easier.
+% \begin{macrocode}
+ \let\@org@dtl@person@comma\datatoolpersoncomma
+ \let\@org@dtl@place@comma\datatoolplacecomma
+ \let\@org@dtl@subject@comma\datatoolsubjectcomma
+ \let\@org@dtl@paren@start\datatoolparenstart
+% \end{macrocode}
+% People first, then places, then subjects, then no inversion, then
+% parenthetical.
+% \begin{macrocode}
+ \def\datatoolpersoncomma{3}%
+ \def\datatoolplacecomma{2}%
+ \def\datatoolsubjectcomma{1}%
+ \def\datatoolparenstart{-1}%
+% \end{macrocode}
+% Now compare:
+% \begin{macrocode}
+ \ifnum\@dtl@A@comma>\@dtl@B@comma\relax
+ #1=-1\relax
+ \else
+ \ifnum\@dtl@A@comma<\@dtl@B@comma\relax
+ #1=1\relax
+ \else
+% \end{macrocode}
+% They are the same type. First do a reverse case sensitive comparison.
+% \begin{macrocode}
+ \@dtlwordindexcompare{#1}{\@dtl@B@before}{\@dtl@A@before}
+ {\dtlcomparewords}{#4}%
+% \end{macrocode}
+% Are they still equal?
+% \begin{macrocode}
+ \ifnum#1=0\relax
+% \end{macrocode}
+% So sort on inversion.
+% \begin{macrocode}
+ \@dtlwordindexcompare{#1}{\@dtl@A@after}{\@dtl@B@after}
+ {\dtlicomparewords}{#4}%
+ \fi
+ \fi
+ \fi
+% \end{macrocode}
+% Restore original definitions.
+% \begin{macrocode}
+ \let\datatoolpersoncomma\@org@dtl@person@comma
+ \let\datatoolplacecomma\@org@dtl@place@comma
+ \let\datatoolsubjectcomma\@org@dtl@subject@comma
+ \let\datatoolparenstart\@org@dtl@paren@start
\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
+ }%
+ }%
+}%
+% \end{macrocode}
+%\end{macro}
+%
+% Need to indicate type of inversion.
+%\begin{macro}{\datatoolpersoncomma}
+% \begin{macrocode}
+\newcommand*{\datatoolpersoncomma}{,\space}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\datatoolplacecomma}
+% \begin{macrocode}
+\newcommand*{\datatoolplacecomma}{,\space}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\datatoolsubjectcomma}
+% \begin{macrocode}
+\newcommand*{\datatoolsubjectcomma}{,\space}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\datatoolparenstart}
+% \begin{macrocode}
+\newcommand*{\datatoolparenstart}{\space}
+% \end{macrocode}
+%\end{macro}
+%
+%
+%\begin{macro}{\@dtlwordindexcompare}
+%\begin{definition}
+%\cs{@dtlwordindexcompare}\marg{count}\marg{cs A}\marg{cs
+%B}\marg{word comparison handler}\marg{word break replacement}
+%\end{definition}
+% \begin{macrocode}
+\newcommand*{\@dtlwordindexcompare}[5]{%
+% \end{macrocode}
+% Word or phrase. Replace word breaks.
+% \begin{macrocode}
+ \dtl@setwordbreaks{#2}{#5}%
+ \let#2\dtl@string
+% \end{macrocode}
+% And again for the second string.
+% \begin{macrocode}
+ \dtl@setwordbreaks{#3}{}%
+ \let#3\dtl@string
+% \end{macrocode}
+% Now compare both strings.
+% \begin{macrocode}
+% \@dtl@dict@compare{#1}{#2}{#3}{#4}%
+ \edef\@dtl@do@compare{%
+ \noexpand#4{\noexpand#1}%
+ {\expandonce#2}{\expandonce#3}%
+ }%
+ \@dtl@do@compare
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\@dtl@dict@compare}
+%\begin{definition}
+%\cs{@dtl@dict@compare}\marg{count}\marg{cs A}\marg{cs
+%B}\marg{word comparison handler}
+%\end{definition}
+% Now that all the word breaks have been identified with
+% \cs{@dtl@wordbreak} compare both strings.
+% \begin{macrocode}
+\newcommand*{\@dtl@dict@compare}[4]{%
+% \end{macrocode}
+% Are either empty?
+% \begin{macrocode}
+ \ifdefempty{#2}%
+ {%
+% \end{macrocode}
+% A is empty. Is B empty?
+% \begin{macrocode}
+ \ifdefempty{#3}%
+ {%
+% \end{macrocode}
+% Both are empty.
+% \begin{macrocode}
+ #1=0\relax
+ }%
+ {%
+% \end{macrocode}
+% A is empty but B isn't
+% \begin{macrocode}
+ #1=-1\relax
+ }%
+ }%
+ {%
+% \end{macrocode}
+% A isn't empty. Is B empty?
+% \begin{macrocode}
+ \ifdefempty{#3}%
+ {%
+% \end{macrocode}
+% B is empty but A isn't.
+% \begin{macrocode}
+ #1=1\relax
+ }%
+ {%
+% \end{macrocode}
+% Neither are empty. Grab first word from A.
+% \begin{macrocode}
+ \expandafter\dtl@grabword#2\@dtl@endgrabword\dtl@A@first\dtl@A@remain
+% \end{macrocode}
+% Grab first word from B.
+% \begin{macrocode}
+ \expandafter\dtl@grabword#3\@dtl@endgrabword\dtl@B@first\dtl@B@remain
+% \end{macrocode}
+% Compare A and B.
+% \begin{macrocode}
+ \edef\@dtl@do@compare{%
+ \noexpand#4{\noexpand#1}%
+ {\expandonce\dtl@A@first}{\expandonce\dtl@B@first}%
+ }%
+ \@dtl@do@compare
+% \end{macrocode}
+% Are they the same?
+% \begin{macrocode}
+ \ifnum#1=0\relax
+% \end{macrocode}
+% They are, so compare on the next word.
+% \begin{macrocode}
+ \@dtl@dict@compare{#1}{\dtl@A@remain}{\dtl@B@remain}{#4}%
+ \fi
+ }%
+ }%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\dtl@grabword}
+% Grab first word from phrase.
+% \begin{macrocode}
+\def\dtl@grabword#1\@dtl@wordbreak#2\@dtl@endgrabword#3#4{%
+ \def#3{#1}%
+ \def#4{#2}%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\dtlicomparewords}
+%\begin{definition}
+%\cs{dtlicomparewords}\marg{count}\marg{word A}\marg{word B}
+%\end{definition}
+%This does a case insensitive comparison.
+% \begin{macrocode}
+\newcommand{\dtlicomparewords}[3]{%
+ \dtlicompare{#1}{#2}{#3}%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\dtlcomparewords}
+%\begin{definition}
+%\cs{dtlcomparewords}\marg{count}\marg{word A}\marg{word B}
+%\end{definition}
+%This does a case sensitive comparison.
+% \begin{macrocode}
+\newcommand{\dtlcomparewords}[3]{%
+ \dtlcompare{#1}{#2}{#3}%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\dtl@setwordbreaks}
+% Replace word breaks (space, \cs{space}, \cs{\space}, \verb|~| and
+% hyphen \texttt{-}) with the second argument (either
+% \cs{@dtl@wordbreak} for letter sort or nothing for word sort). Result is stored in
+% \cs{dtl@string}.
+% \begin{macrocode}
+\newcommand*{\dtl@setwordbreaks}[2]{%
+ \expandafter\dtl@subnobrsp\expandafter{#1}{\dtl@string}%
+ \DTLsubstituteall{\dtl@string}{~}{#2}%
+ \DTLsubstituteall{\dtl@string}{\ }{#2}%
+ \DTLsubstituteall{\dtl@string}{\space}{#2}%
+ \DTLsubstituteall{\dtl@string}{-}{#2}%
+% \end{macrocode}
+% Now deal with actual spaces.
+% \begin{macrocode}
+ \toks@{#2}%
+ \edef\dtl@do@setwordbreaks{%
+ \noexpand\@dtl@setwordbreaks{\the\toks@}\expandonce\dtl@string\space\noexpand\@nil}%
+ \def\dtl@string{}%
+ \dtl@do@setwordbreaks
+}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\@dtl@setwordbreaks}
+% \begin{macrocode}
+\def\@dtl@setwordbreaks#1#2 #3{%
+ \def\dtl@tmp{#3}%
+ \ifx\@nnil\dtl@tmp
+% \end{macrocode}
+% Reached end of loop.
+% \begin{macrocode}
+ \let\@dtl@setwordbreaks@next\@gobbletwo
+ \appto\dtl@string{#2}%
+ \else
+ \let\@dtl@setwordbreaks@next\@dtl@setwordbreaks
+ \appto\dtl@string{#2#1}%
+ \fi
+ \@dtl@setwordbreaks@next{#1}#3%
+}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\@dtl@setwordbreaksnohyphens}
+% As \cs{dtl@setwordbreaks} but excludes hyphens.
+% \begin{macrocode}
+\newcommand*{\dtl@setwordbreaksnohyphens}[2]{%
+ \expandafter\dtl@subnobrsp\expandafter{#1}{\dtl@string}%
+ \DTLsubstituteall{\dtl@string}{~}{#2}%
+ \DTLsubstituteall{\dtl@string}{\ }{#2}%
+ \DTLsubstituteall{\dtl@string}{\space}{#2}%
+% \end{macrocode}
+% Now deal with actual spaces.
+% \begin{macrocode}
+ \toks@{#2}%
+ \edef\dtl@do@setwordbreaks{%
+ \noexpand\@dtl@setwordbreaks{\the\toks@}\expandonce\dtl@string\space\noexpand\@nil}%
+ \def\dtl@string{}%
+ \dtl@do@setwordbreaks
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\@dtl@wordbreak}
+% \begin{macrocode}
+\newcommand*{\@dtl@wordbreak}{ }
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\dtl@ifcasechargroup}
+% Determine if first character is a letter, a digit or a symbol.
+% \begin{macrocode}
+\def\dtl@ifcasechargroup#1#2\dtl@end@ifcasechargroup#3#4#5{%
+ \dtlifcasechargroup{#1}%
+ {#3}%
+ {%
+% \end{macrocode}
+% Starts with a digit. Is the whole thing an integer?
+% \begin{macrocode}
+ \DTLifint{#1#2}
+ {%
+ #4%
+ }%
+ {%
+% \end{macrocode}
+% No, it isn't. Consider it a string.
+% \begin{macrocode}
+ #3%
+ }%
+ }%
+ {#5}%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{macro}
+%\begin{definition}
+%\cs{dtlifcasechargroup}\marg{char}\marg{case letter}\marg{case
+%digit}\marg{case symbol}
+%\end{definition}
+% \begin{macrocode}
+\newcommand*{\dtlifcasechargroup}[4]{%
+ \count@=`#1\relax
+ \dtlifintclosedbetween{\number\count@}{48}{57}%
+ {%
+% \end{macrocode}
+% It's a digit.
+% \begin{macrocode}
+ #3%
+ }%
+ {%
+ \dtlifintclosedbetween{\number\count@}{97}{122}%
+ {%
+% \end{macrocode}
+% Lower case letter
+% \begin{macrocode}
+ #2%
+ }%
+ {%
+ \dtlifintclosedbetween{\number\count@}{65}{90}%
+ {%
+% \end{macrocode}
+% Upper case letter
+% \begin{macrocode}
+ #2%
+ }%
+ {%
+% \end{macrocode}
+% Other
+% \begin{macrocode}
+ #4%
}%
}%
}%
@@ -2965,6 +3645,43 @@ datatool.dtx
% \end{macrocode}
%\end{macro}
%
+%\begin{macro}{\dtlparsewords}
+%\changes{2.13}{2013-01-15}{new}
+%\begin{definition}
+%\cs{dtlparsewords}\marg{phrase}\marg{handler cs}
+%\end{definition}
+% Iterates through the given phrase. Hyphens are considered word
+% boundaries.
+% \begin{macrocode}
+\newcommand*{\dtlparsewords}[2]{%
+ \dtl@subnobrsp{#1}{\dtl@string}%
+ \DTLsubstituteall{\dtl@string}{~}{ }%
+ \DTLsubstituteall{\dtl@string}{\ }{ }%
+ \DTLsubstituteall{\dtl@string}{\space}{ }%
+ \DTLsubstituteall{\dtl@string}{-}{ }%
+ \let\dtl@parsewordshandler#2\relax
+ \edef\dtl@donext{%
+ \noexpand\@dtl@parse@words\expandonce\dtl@string\space\noexpand\@nil}%
+ \dtl@donext
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\@dtl@parse@words}
+% \begin{macrocode}
+\def\@dtl@parse@words#1 #2{%
+ \def\dtl@tmp{#2}%
+ \ifx\@nnil\dtl@tmp
+ \let\parse@wordsnext=\@gobble
+ \else
+ \let\parse@wordsnext=\@dtl@parse@words
+ \fi
+ \dlt@parsewordshandler{#1}%
+ \parse@wordsnext#2%
+}
+% \end{macrocode}
+%\end{macro}
+%
%\begin{macro}{\DTLifstringlt}
%\begin{definition}
%\cs{DTLifstringlt}\marg{string1}\marg{string2}\marg{true part}\marg{false part}
@@ -3235,9 +3952,9 @@ datatool.dtx
%\changes{1.01}{2007 Aug 17}{new}
% \begin{macrocode}
\newcommand*{\DTLifSubString}[4]{%
- \protected@edef\@dtl@tmp{\noexpand\dtl@testifsubstring
+ \protected@edef\@dtl@dotestifsubstring{\noexpand\dtl@testifsubstring
{#1}{#2}}%
- \@dtl@tmp
+ \@dtl@dotestifsubstring
\if@dtl@condition
#3%
\else
@@ -3251,6 +3968,22 @@ datatool.dtx
\newcommand*{\dtl@testifsubstring}[2]{%
\dtl@subnobrsp{#1}{\@dtl@argA}%
\dtl@subnobrsp{#2}{\@dtl@argB}%
+% \end{macrocode}
+% Identify all word breaks.
+%\changes{2.13}{2013-01-15}{now using \cs{dtl@setwordbreaksnohyphens} to
+%deal with spaces}
+% \begin{macrocode}
+ \dtl@setwordbreaksnohyphens{\@dtl@argA}{\@dtl@wordbreak}%
+ \let\@dtl@argA\dtl@string
+ \dtl@setwordbreaksnohyphens{\@dtl@argB}{\@dtl@wordbreak}%
+ \let\@dtl@argB\dtl@string
+ \edef\dtl@donext{%
+ \noexpand\@dtl@testifsubstring{\expandonce\@dtl@argA}{\expandonce\@dtl@argB}}%
+ \dtl@donext
+}
+\newcommand*{\@dtl@testifsubstring}[2]{%
+ \def\@dtl@argA{#1}%
+ \def\@dtl@argB{#2}%
\ifdefempty{\@dtl@argB}%
{%
\@dtl@conditiontrue
@@ -3261,16 +3994,15 @@ datatool.dtx
\@dtl@conditionfalse
}%
{%
- \dtl@teststartswith{#1}{#2}%
+ \@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}%
+ \expandafter\@dtl@testifsubstring\expandafter{\dtl@rest}{#2}%
}{%
- \protected@edef\@dtl@donext{\noexpand\dtl@testifsubstring
- {\dtl@first\dtl@rest}{\@dtl@argB}}%
+ \protected@edef\@dtl@donext{\noexpand\@dtl@testifsubstring
+ {\expandonce\dtl@first\expandonce\dtl@rest}{\expandonce\@dtl@argB}}%
\@dtl@donext
}%
\fi
@@ -3307,11 +4039,29 @@ datatool.dtx
%\cs{dtl@teststartswith}\marg{string}\marg{prefix}
%\end{definition}
% Tests if \meta{string} starts with \meta{prefix}. This sets
-% \cs{if@dtl@condition}.
+% \cs{if@dtl@condition}. First substitute all word breaks with
+% \cs{dtl@setwordbreaksnohyphen}
% \begin{macrocode}
\newcommand*{\dtl@teststartswith}[2]{%
\dtl@subnobrsp{#1}{\@dtl@argA}%
\dtl@subnobrsp{#2}{\@dtl@argB}%
+% \end{macrocode}
+% Identify all word breaks.
+%\changes{2.13}{2013-01-15}{now using \cs{dtl@setwordbreaksnohyphens} to
+%deal with spaces}
+% \begin{macrocode}
+ \dtl@setwordbreaksnohyphens{\@dtl@argA}{\@dtl@wordbreak}%
+ \let\@dtl@argA\dtl@string
+ \dtl@setwordbreaksnohyphens{\@dtl@argB}{\@dtl@wordbreak}%
+ \let\@dtl@argB\dtl@string
+ \edef\dtl@donext{%
+ \noexpand\@dtl@teststartswith{\expandonce\@dtl@argA}{\expandonce\@dtl@argB}}%
+ \dtl@donext
+}
+
+\newcommand*{\@dtl@teststartswith}[2]{%
+ \def\@dtl@argA{#1}%
+ \def\@dtl@argB{#2}%
\ifdefempty{\@dtl@argA}%
{%
\ifdefempty{\@dtl@argB}%
@@ -3328,54 +4078,79 @@ datatool.dtx
\@dtl@conditiontrue
}%
{%
- \DTLsubstituteall{\@dtl@argA}{ }{\space }%
- \DTLsubstituteall{\@dtl@argB}{ }{\space }%
\expandafter\dtl@getfirst\@dtl@argA\end
+% \end{macrocode}
+% Get the first object and the remaining text.
+% \begin{macrocode}
\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
+% \end{macrocode}
+% Is the first object of \meta{string1} a single character or a group?
+% \begin{macrocode}
+ \expandafter\dtl@ifsingle\expandafter{\dtl@firstA}%
+ {%
+% \end{macrocode}
+% It's a single character. Is the first object of \meta{string2} a
+% single character or a group?
+% \begin{macrocode}
+ \expandafter\dtl@ifsingle\expandafter{\dtl@firstB}%
+ {%
+% \end{macrocode}
+% Both are a single character. Get the lower case character code.
+% \begin{macrocode}
+ \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{\expandonce\dtl@restA}{\expandonce\dtl@restB}}%
+ \dtl@donext
+ \else
+ \protected@edef\dtl@donext{%
+ \noexpand\@dtl@teststartswith
+ {\expandonce\dtl@restA}{\expandonce\dtl@firstB\expandonce\dtl@restB}}%
+ \dtl@donext
+ \fi
\else
- \@dtl@conditionfalse
+ \ifnum\dtl@codeB=-1\relax
+ \protected@edef\dtl@donext{%
+ \noexpand\@dtl@teststartswith
+ {\expandonce\dtl@firstA\expandonce\dtl@restA}{\expandonce\dtl@restB}}%
+ \dtl@donext
+ \else
+ \ifnum\dtl@codeA=\dtl@codeB
+ \protected@edef\dtl@donext{%
+ \noexpand\@dtl@teststartswith{\expandonce\dtl@restA}{\expandonce\dtl@restB}}%
+ \dtl@donext
+ \else
+ \@dtl@conditionfalse
+ \fi
+ \fi
\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}}%
+ }%
+ {%
+% \end{macrocode}
+% The first object in \meta{string1} is a single character, but the
+% first object in \meta{string2} isn't a single character.
+% \begin{macrocode}
+ \protected@edef\dtl@donext{%
+ \noexpand\@dtl@teststartswith
+ {\expandonce\dtl@firstA\expandonce\dtl@restA}%
+ {\expandonce\dtl@firstB\expandonce\dtl@restB}}%
+ \dtl@donext
+ }%
+ }%
+ {%
+% \end{macrocode}
+% Neither object is a single character.
+% \begin{macrocode}
+ \protected@edef\dtl@donext{%
+ \noexpand\@dtl@teststartswith
+ {\expandonce\dtl@firstA\expandonce\dtl@restA}%
+ {\expandonce\dtl@firstB\expandonce\dtl@restB}}%
}%
}%
}%
@@ -4380,7 +5155,7 @@ datatool.dtx
% Definitions of fixed-point commands that use the \sty{fp} package.
% \begin{macrocode}
\NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{datatool-fp}[2012/09/25 v2.11 (NLCT)]
+\ProvidesPackage{datatool-fp}[2013/01/15 v2.13 (NLCT)]
% \end{macrocode}
% Required packages:
% \begin{macrocode}
@@ -4669,7 +5444,7 @@ datatool.dtx
% Definitions of fixed-point commands that use the \sty{pgfmath} package.
% \begin{macrocode}
\NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{datatool-pgfmath}[2012/10/06 v2.12 (NLCT)]
+\ProvidesPackage{datatool-pgfmath}[2013/01/15 v2.13 (NLCT)]
% \end{macrocode}
% Required packages:
% \begin{macrocode}
@@ -4926,7 +5701,7 @@ datatool.dtx
%\section{Package Declaration}
% \begin{macrocode}
\NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{datatool}[2012/09/25 v2.11 (NLCT)]
+\ProvidesPackage{datatool}[2013/01/15 v2.13 (NLCT)]
% \end{macrocode}
% Load required packages:
% \begin{macrocode}
@@ -5112,11 +5887,13 @@ datatool.dtx
%\begin{option}{math}
% Determine whether to use \sty{fp} or \sty{pgfmath} for the
% arithmetic commands. The default is to use \sty{fp}.
+%\changes{2.13}{2013-01-15}{changed \cs{newcommand} to
+%\cs{providecommand}}
% \begin{macrocode}
\define@choicekey{datatool.sty}{math}[\val\nr]{fp,pgfmath}{%
\renewcommand*\@dtl@mathprocessor{#1}%
}
-\newcommand*{\@dtl@mathprocessor}{fp}
+\providecommand*{\@dtl@mathprocessor}{fp}
% \end{macrocode}
%\end{option}
%
@@ -5284,6 +6061,101 @@ datatool.dtx
% \end{macrocode}
%\end{macro}
%
+%\begin{macro}{\DTLgnewdb}
+%\begin{definition}
+% \cs{DTLnewdb}\marg{db name}
+%\end{definition}
+%\changes{2.13}{2013-01-15}{new}
+% Initialises a database called \meta{name}. (Global version.)
+% \begin{macrocode}
+\newcommand*{\DTLgnewdb}[1]{%
+% \end{macrocode}
+% Check if there is already a database with this name.
+% \begin{macrocode}
+ \DTLifdbexists{#1}%
+ {%
+ \PackageError{datatool}{Database `#1' already exists}{}%
+ }%
+ {%
+% \end{macrocode}
+% Define new database. Add information message if in verbose
+% mode.
+% \begin{macrocode}
+ \dtl@message{Creating database `#1'}%
+% \end{macrocode}
+% Define token register used to store the contents of the database.
+% \begin{macrocode}
+ \expandafter\global\expandafter\newtoks\csname dtldb@#1\endcsname
+% \end{macrocode}
+% Define token register used to store the column header information.
+% \begin{macrocode}
+ \expandafter\global\expandafter\newtoks\csname dtlkeys@#1\endcsname{}%
+% \end{macrocode}
+% Define count register used to store the row count.
+% \begin{macrocode}
+ \expandafter\global\expandafter\newcount\csname dtlrows@#1\endcsname
+% \end{macrocode}
+% Define count register used to store the column count.
+% \begin{macrocode}
+ \expandafter\global\expandafter\newcount\csname dtlcols@#1\endcsname
+ }%
+}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\DTLgdeletedb}
+%\begin{definition}
+% \cs{DTLgdeletedb}\marg{db name}
+%\end{definition}
+% Deletes a database. (Global version.)
+%\changes{2.13}{2013-01-15}{new}
+% \begin{macrocode}
+\newcommand*{\DTLgdeletedb}[1]{%
+ \DTLifdbexists{#1}%
+ {%
+ \dtlforeachkey(\@dtl@key,\@dtl@col,\@dtl@type,\@dtl@head)\in{#1}\do
+ {%
+ \expandafter\global\expandafter\let\csname dtl@ci@#1@\@dtl@key\endcsname\undefined
+ }%
+ \expandafter\global\expandafter\let\csname dtldb@#1\endcsname\undefined
+ \expandafter\global\expandafter\let\csname dtlkeys@#1\endcsname\undefined
+ \expandafter\global\expandafter\let\csname dtlrows@#1\endcsname\undefined
+ \expandafter\global\expandafter\let\csname dtlcols@#1\endcsname\undefined
+ }%
+ {%
+ \PackageError{Can't delete database `#1':
+ database doesn't exist}{}{}%
+ }%
+}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\DTLgcleardb}
+%\begin{definition}
+% \cs{DTLgcleardb}\marg{db name}
+%\end{definition}
+% Clears the database. (Global version.)
+%\changes{2.13}{2013-01-15}{new}
+% \begin{macrocode}
+\newcommand*{\DTLgcleardb}[1]{%
+ \DTLifdbexists{#1}%
+ {%
+ \dtlforeachkey(\@dtl@key,\@dtl@col,\@dtl@type,\@dtl@head)\in{#1}\do
+ {%
+ \expandafter\global\expandafter\let\csname dtl@ci@#1@\@dtl@key\endcsname\undefined
+ }%
+ \expandafter\global\csname dtldb@#1\endcsname{}%
+ \expandafter\global\csname dtlkeys@#1\endcsname{}%
+ \expandafter\global\csname dtlrows@#1\endcsname=0\relax
+ \expandafter\global\csname dtlcols@#1\endcsname=0\relax
+ }%
+ {%
+ \PackageError{Can't clear database `#1':
+ database doesn't exist}{}{}%
+ }%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%
%\begin{macro}{\DTLrowcount}
%\begin{definition}
% \cs{DTLrowcount}\marg{db name}
@@ -5362,11 +6234,12 @@ datatool.dtx
%\end{definition}
% Add a new row to named database. (Checks for the existance
% of the database.)
+%\changes{2.13}{2013-01-15}{fixed typo in \cs{PackageError}}
% \begin{macrocode}
\newcommand*{\@DTLnewrow}[1]{%
\DTLifdbexists{#1}%
{\@sDTLnewrow{#1}}%
- {\PackageErrors{datatool}{Can't add new row to database `#1':
+ {\PackageError{datatool}{Can't add new row to database `#1':
database doesn't exist}{}}%
}
% \end{macrocode}
@@ -6057,12 +6930,13 @@ datatool.dtx
\newcommand*{\@dtl@setheaderforindex}[3]{%
% \end{macrocode}
% Get the properties for this column
+%\changes{2.13}{2013-01-15}{removed spurious space}
% \begin{macrocode}
\edef\@dtl@dogetprops{\noexpand\@dtl@getprops
{\noexpand\@dtl@key}{\noexpand\@dtl@type}%
{\noexpand\@dtl@colhead}{\noexpand\@dtl@before}%
{\noexpand\@dtl@after}{\the\csname dtlkeys@#1\endcsname}%
- {\number#2}}
+ {\number#2}}%
\@dtl@dogetprops
% \end{macrocode}
% Store the header in \cs{@dtl@toks}
@@ -6171,7 +7045,7 @@ datatool.dtx
%\changes{2.03}{2009 November 15}{value can be expanded before
% adding to database}%
% \begin{macrocode}
- \@dtl@setnewvalue{#3}%
+ \@dtl@setnewvalue{#3}%
% \end{macrocode}
% There are no entries in this row for the given column.
% Add this entry.
@@ -6354,7 +7228,7 @@ datatool.dtx
%
%\begin{macro}{\@dtl@setnull}
%\cs{@dtl@setnull}\marg{cmd}\marg{id} sets \meta{cmd} to either
-% \cs{DTLstringnull} or \cs{DTLnumbernull} depending on the data
+% \cs{@dtlstringnull} or \cs{@dtlnumbernull} depending on the data
% type for \meta{id}. (Database
% name should be stored in \cs{@dtl@dbname} prior to use.)
%\changes{2.0}{2009 February 27}{modified to use new database
@@ -6411,31 +7285,49 @@ datatool.dtx
%\begin{macro}{\DTLstringnull}
% String null value:
% \begin{macrocode}
-\newcommand*{\DTLstringnull}{NULL}
+\newcommand*{\DTLstringnull}{\@dtlstringnull}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\@dtlstringnull}
+%\changes{2.13}{2013-01-15}{new}
+% String null value:
+% \begin{macrocode}
+\newcommand*{\@dtlstringnull}{NULL}
% \end{macrocode}
%\end{macro}
%\begin{macro}{\DTLnumbernull}
% Number null value:
% \begin{macrocode}
-\newcommand*{\DTLnumbernull}{0}
+\newcommand*{\DTLnumbernull}{\@dtlnumbernull}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\@dtlnumbernull}
+%\changes{2.13}{2013-01-15}{new}
+% Number null value:
+% \begin{macrocode}
+\newcommand*{\@dtlnumbernull}{0}
% \end{macrocode}
%\end{macro}
%\begin{macro}{\DTLifnull}
%\begin{definition}
-%\cs{DTLifnull}\marg{value}\marg{true part}\marg{false part}
+%\cs{DTLifnull}\marg{command}\marg{true part}\marg{false part}
%\end{definition}
-% Checks if \meta{value} is null (either \cs{DTLstringnull} or
+% Checks if \meta{command} is null (either \cs{DTLstringnull} or
% \cs{DTLnumbernull}) if true, does \meta{true part} otherwise
% does \meta{false part}.
% \begin{macrocode}
\newcommand*{\DTLifnull}[3]{%
- \ifx\DTLstringnull#1\relax
+ \ifx#1\dtlnovalue
#2%
\else
- \ifx\DTLnumbernull#1\relax
+ \ifx#1\DTLstringnull
#2%
\else
- #3%
+ \ifx#1\DTLnumbernull
+ #2%
+ \else
+ #3%
+ \fi
\fi
\fi
}
@@ -7267,7 +8159,8 @@ datatool.dtx
%\end{definition}
% Iterates through all the keys in database \meta{db}. In each
% iteration, \meta{key cs} stores the key, \meta{col cs} stores the
-% column index and \meta{type cs} stores the data type.
+% column index,\meta{type cs} stores the data type and \meta{header
+% cs} stores the header.
% \begin{macrocode}
\long\def\dtlforeachkey(#1,#2,#3,#4)\in#5\do#6{%
\gdef\@dtl@loopbody{#6}%
@@ -7425,11 +8318,11 @@ datatool.dtx
% Iterates through the column with index <col num> in database <db>.
% Starred version doesn't check if database exists.
%\changes{2.0}{2009 February 27}{new}
-% \begin{macrocode}
+% \begin{macrocode}
\newcommand*{\dtlforcolumnidx}{%
\@ifstar\@sdtlforcolumnidx\@dtlforcolumnidx
}
-% \end{macrocode}
+% \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@dtlforcolumnidx}
@@ -7471,7 +8364,7 @@ datatool.dtx
}%
\@dtl@doforcol
}
-% \end{macrocode}
+% \end{macrocode}
%\end{macro}
%
%\begin{macro}{\dtl@forcolumn}
@@ -7722,11 +8615,12 @@ datatool.dtx
\DTLiflastrow
% \end{macrocode}
% Define current \cs{DTLiflastrow}
+%\changes{2.12}{2012-11-30}{fixed bug in \cs{DTLiflastrow}}
% \begin{macrocode}
\gdef\DTLiflastrow##1##2{%
\expandafter\ifnum
\csname c@DTLrow\romannumeral\dtlforeachlevel\endcsname
- =\csname dtlcols@#2\endcsname\relax
+ =\csname dtlrows@#2\endcsname\relax
##1%
\else
##2%
@@ -7991,11 +8885,12 @@ datatool.dtx
\DTLiflastrow
% \end{macrocode}
% Define current \cs{DTLiflastrow}
+%\changes{2.12}{2012-11-30}{fixed bug in \cs{DTLiflastrow}}
% \begin{macrocode}
\gdef\DTLiflastrow##1##2{%
\expandafter\ifnum
\csname c@DTLrow\romannumeral\dtlforeachlevel\endcsname
- =\csname dtlcols@#2\endcsname\relax
+ =\csname dtlrows@#2\endcsname\relax
##1%
\else
##2%
@@ -8495,9 +9390,10 @@ datatool.dtx
\newcommand{\DTLaddentryforrow}[5]{%
% \end{macrocode}
% Iterate through the data base until condition is met
+%\changes{2.13}{2013-01-15}{removed spurious space}
% \begin{macrocode}
\DTLifdbexists{#1}%
- {
+ {%
\def\@dtl@notdone{\PackageError{datatool}{Unable to add entry
given by key `#4': condition not met for any row in database
`#1'}{}}%
@@ -8572,14 +9468,16 @@ datatool.dtx
\ifx#1\dtlnovalue
\ifnum0\dtltype=0\relax
% \end{macrocode}
+%\changes{2.13}{2013-01-15}{changed to use \cs{@dtlstringnull} and
+%\cs{@dtlnumbernull}}%
% Data type is \meta{empty} or 0, so set to string null.
% \begin{macrocode}
- \let#1=\DTLstringnull
+ \let#1=\@dtlstringnull
\else
% \end{macrocode}
% Data type is numerical, so set to number null.
% \begin{macrocode}
- \let#1=\DTLnumbernull
+ \let#1=\@dtlnumbernull
\fi
\fi
% \end{macrocode}
@@ -8880,9 +9778,10 @@ datatool.dtx
% \end{macrocode}
% Initialise:
% only want "&" between columns
+%\changes{2.13}{2013-01-15}{removed spurious space}
% \begin{macrocode}
- \def\@dtl@doamp{\gdef\@dtl@doamp{&}}
- \def\@dtl@resetdoamp{\gdef\@dtl@doamp{\gdef\@dtl@doamp{&}}}
+ \def\@dtl@doamp{\gdef\@dtl@doamp{&}}%
+ \def\@dtl@resetdoamp{\gdef\@dtl@doamp{\gdef\@dtl@doamp{&}}}%
% \end{macrocode}
% Store maximum number of columns
% \begin{macrocode}
@@ -8905,7 +9804,10 @@ datatool.dtx
{}%
{%
\dtladdalign\@dtl@tabargs\@dtl@type\@dtl@idx\@dtl@maxcols
- }
+% \end{macrocode}
+%\changes{2.13}{2013-01-15}{removed spurious space}
+% \begin{macrocode}
+ }%
}%
% \end{macrocode}
% Begin tabular environment
@@ -9066,9 +9968,10 @@ datatool.dtx
\setkeys{displaylong}{#1}%
% \end{macrocode}
% Only want "&" between columns
+%\changes{2.13}{2013-01-15}{removed spurious space}
% \begin{macrocode}
- \def\@dtl@doamp{\gdef\@dtl@doamp{&}}
- \def\@dtl@resetdoamp{\gdef\@dtl@doamp{\gdef\@dtl@doamp{&}}}
+ \def\@dtl@doamp{\gdef\@dtl@doamp{&}}%
+ \def\@dtl@resetdoamp{\gdef\@dtl@doamp{\gdef\@dtl@doamp{&}}}%
\@dtl@resetdostartrow
% \end{macrocode}
% Store maximum number of columns
@@ -9648,7 +10551,7 @@ datatool.dtx
% Divide total by number of elements summed.
% \begin{macrocode}
\ifnum\@dtl@elements=0\relax
-% \PackageError{datatool}{Unable to evaluate mean: no data}{}%
+ \PackageError{datatool}{Unable to evaluate mean: no data}{}%
\else
\edef\@dtl@n{\number\@dtl@elements}%
\DTLdiv{#4}{#4}{\@dtl@n}%
@@ -10249,32 +11152,7 @@ datatool.dtx
% Unstarred (case sensitive) version.
% \begin{macrocode}
\newcommand{\@DTLsort}[3][]{%
-% \end{macrocode}
-% Check the database exists
-% \begin{macrocode}
- \DTLifdbexists{#3}%
- {%
-% \end{macrocode}
-% Store replacement keys in \cs{@dtl@replacementkeys}.
-% \begin{macrocode}
- \edef\@dtl@replacementkeys{#1}%
-% \end{macrocode}
-% Store sort order in \cs{@dtl@sortorder}.
-% \begin{macrocode}
- \edef\@dtl@sortorder{#2}%
-% \end{macrocode}
-% Set \cs{@dtl@comparecs} to the required string comparison
-% function. (Using case sensitive comparison macro \cs{dtlcompare}.)
-% \begin{macrocode}
- \let\@dtl@comparecs=\dtlcompare
-% \end{macrocode}
-% Sort the database.
-% \begin{macrocode}
- \dtl@sortdata{#3}%
- }%
- {%
- \PackageError{datatool}{Database `#3' doesn't exist}{}%
- }%
+ \dtlsort[#1]{#2}{#3}{\dtlicompare}%
}
% \end{macrocode}
%\end{macro}
@@ -10282,12 +11160,30 @@ datatool.dtx
%\begin{macro}{\@sDTLsort}
% Starred (case insensitive) version.
% \begin{macrocode}
-\newcommand{\@sDTLsort}[3][]{%
+\newcommand*{\@sDTLsort}[3][]{%
+ \dtlsort[#1]{#2}{#3}{\dtlicompare}%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\dtlsort}
+%\changes{2.13}{2013-01-15}{new}
+%\begin{definition}
+%\cs{dtlsort}\oarg{replacement keys}\marg{sort criteria}\marg{db
+%name}\marg{handler}
+%\end{definition}
+% More general version where user supplies a handler for the
+% comparison.
+% \begin{macrocode}
+\newcommand{\dtlsort}[4][]{%
% \end{macrocode}
% Check the database exists
% \begin{macrocode}
\DTLifdbexists{#3}%
{%
+ \ifnum\DTLrowcount{#3}>100\relax
+ \typeout{Sorting `#3' - this may take a while.}%
+ \fi
% \end{macrocode}
% Store replacement keys in \cs{@dtl@replacementkeys}.
% \begin{macrocode}
@@ -10301,7 +11197,7 @@ datatool.dtx
% function. (Using case insensitive comparison macro
% \cs{dtlicompare}.)
% \begin{macrocode}
- \let\@dtl@comparecs=\dtlicompare
+ \let\@dtl@comparecs=#4%
% \end{macrocode}
% Sort the database.
% \begin{macrocode}
@@ -10349,7 +11245,7 @@ datatool.dtx
% \end{macrocode}
% Iterate through each row and insert into sorted list.
% \begin{macrocode}
- \@dtlforeachrow(\@dtl@rowAnum,\@dtl@rowAcontents)\in{#1}\do{%
+ \@dtlforeachrow(\@dtl@rowAnum,\@dtl@rowAcontents)\in\@dtl@dbname\do{%
\@dtl@rowa=\expandafter{\@dtl@rowAcontents}%
% \end{macrocode}
% Create a temporary list
@@ -10372,7 +11268,8 @@ datatool.dtx
\db@row@id@w \@nil\db@row@id@end@%
\db@row@id@w \@nil\db@row@id@end@%
\db@row@elt@end@%
- \@@{\@dtl@rowBnum}{\@dtl@rowBcontents}{%
+ \@@{\@dtl@rowBnum}{\@dtl@rowBcontents}%
+ {%
% \end{macrocode}
% Store row B in a token register
% \begin{macrocode}
@@ -10511,7 +11408,8 @@ datatool.dtx
% \end{macrocode}
% Iterate through the sort order.
% \begin{macrocode}
- \@for\@dtl@level:=\@dtl@sortorder\do{%
+ \@for\@dtl@level:=\@dtl@sortorder\do
+ {%
% \end{macrocode}
% Set \cs{@dtl@sortdirection} to $-1$ (ascending) or $+1$
% (descending). Key is stored in \cs{@dtl@key}.
@@ -10729,8 +11627,9 @@ datatool.dtx
one of `ascending' or `descending'}%
% \end{macrocode}
% Assume ascending.
+%\changes{2.13}{2013-01-15}{removed spurious space}
% \begin{macrocode}
- \def\@dtl@sortdirection{-1}
+ \def\@dtl@sortdirection{-1}%
\fi
\fi
}%
@@ -10750,9 +11649,9 @@ datatool.dtx
% \end{macrocode}
%\end{macro}
%\begin{macro}{\@dtl@toksB}
-% \begin{macrocode}
+% \begin{macrocode}
\newtoks\@dtl@toksB
-% \end{macrocode}
+% \end{macrocode}
%\end{macro}
%\begin{macro}{\dtl@compare}
%\begin{definition}
@@ -11057,6 +11956,168 @@ datatool.dtx
% \end{macrocode}
%\end{macro}
%
+%\begin{macro}{\dtl@saverawdbhook}
+% Hook used by \cs{DTLsaverawdb}.
+% \begin{macrocode}
+\newcommand*{\dtl@saverawdbhook}{}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\DTLsaverawdb}
+% Saves given database in its internal form. Not easy for a human to
+% read, but much faster to load.
+%\changes{2.13}{2013-01-15}{new}
+% \begin{macrocode}
+\newcommand*{\DTLsaverawdb}[2]{%
+ \DTLifdbexists{#1}%
+ {%
+% \end{macrocode}
+% Open output file
+% \begin{macrocode}
+ \openout\@dtl@write=#2\relax
+% \end{macrocode}
+% Add code at the start of the output file to check for the
+% existence of the database:
+% \begin{macrocode}
+ \protected@write{\@dtl@write}{}{%
+ \string\DTLifdbexists{#1}\expandafter\@gobble\string\%^^J%
+ {%
+ \string\PackageError{datatool}{Database `#1' ^^Jalready exists}{}%
+ \expandafter\@gobble\string\%^^J%
+ \string\aftergroup\string\endinput
+ }%
+ {%
+ }\expandafter\@gobble\string\%
+ }%
+% \end{macrocode}
+% Scope need to localise definitions:
+% \begin{macrocode}
+ {%
+% \end{macrocode}
+% \TeX\ automatically breaks the line every 80 characters when
+% writing to a file. This may break a control sequence. This is a
+% patch that puts the row and column markers on a new line.
+% (Problems may still occur if the database contains very long
+% entries, but I'm not sure how to get around that.)
+% \begin{macrocode}
+ \def\db@row@elt@w{\expandafter\@gobble\string\%^^J\string\db@row@elt@w\space}%
+ \def\db@row@elt@end@{\expandafter\@gobble\string\%^^J\string\db@row@elt@end@\space}%
+ \def\db@row@id@w{\expandafter\@gobble\string\%^^J\string\db@row@id@w\space}%
+ \def\db@row@id@end@{\expandafter\@gobble\string\%^^J\string\db@row@id@end@\space}%
+ \def\db@col@elt@w{\expandafter\@gobble\string\%^^J\string\db@col@elt@w\space}%
+ \def\db@col@elt@end@{\expandafter\@gobble\string\%^^J\string\db@col@elt@end@\space}%
+ \def\db@col@id@w{\expandafter\@gobble\string\%^^J\string\db@col@id@w\space}%
+ \def\db@col@id@end@{\expandafter\@gobble\string\%^^J\string\db@col@id@end@\space}%
+%
+ \def\db@plist@elt@w{\expandafter\@gobble\string\%^^J\string\db@plist@elt@w\space}%
+ \def\db@plist@elt@end@{\expandafter\@gobble\string\%^^J\string\db@plist@elt@end@\space}%
+ \def\db@key@id@w{\expandafter\@gobble\string\%^^J\string\db@key@id@w\space}%
+ \def\db@key@id@end@{\expandafter\@gobble\string\%^^J\string\db@key@id@end@\space}%
+ \def\db@type@id@w{\expandafter\@gobble\string\%^^J\string\db@type@id@w\space}%
+ \def\db@type@id@end@{\expandafter\@gobble\string\%^^J\string\db@type@id@end@\space}%
+ \def\db@header@id@w{\expandafter\@gobble\string\%^^J\string\db@header@id@w\space}%
+ \def\db@header@id@end@{\expandafter\@gobble\string\%^^J\string\db@header@id@end@\space}%
+% \end{macrocode}
+% Need to ensure the @ character can be used so \ics{makeatletter}
+% is required, but localise the effect.
+% \begin{macrocode}
+ \protected@write{\@dtl@write}{}{\string\bgroup\string\makeatletter}%
+% \end{macrocode}
+% If in verbose mode, add a message to let the user know what's
+% happening when the file is later loaded.
+% \begin{macrocode}
+ \protected@write{\@dtl@write}{}{\string\dtl@message{Reconstructing database
+ ^^J`#1'}\expandafter\@gobble\string\%}%
+% \end{macrocode}
+% Save the contents of the token register that holds the column
+% information (column id, header, type). (The write is delayed,
+% so the contents are first expanded and stored in a temporary
+% (global) macro to ensure its in the correct format when the write happens.)
+% \begin{macrocode}
+ \protected@write{\@dtl@write}{}{%
+ \string\expandafter
+ \string\global\string\expandafter^^J\string\newtoks
+ \string\csname\space dtlkeys@#1\string\endcsname}%
+ \protected@write{\@dtl@write}{}{%
+ \string\expandafter
+ \string\global^^J
+ \string\csname\space dtlkeys@#1\string\endcsname
+ =\expandafter\@gobble\string\{\expandafter\@gobble\string\%}%
+ \expandafter\protected@xdef\csname dtl@rawwritedbkeys@#1\endcsname{%
+ \the\csname dtlkeys@#1\endcsname}%
+ \protected@write{\@dtl@write}{}{\csname dtl@rawwritedbkeys@#1\endcsname}%
+ \protected@write{\@dtl@write}{}{\expandafter\@gobble\string\}\expandafter\@gobble\string\%}%
+% \end{macrocode}
+% Hook used by \sty{datagidx}:
+% \begin{macrocode}
+ \dtl@saverawdbhook
+% \end{macrocode}
+% Save the contents of the token register that holds the database
+% body.
+% \begin{macrocode}
+ \protected@write{\@dtl@write}{}{%
+ \string\expandafter\string\global
+ \string\expandafter^^J\string\newtoks
+ \string\csname\space dtldb@#1\string\endcsname}%
+ \protected@write{\@dtl@write}{}{%
+ \string\expandafter
+ \string\global^^J\string\csname\space dtldb@#1\string\endcsname
+ =\expandafter\@gobble\string\{\expandafter\@gobble\string\%}%
+ \expandafter\protected@xdef\csname dtl@rawwritedb@#1\endcsname{\the\csname dtldb@#1\endcsname}%
+ \protected@write{\@dtl@write}{}{\csname dtl@rawwritedb@#1\endcsname}%
+ \protected@write{\@dtl@write}{}{\expandafter\@gobble\string\}\expandafter\@gobble\string\%}%
+% \end{macrocode}
+% Now for the count register that keeps track of the row count.
+% \begin{macrocode}
+ \protected@write{\@dtl@write}{}{\string\expandafter\string\global^^J
+ \string\expandafter\string\newcount
+ \string\csname\space dtlrows@#1\string\endcsname}%
+ \protected@write{\@dtl@write}{}{\string\expandafter\string\global^^J
+ \string\csname\space dtlrows@#1\string\endcsname
+ =\expandafter\number\csname dtlrows@#1\endcsname\string\relax}%
+% \end{macrocode}
+% Similarly for the column count.
+% \begin{macrocode}
+ \protected@write{\@dtl@write}{}{\string\expandafter\string\global^^J
+ \string\expandafter\string\newcount
+ \string\csname\space dtlcols@#1\string\endcsname}%
+ \protected@write{\@dtl@write}{}{\string\expandafter\string\global^^J
+ \string\csname\space dtlcols@#1\string\endcsname
+ =\expandafter\number\csname dtlcols@#1\endcsname\string\relax}%
+% \end{macrocode}
+% Add key mappings
+% \begin{macrocode}
+ \dtlforeachkey(\@dtl@key,\@dtl@col,\@dtl@type,\@dtl@head)\in{#1}\do
+ {%
+ \edef\dtl@tmp{%
+ \string\expandafter^^J
+ \string\gdef
+ \string\csname\space dtl@ci@#1@\@dtl@key\string\endcsname
+ {\csname dtl@ci@#1@\@dtl@key\endcsname}\expandafter\@gobble\string\%
+ }%
+ \expandafter\write\expandafter\@dtl@write\expandafter{\dtl@tmp}%
+ }%
+% \end{macrocode}
+% End the scope for \ics{makeatletter:}
+% \begin{macrocode}
+ \protected@write{\@dtl@write}{}{\string\egroup}%
+% \end{macrocode}
+% End current scope:
+% \begin{macrocode}
+ }%
+% \end{macrocode}
+% Close output file
+% \begin{macrocode}
+ \closeout\@dtl@write
+ }%
+ {%
+ \PackageError{datatool}{Can't save database `#1': no such
+ database}{}%
+ }%
+}
+% \end{macrocode}
+%\end{macro}
+%
%\section{Loading a database from an external file}
%
%\begin{macro}{\@dtl@read}
@@ -11133,6 +12194,7 @@ datatool.dtx
% and stores in \meta{cs}.
% \begin{macrocode}
\newcommand*{\@dtl@readline}[2]{%
+% \end{macrocode}
% Read a line from "#1" and store in "#2"
% \begin{macrocode}
\read#1 to #2%
@@ -11144,7 +12206,10 @@ datatool.dtx
}%
{%
\dtl@trim#2%
- }
+% \end{macrocode}
+%\changes{2.13}{2013-01-15}{removed spurious space}
+% \begin{macrocode}
+ }%
}
% \end{macrocode}
%\end{macro}
@@ -11157,6 +12222,7 @@ datatool.dtx
% applies mappings and stores in \meta{cs}.
% \begin{macrocode}
\newcommand*{\@dtl@readrawline}[2]{%
+% \end{macrocode}
% Read a line from "#1" and store in "#2"
% \begin{macrocode}
\@dtl@rawread#1 to #2%
@@ -11172,6 +12238,19 @@ datatool.dtx
% \end{macrocode}
%\end{macro}
%
+%\begin{macro}{\ifDTLnewdbonload}
+% Governs whether or not the database should be defined by
+% \ics{DTLloaddb} and \ics{DTLloadrawdb}.
+%\changes{2.13}{2013-01-15}{new}
+% \begin{macrocode}
+\newif\ifDTLnewdbonload
+% \end{macrocode}
+% Ensure compatibility with previous versions:
+% \begin{macrocode}
+\DTLnewdbonloadtrue
+% \end{macrocode}
+%\end{macro}
+%
%\begin{macro}{\DTLloaddb}
%\begin{definition}
% \cs{DTLloaddb}\oarg{options}\marg{db name}\marg{filename}
@@ -11229,9 +12308,11 @@ datatool.dtx
\read\@dtl@read to \@dtl@line
\repeat
% \end{macrocode}
-% Create the new database.
+% Create the database if required.
% \begin{macrocode}
- \DTLnewdb{#2}%
+ \ifDTLnewdbonload
+ \DTLnewdb{#2}%
+ \fi
% \end{macrocode}
% Check if the file is empty.
% \begin{macrocode}
@@ -11663,8 +12744,11 @@ datatool.dtx
\def\@dtl@rawmappings{{#1}{#2}}%
}%
{%
- \def\@dtl@tmp{{#1}{#2}}
- \protected@edef\@dtl@rawmappings{\the\@dtl@toks,\@dtl@tmp}
+% \end{macrocode}
+%\changes{2.13}{2013-01-15}{removed spurious space}
+% \begin{macrocode}
+ \def\@dtl@tmp{{#1}{#2}}%
+ \protected@edef\@dtl@rawmappings{\the\@dtl@toks,\@dtl@tmp}%
}%
}
% \end{macrocode}
@@ -11740,6 +12824,5729 @@ datatool.dtx
%\fi
%\iffalse
% \begin{macrocode}
+%<*datagidx.sty>
+% \end{macrocode}
+%\fi
+%\chapter{datagidx.sty}
+%\changes{2.13}{2013-01-15}{added datagidx package}
+% This package provides a means to produces indices and glossaries
+% without the need for an external indexing application, such as
+% \app{makeindex} or \app{xindy}. However, the code here has
+% been developed to implement the word order style described by the
+% Oxford Style Manual. If you are not writing in English, this may
+% not be applicable to your needs. You may be able to define your
+% own comparison handler to use with \cs{dtlsort}. If not, you'll
+% need to use \app{xindy} with a package such as
+% \sty{glossaries}.
+%
+% Declare package:
+% \begin{macrocode}
+\NeedsTeXFormat{LaTeX2e}
+\ProvidesPackage{datagidx}[2013/01/15 v2.13 (NLCT)]
+% \end{macrocode}
+% Required packages:
+% \begin{macrocode}
+\RequirePackage{datatool}
+\RequirePackage{etoolbox}
+\RequirePackage{xkeyval}
+\RequirePackage{mfirstuc}
+\RequirePackage{xfor}
+\RequirePackage{multicol}
+\RequirePackage{textcase}
+% \end{macrocode}
+%
+%\section{Default Settings}
+% These commands need to be defined before the package options are
+% used.
+%\begin{macro}{\datagidx@columns}
+% The number of columns to use for the index/glossary.
+% \begin{macrocode}
+\newcommand*{\datagidx@columns}{2}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\DTLgidxSetColumns}
+% \begin{macrocode}
+\newcommand*{\DTLgidxSetColumns}[1]{%
+ \DTLifint{#1}%
+ {%
+ \def\datagidx@columns{#1}%
+ }%
+ {%
+ \PackageError{datagidx}%
+ {Number of columns must be an integer}%
+ {%
+ You have requested `#1' columns, which can't be parsed as a
+ number%
+ }%
+ }%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{counter}{DTLgidxChildCount}
+% Child counter.
+% \begin{macrocode}
+\newcounter{DTLgidxChildCount}
+% \end{macrocode}
+%\end{counter}
+%\begin{macro}{\theHDTLgidxChildCount}
+% Reduce duplicate identifier warnings if \sty{hyperref} in use.
+% \begin{macrocode}
+\def\theHDTLgidxChildCount{\Label.\arabic{DTLgidxChildCount}}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\DTLgidxChildCountLabel}
+% Label for child counter.
+% \begin{macrocode}
+\newcommand*{\DTLgidxChildCountLabel}{\theDTLgidxChildCount) }
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\DTLgidxChildStyle}
+% Should the child name be displayed? (Default: show name.)
+% If the name shouldn't be displayed, replace with a number.
+% \begin{macrocode}
+\newcommand*{\DTLgidxChildStyle}[1]{#1}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\datagidx@setchildstyle}
+% \begin{macrocode}
+\newcommand*{\datagidx@setchildstyle}[1]{%
+ \ifcase#1\relax
+ \renewcommand*{\DTLgidxChildStyle}[1]{##1}%
+ \or
+ \renewcommand*{\DTLgidxChildStyle}[1]{%
+ \DTLgidxChildCountLabel
+ }%
+ \fi
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\datagidx@foreachchild}
+% Iterate through each child label
+% \begin{macrocode}
+\newcommand{\datagidx@foreachchild}{%
+ \datagidx@sort@foreachchild
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\datagidx@setchildsort}
+% \begin{macrocode}
+\newcommand*{\datagidx@setchildsort}[1]{%
+ \ifcase#1\relax
+ \renewcommand*{\datagidx@foreachchild}{%
+ \datagidx@sort@foreachchild
+ }%
+ \or
+ \renewcommand*{\datagidx@foreachchild}{%
+ \datagidx@unsort@foreachchild
+ }%
+ \fi
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\DTLgidxPostName}
+% What to put after the name. (Defaults to space.)
+% \begin{macrocode}
+\newcommand*{\DTLgidxPostName}{ }
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\DTLgidxPostChildName}
+% What to put after the child name.
+% \begin{macrocode}
+\newcommand*{\DTLgidxPostChildName}{\DTLgidxPostName}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\DTLgidxNameCase}
+% Should the name have a case change in the index/glossary?
+% (Default: no change.)
+% \begin{macrocode}
+\newcommand*{\DTLgidxNameCase}[1]{#1}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\datagidx@setnamecase}
+% \begin{macrocode}
+\newcommand*{\datagidx@setnamecase}[1]{%
+ \ifcase#1\relax
+ \renewcommand*{\DTLgidxNameCase}[1]{##1}%
+ \or
+ \let\DTLgidxNameCase\MakeTextUppercase
+ \or
+ \let\DTLgidxNameCase\MakeTextLowercase
+ \or
+ \let\DTLgidxNameCase\xmakefirstuc
+ \or
+ \let\DTLgidxNameCase\xcapitalisewords
+ \fi
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\DTLgidxNameFont}
+% The font to use for the name in the index/glossary.
+% (Default: normal font.)
+% \begin{macrocode}
+\newcommand*{\DTLgidxNameFont}[1]{\textnormal{#1}}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\DTLgidxPostDescription}
+% What to put after the description. (Defaults to nothing.)
+% \begin{macrocode}
+\newcommand*{\DTLgidxPostDescription}{}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\datagidx@setpostdesc}
+% \begin{macrocode}
+\newcommand*{\datagidx@setpostdesc}[1]{%
+ \ifcase#1\relax
+ \renewcommand*{\DTLgidxPostDescription}{}%
+ \or
+ \renewcommand*{\DTLgidxPostDescription}{.}%
+ \fi
+ }
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\DTLgidxPreLocation}
+% What to put before the location list. (Defaults to en-space.)
+% \begin{macrocode}
+\newcommand*{\DTLgidxPreLocation}{\enspace}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\datagidx@setprelocation}
+% \begin{macrocode}
+\newcommand*{\datagidx@setprelocation}[1]{%
+ \ifcase#1\relax
+ \renewcommand*{\DTLgidxPreLocation}{}%
+ \or
+ \renewcommand*{\DTLgidxPreLocation}{\enspace}%
+ \or
+ \renewcommand*{\DTLgidxPreLocation}{ }%
+ \or
+ \renewcommand*{\DTLgidxPreLocation}{\dotfill}%
+ \or
+ \renewcommand*{\DTLgidxPreLocation}{\hfill}%
+ \fi
+ }
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\DTLgidxLocation}
+% How to display the location. (Defaults to show the location list.)
+% \begin{macrocode}
+\newcommand*{\DTLgidxLocation}{\dtldolocationlist}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\datagidx@setlocation}
+% Should the location list be displayed?
+% \begin{macrocode}
+\newcommand*{\datagidx@setlocation}[1]{%
+ \ifcase#1\relax
+ \renewcommand*{\DTLgidxLocation}{}%
+ \or
+ \renewcommand*{\DTLgidxLocation}{\dtldolocationlist}%
+ \or
+ \renewcommand*{\DTLgidxLocation}{\dtldofirstlocation}%
+ \fi
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\DTLgidxSee}
+% How to display the cross-reference list.
+% \begin{macrocode}
+\newcommand*{\DTLgidxSee}{%
+ \DTLifnull{\See}%
+ {}%
+ {%
+ \DTLgidxPreLocation
+ \DTLgidxFormatSee{\seename}{\See}%
+ }%
+}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\DTLgidxSeeAlso}
+% How to display the ``see also'' list.
+% \begin{macrocode}
+\newcommand*{\DTLgidxSeeAlso}{%
+ \DTLifnull{\SeeAlso}%
+ {}%
+ {%
+ \DTLgidxFormatSeeAlso{\seealsoname}{\SeeAlso}%
+ }%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\DTLgidxChildrenSeeAlso}
+% Display the children and the see also attributes.
+% \begin{macrocode}
+\newcommand*{\DTLgidxChildrenSeeAlso}{%
+ \DTLgidxChildren
+ \DTLgidxSeeAlso
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\datagidx@setsee}
+% How should cross-references appear?
+% \begin{macrocode}
+\newcommand*{\datagidx@setsee}[1]{%
+ \ifcase#1\relax
+ \renewcommand*{\DTLgidxSee}{%
+ \DTLifnull{\See}{}%
+ {%
+ , \DTLgidxFormatSee{\seename}{\See}%
+ }%
+ }%
+ \or
+ \renewcommand*{\DTLgidxSee}{%
+ \DTLifnull{\See}{}
+ {%
+ \space(\DTLgidxFormatSee{\seename}{\See})%
+ }%
+ }%
+ \or
+ \renewcommand*{\DTLgidxSee}{%
+ \DTLifnull{\See}{}%
+ {%
+ . \DTLgidxFormatSee{\xmakefirstuc{\seename}}{\See}%
+ }%
+ }%
+ \or
+ \renewcommand*{\DTLgidxSee}{%
+ \DTLifnull{\See}{}
+ {%
+ \space\DTLgidxFormatSee{\seename}{\See}%
+ }%
+ }%
+ \or
+ \renewcommand*{\DTLgidxSee}{%
+ \DTLifnull{\See}{}
+ {%
+ \DTLgidxFormatSee{\seename}{\See}%
+ }%
+ }%
+ \or
+ \renewcommand*{\DTLgidxSee}{%
+ \DTLifnull{\See}{}
+ {%
+ ; \DTLgidxFormatSee{\seename}{\See}%
+ }%
+ }%
+ \or
+ \renewcommand*{\DTLgidxSee}{%
+ \DTLifnull{\See}{}
+ {%
+ \DTLgidxPreLocation\DTLgidxFormatSee{\seename}{\See}%
+ }%
+ }%
+ \fi
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\DTLgidxSymDescSep}
+% Separator character between symbol and description if both are
+% present.
+% \begin{macrocode}
+\newcommand*{\DTLgidxSymDescSep}{\space}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\datagidxsymbolwidth}
+% Space to allocate for the symbol. If zero or negative, symbol just
+% occupies its natural space.
+% \begin{macrocode}
+\newlength\datagidxsymbolwidth
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\datagidxlocationwidth}
+% Space to allocate for the location list. If zero or negative, the
+% list just occupies its natural space.
+% \begin{macrocode}
+\newlength\datagidxlocationwidth
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\DTLgidxFormatDesc}
+% How to format the description.
+% \begin{macrocode}
+\newcommand{\DTLgidxFormatDesc}[1]{#1}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\DTLgidxSymbolDescription}
+% How to format the symbol and description fields.
+% \begin{macrocode}
+\newcommand*{\DTLgidxSymbolDescription}{%
+ \DTLgidxSymbolDescLeft
+ \DTLgidxSymbolDescRight
+}
+\newcommand*{\DTLgidxSymbolDescLeft}{%
+ \ifdefempty{\Symbol}{}{(\Symbol)\DTLgidxSymDescSep}%
+}
+\newcommand*{\DTLgidxSymbolDescRight}{%
+ \ifdefempty{\Description}{}%
+ {%
+ \DTLgidxFormatDesc{\Description}\DTLgidxPostDescription
+ }%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\if@datagidxsymbolleft}
+% Identifies whether the symbol has been set to left or right.
+% \begin{macrocode}
+\newif\if@datagidxsymbolleft
+\@datagidxsymbollefttrue
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\datagidx@formatsymdesc}
+% \begin{macrocode}
+\newcommand*{\datagidx@formatsymdesc}[1]{%
+ \ifcase#1\relax
+% \end{macrocode}
+% Only symbol
+% \begin{macrocode}
+ \renewcommand*{\DTLgidxSymbolDescLeft}{%
+ \ifdefempty{\Symbol}{}{\Symbol}%
+ }%
+ \renewcommand*{\DTLgidxSymbolDescRight}{}%
+ \@datagidxsymbollefttrue
+ \or
+% \end{macrocode}
+% Only description
+% \begin{macrocode}
+ \renewcommand*{\DTLgidxSymbolDescLeft}{%
+ \ifdefempty{\Description}{}%
+ {%
+ \DTLgidxFormatDesc{\Description}\DTLgidxPostDescription
+ }%
+ }%
+ \renewcommand*{\DTLgidxSymbolDescRight}{}%
+ \@datagidxsymbolleftfalse
+ \or
+% \end{macrocode}
+% (symbol) description
+% \begin{macrocode}
+ \renewcommand*{\DTLgidxSymbolDescLeft}{%
+ \ifdefempty{\Symbol}{}{(\Symbol)\DTLgidxSymDescSep}%
+ }%
+ \renewcommand*{\DTLgidxSymbolDescRight}{%
+ \ifdefempty{\Description}{}%
+ {%
+ \DTLgidxFormatDesc{\Description}\DTLgidxPostDescription
+ }%
+ }%
+ \@datagidxsymbollefttrue
+ \or
+% \end{macrocode}
+% description (symbol)
+% \begin{macrocode}
+ \renewcommand*{\DTLgidxSymbolDescLeft}{%
+ \ifdefempty{\Description}{}%
+ {%
+ \DTLgidxFormatDesc{\Description}%
+ \DTLgidxPostDescription\DTLgidxSymDescSep
+ }%
+ }%
+ \renewcommand*{\DTLgidxSymbolDescRight}{%
+ \ifdefempty{\Symbol}{}{(\Symbol)}%
+ }%
+ \@datagidxsymbolleftfalse
+ \or
+% \end{macrocode}
+% symbol description
+% \begin{macrocode}
+ \renewcommand*{\DTLgidxSymbolDescLeft}{%
+ \ifdefempty{\Symbol}{}{\Symbol\DTLgidxSymDescSep}%
+ }%
+ \renewcommand*{\DTLgidxSymbolDescRight}{%
+ \ifdefempty{\Description}{}%
+ {%
+ \DTLgidxFormatDesc{\Description}%
+ \DTLgidxPostDescription
+ }%
+ }%
+ \@datagidxsymbollefttrue
+ \or
+% \end{macrocode}
+% description symbol
+% \begin{macrocode}
+ \renewcommand*{\DTLgidxSymbolDescLeft}{%
+ \ifdefempty{\Description}{}%
+ {%
+ \DTLgidxFormatDesc{\Description}%
+ \DTLgidxPostDescription\DTLgidxSymDescSep
+ }%
+ }%
+ \renewcommand*{\DTLgidxSymbolDescRight}{%
+ \ifdefempty{\Symbol}{}{\Symbol}%
+ }%
+ \@datagidxsymbolleftfalse
+ \fi
+ }
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\DTLgidxSetCompositor}
+%\begin{definition}
+%\cs{DTLgidxSetCompositor}\marg{symbol}
+%\end{definition}
+%Set the location compositor.
+% \begin{macrocode}
+\newcommand*{\DTLgidxSetCompositor}[1]{%
+ \undef\datagidx@docomplist
+ \DeclareListParser{\datagidx@docomplist}{#1}%
+ \def\datagidx@compositor{#1}%
+}
+% \end{macrocode}
+%\end{macro}
+%Set the default compositor to \texttt{.} (full stop).
+% \begin{macrocode}
+\DTLgidxSetCompositor{.}
+% \end{macrocode}
+%
+% Sorting can take a long time (especially with large databases) but
+% two \LaTeX\ runs are usually required to get the index or glossary
+% up-to-date, so we usually don't need to worry about sorting on the
+% first run (unless the order in some way affects the document,
+% e.g.\ the group headings are to appear in the table of contents).
+% It may also be that some modifications are done to the document
+% that don't require a re-sort. The optimize setting tries to
+% minimize the amount of sorting done to help speed up document
+% compilation.
+%
+% There are to optimization levels: low and high. The low level
+% optimization just sorts every other \LaTeX\ run. This is done by
+% writing to the aux file to determine whether or not the sort
+% should be done next run. This is a cheap and easy hack that won't
+% work if sorting makes the document out-of-date (for example, if
+% the sorted index or glossary affects the table of contents by,
+% say, making the group headings a sectional unit).
+%
+% The high level optimization is more complicated and involves
+% writing the sorted database to an external file and reading it in
+% on the next run. This requires checks to see if the location lists
+% have changed, in which case a new sort may be required.
+%
+%\begin{important}
+% The optimization function is only implemented when the sorting is
+% specified via the sort key. Any explicit sorting done by the user
+% via commands such as \ics{dltsort} are not effected by the
+% optimization setting.
+%\end{important}
+%
+%\begin{macro}{\datagidx@do@sort}
+% Indicate what to do when it's time to sort the index/glossary.
+% This defaults to un-optimised setting to avoid confusing users who
+% don't like to read the manual.
+% \begin{macrocode}
+\newcommand*{\datagidx@do@sort}{\datagidx@sort}
+% \end{macrocode}
+%\end{macro}
+%
+% First deal with the low-level optimization as it's easier to
+% implement.
+%
+%\begin{macro}{\datagidx@optimize@sort}
+% The code to perform when the low optimize setting is on.
+% If the command \ics{datagidx@do@optimize@sort} has been defined,
+% do the sort. If it hasn't been defined, don't sort. If a sort
+% isn't performed, the command definition is written to the aux
+% file. If a sort is performed, the command definition isn't written
+% to the aux file. This will do the sort every other run.
+% \begin{macrocode}
+\newcommand*{\datagidx@optimize@sort}{%
+% \end{macrocode}
+% First, has \cs{datagidx@do@optimize@sort} been defined?
+% \begin{macrocode}
+ \ifdef\datagidx@do@optimize@sort
+ {%
+% \end{macrocode}
+% It has been defined so go ahead and do the sort.
+% \begin{macrocode}
+ \datagidx@sort
+ }%
+ {%
+% \end{macrocode}
+% It hasn't been defined so don't sort. Write the command definition
+% into the aux file for the next run.
+% \begin{macrocode}
+ \protected@write\@auxout{}{%
+ \string\gdef\string\datagidx@do@optimize@sort{}%
+ }%
+% \end{macrocode}
+% Let the user know they need to recompile the document.
+% \begin{macrocode}
+ \global\let\@datagidx@dorerun@warn@sort\@data@rerun@warn@sort
+ }%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\@datagidx@dorerun@warn}
+% \begin{macrocode}
+\newcommand*\@datagidx@dorerun@warn{}
+\AtEndDocument{\@datagidx@dorerun@warn}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\@datagidx@dorerun@warn@sort}
+% \begin{macrocode}
+\newcommand*\@datagidx@dorerun@warn@sort{}
+\AtEndDocument{\@datagidx@dorerun@warn@sort}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\@datagidx@rerun@warn@sort}
+% Warning issued when a rerun is required to sort the index or
+% glossary.
+% \begin{macrocode}
+\newcommand*\@data@rerun@warn@sort{%
+ \PackageWarningNoLine{datagidx}{Rerun required to sort the
+ index/glossary databases}%
+}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\@datagidx@rerun@warn}
+% Warning issued when a rerun is required to update the location
+% lists.
+% \begin{macrocode}
+\newcommand*\@data@rerun@warn{%
+ \PackageWarningNoLine{datagidx}{Rerun required to ensure the
+ index/glossary location lists are up-to-date}%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%
+%The high optimize setting is more complicated.
+% This involves writing each database to an external file (named
+% \cs{jobname}-\meta{db label}.gidx). The sort is only performed if
+% new terms are added or used.
+%
+%\begin{macro}{\datagidx@do@highopt@optimize}
+% \begin{macrocode}
+\newcommand*{\datagidx@do@highopt@optimize}{%
+ \renewcommand*{\datagidx@do@sort}{%
+% \end{macrocode}
+% Only sort if database has changed.
+% \begin{macrocode}
+ \ifcsdef{datagidx@do@highopt@sort@\DTLgidxCurrentdb}%
+ {%
+ \csuse{datagidx@do@highopt@sort@\DTLgidxCurrentdb}%
+ }%
+ {%
+% \end{macrocode}
+% Do nothing
+% \begin{macrocode}
+ }%
+% \end{macrocode}
+% Save the database to file.
+% \begin{macrocode}
+ \bgroup
+% \end{macrocode}
+% Hook into write macro to clear certain fields and protect commands
+% like \ics{DTLgidxName}.
+% \begin{macrocode}
+ \def\dtl@saverawdbhook{%
+ \let\db@col@id@w\@datagidx@db@col@id@w
+ \def\DTLgidxName{\string\DTLgidxName\space}%
+ \def\DTLgidxMac{\string\DTLgidxMac\space}%
+ \def\DTLgidxRank{\string\DTLgidxRank\space}%
+ \def\DTLgidxParen{\string\DTLgidxParen\space}%
+ \def\DTLgidxParticle{\string\DTLgidxParticle\space}%
+ \def\DTLgidxOffice{\string\DTLgidxOffice\space}%
+ \def\DTLgidxSaint{\string\DTLgidxSaint\space}%
+ \def\DTLgidxPlace{\string\DTLgidxPlace\space}%
+ \def\DTLgidxIgnore{\string\DTLgidxIgnore\space}%
+ \def\DTLgidxNameNum{\string\DTLgidxNameNum\space}%
+ \def\DTLgidxSubject{\string\DTLgidxSubject\space}%
+ }%
+ \DTLsaverawdb{\DTLgidxCurrentdb}{\datagidxhighoptfilename\DTLgidxCurrentdb}%
+ \egroup
+ }%
+% \end{macrocode}
+% Change the behaviour of \cs{newgidx}
+% \begin{macrocode}
+ \def\newgidx{\datagidx@highopt@newgidx}%
+% \end{macrocode}
+% Change the behaviour of \cs{newterm}
+% \begin{macrocode}
+ \def\newterm{\datagidx@highopt@newterm}%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\@datagidx@db@col@id@w}
+% A bit of trickery is need to clear the Used and Location fields when
+% writing the raw database to file.
+% \begin{macrocode}
+\def\@datagidx@db@col@id@w#1\db@col@id@end@\db@col@elt@w#2\db@col@elt@end@\db@col@id@w#3\db@col@id@end@{%
+ \expandafter\@gobble\string\%^^J
+ \string\db@col@id@w\space #1%
+ \expandafter\@gobble\string\%^^J
+ \string\db@col@id@end@\space
+ \expandafter\@gobble\string\%^^J
+ \string\db@col@elt@w\space
+ \expandafter\ifnum\csname dtl@ci@\DTLgidxCurrentdb @Used\endcsname=#1\space
+ 0%
+ \else
+ \expandafter\ifnum\csname dtl@ci@\DTLgidxCurrentdb @Location\endcsname=#1\space
+ \else
+ \expandafter\ifnum\csname dtl@ci@\DTLgidxCurrentdb @CurrentLocation\endcsname=#1\space
+ \else
+% \end{macrocode}
+% We also want to prevent the first character of the sort field from
+% being expanded to help get the group correct (in case the user
+% wants to sort on, say, the tilde character).
+% \begin{macrocode}
+ \expandafter\ifnum\csname dtl@ci@\DTLgidxCurrentdb @Sort\endcsname=#1\space
+ \protect#2%
+ \else
+ #2%
+ \fi
+ \fi
+ \fi
+ \fi
+ \expandafter\@gobble\string\%^^J
+ \string\db@col@elt@end@\space
+ \expandafter\@gobble\string\%^^J
+ \string\db@col@id@w\space #3%
+ \expandafter\@gobble\string\%^^J
+ \string\db@col@id@end@\space
+}
+% \end{macrocode}
+%\end{macro}
+%
+% With the `highopt optimize' setting, whenever a location is written to the aux
+% file, if no location has been defined the database needs sorting.
+%
+%\begin{macro}{\datagidx@do@highopt@update}
+% Default does nothing. (Argument is the entry's label.)
+% \begin{macrocode}
+\newcommand*{\datagidx@do@highopt@update}[1]{}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\datagidxhighoptfilename}
+% Expands to the name of the filename associated with the database
+% identified by the argument for the `highopt' setting.
+% \begin{macrocode}
+\newcommand*{\datagidxhighoptfilename}[1]{\jobname-#1.gidx}
+% \end{macrocode}
+%\end{macro}
+%
+%\section{Package Options}
+%
+%\begin{option}{optimize}
+% A boolean option indicating whether or not to optimize the sort.
+% This is only available as a global option. If you want to optimize
+% some glossaries but not others, switch on the optimize function
+% and clear the sort key for the relevant glossaries and manually
+% sort using \ics{dtlsort} before the glossary is displayed.
+% \begin{macrocode}
+\define@choicekey{datagidx.sty}{optimize}[\val\nr]%
+ {off,low,high}[high]%
+ {%
+ \ifcase\nr\relax
+ \renewcommand*{\datagidx@do@sort}{\datagidx@sort}
+ \or
+ \renewcommand*{\datagidx@do@sort}{\datagidx@optimize@sort}
+ \or
+ \datagidx@do@highopt@optimize
+ \fi
+ }
+% \end{macrocode}
+%\end{option}
+%
+% These options govern the general layout of the glossary/index.
+%\begin{option}{columns}
+% The number of columns used by \env{multicols} (or
+% \env{multicols*}). If only one column is specified,
+% \env{multicols} (or \env{multicols*}) isn't used.
+% \begin{macrocode}
+\define@key{datagidx.sty}{columns}%
+{%
+ \DTLgidxSetColumns{#1}%
+}
+% \end{macrocode}
+%\end{option}
+%\begin{option}{child}
+% Indicates whether or not to show the name in child entries.
+% \begin{macrocode}
+\define@choicekey{datagidx.sty}{child}[\val\nr]%
+ {named,noname}%
+ {%
+ \datagidx@setchildstyle\nr
+ }
+% \end{macrocode}
+%\end{option}
+%\begin{option}{namecase}
+% Options for name case.
+% \begin{macrocode}
+\define@choicekey{datagidx.sty}{namecase}[\val\nr]%
+ {nochange,uc,lc,firstuc,capitalise}%
+ {%
+ \datagidx@setnamecase\nr
+ }
+% \end{macrocode}
+%\end{option}
+%
+%\begin{option}{namefont}
+% Option to set the name font.
+% \begin{macrocode}
+\define@key{datagidx.sty}{namefont}%
+{%
+ \renewcommand*{\DTLgidxNameFont}[1]{{#1{##1}}}%
+}
+% \end{macrocode}
+%\end{option}
+%
+%\begin{option}{postname}
+% What to put after the name.
+% \begin{macrocode}
+\define@key{datagidx.sty}{postname}
+{%
+ \renewcommand*{\DTLgidxPostName}{#1}%
+}
+% \end{macrocode}
+%\end{option}
+%
+%\begin{option}{postdesc}
+% what to put after the description.
+% \begin{macrocode}
+\define@choicekey{datagidx.sty}{postdesc}[\val\nr]%
+ {none,dot}%
+ {%
+ \datagidx@setpostdesc\nr
+ }
+% \end{macrocode}
+%\end{option}
+%
+%\begin{option}{prelocation}
+% What to put before the location list.
+% \begin{macrocode}
+\define@choicekey{datagidx.sty}{prelocation}[\val\nr]%
+ {none,enspace,space,dotfill,hfill}%
+ {%
+ \datagidx@setprelocation\nr
+ }
+% \end{macrocode}
+%\end{option}
+%
+%\begin{option}{location}
+% How to display the location list.
+% \begin{macrocode}
+\define@choicekey{datagidx.sty}{location}[\val\nr]%
+ {hide,list,first}%
+ {\datagidx@setlocation\nr}
+% \end{macrocode}
+%\end{option}
+%
+%\begin{option}{see}
+% How to display the cross-reference list.
+% \begin{macrocode}
+\define@choicekey{datagidx.sty}{see}[\val\nr]%
+ {comma,brackets,dot,space,nosep,semicolon,location}%
+ {\datagidx@setsee\nr}
+% \end{macrocode}
+%\end{option}
+%
+%\begin{option}{symbol}
+% How to format the symbol in relation to the description.
+% \begin{macrocode}
+\define@choicekey{datagidx.sty}{symboldesc}[\val\nr]%
+ {symbol,desc,(symbol) desc,desc (symbol),symbol desc,desc symbol}%
+ {\datagidx@formatsymdesc\nr}
+% \end{macrocode}
+%\end{option}
+%
+%\begin{option}{compositor}
+% Location compositor.
+% \begin{macrocode}
+\define@key{datagidx.sty}{compositor}%
+{%
+ \DTLgidxSetCompositor{#1}%
+}%
+% \end{macrocode}
+%\end{option}
+%
+%\begin{option}{final}
+% \begin{macrocode}
+\DeclareOptionX{final}{%
+ \let\datagidxshowifdraft\@gobble
+}
+% \end{macrocode}
+% Set as default:
+% \begin{macrocode}
+\let\datagidxshowifdraft\@gobble
+% \end{macrocode}
+%\end{option}
+%
+%\begin{option}{draft}
+% \begin{macrocode}
+\DeclareOptionX{draft}{%
+ \let\datagidxshowifdraft\@firstofone
+}
+% \end{macrocode}
+%\end{option}
+%
+%\begin{option}{verbose}
+% \begin{macrocode}
+\define@choicekey{datagidx.sty}{verbose}[\val\nr]%
+ {true,false}[true]%
+ {%
+ \csuse{dtlverbose\val}%
+ }
+% \end{macrocode}
+%\end{option}
+%
+% Process package options:
+% \begin{macrocode}
+\ProcessOptionsX
+% \end{macrocode}
+%
+% Database to keep track of all the defined terms.
+% \begin{macrocode}
+\DTLnewdb{datagidx}
+% \end{macrocode}
+%
+%\section{Glossary/Index Formatting}
+%\begin{macro}{\seename}
+% \begin{macrocode}
+\providecommand*{\seename}{see}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\seealsoname}
+% \begin{macrocode}
+\providecommand*{\seealsoname}{see also}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\DTLgidxSeeTagFont}
+% \begin{macrocode}
+\newcommand*{\DTLgidxSeeTagFont}[1]{\emph{#1}}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\DTLgidxFormatSee}
+%\begin{definition}
+%\cs{DTLgidxFormatSee}\marg{tag}\marg{label list}
+%\end{definition}
+% \begin{macrocode}
+\newcommand*{\DTLgidxFormatSee}[2]{%
+ \DTLgidxSeeTagFont{#1} \DTLgidxSeeList{#2}%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\DTLgidxFormatSeeAlso}
+%\begin{definition}
+%\cs{DTLgidxFormatSeeAlso}\marg{tag}\marg{label list}
+%\end{definition}
+% \begin{macrocode}
+\newcommand*{\DTLgidxFormatSeeAlso}[2]{%
+ \datagidxdoseealso
+ {%
+ \DTLgidxSeeTagFont{#1} \DTLgidxSeeList{#2}%
+ }%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\datagidxdoseealso}
+% \begin{macrocode}
+\newcommand*{\datagidxdoseealso}[1]{%
+ \datagidxseealsostart
+ #1%
+ \datagidxseealsoend
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\DTLgidxSeeList}
+%\begin{definition}
+%\cs{DTLgidxSeeList}\marg{label list}
+%\end{definition}
+% \begin{macrocode}
+\newcommand*{\DTLgidxSeeList}[1]{%
+ \def\datagidx@sep{}%
+ \@for\dtl@thislabel:=#1\do
+ {%
+ \ifx\@xfor@nextelement\@nnil
+% \end{macrocode}
+% Last iteration.
+% \begin{macrocode}
+ \ifdefempty{\datagidx@sep}%
+ {%
+% \end{macrocode}
+% Only one element in the list.
+% \begin{macrocode}
+ }%
+ {%
+% \end{macrocode}
+% Not the only element in the list.
+% \begin{macrocode}
+ \DTLidxSeeLastSep
+ }%
+ \else
+% \end{macrocode}
+% Not last iteration
+% \begin{macrocode}
+ \datagidx@sep
+ \let\datagidx@sep\DTLidxSeeSep
+ \fi
+ \DTLidxFormatSeeItem{\dtl@thislabel}%
+ }%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\DTLidxFormatSeeItem}
+%\begin{definition}
+%\cs{DTLidxFormatSeeItem}\marg{label}
+%\end{definition}
+% \begin{macrocode}
+\newcommand*{\DTLidxFormatSeeItem}[1]{%
+ \DTLgidxFetchEntry{\datagidx@value}{#1}{Name}%
+ \datagidxlink{#1}%
+ {%
+ \datagidx@value
+ }%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\DTLidxSeeSep}
+% Separator in cross-reference list.
+% \begin{macrocode}
+\newcommand*{\DTLidxSeeSep}{, }
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\DTLidxSeeLastSep}
+% Final separator in cross-reference list.
+% \begin{macrocode}
+\newcommand*{\DTLidxSeeLastSep}{ \& }
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\DTLgidxDoSeeOrLocation}
+% You should have both a ``see'' list and a location list. This
+% checks if \cs{See} is null. If it isn't null, it does the ``see''
+% part, otherwise it deals with the location list.
+% \begin{macrocode}
+\newcommand*{\DTLgidxDoSeeOrLocation}{%
+ \DTLifnull\See
+ {%
+% \end{macrocode}
+% \cs{See} is null. Do we have a location?
+% \begin{macrocode}
+ \ifdefempty\Location
+ {%
+ }%
+ {%
+ \DTLgidxPreLocation
+ \DTLgidxLocation
+ }%
+ }%
+ {%
+% \end{macrocode}
+% \cs{See} is not null, so do the cross-reference.
+% \begin{macrocode}
+ \DTLgidxSee
+ }%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\datagidx@sortchildren}
+% The list of child labels needs to be sorted so that the child list
+% follows the same ordering as the database.
+% \begin{macrocode}
+\newcommand*{\datagidx@sortchildren}{%
+ \def\datagidx@sortedlist{}%
+ \@for\Label:=\Children\do
+ {%
+ \edef\do@getrow{%
+ \noexpand\dtlgetrowforvalue
+ {\DTLgidxCurrentdb}%
+ {\dtlcolumnindex{\DTLgidxCurrentdb}{Label}}%
+ {\Label}%
+ }%
+ \do@getrow
+% \end{macrocode}
+% Row index is stored in \cs{dtlrownum}. Is the sorted list empty?
+% \begin{macrocode}
+ \ifdefempty\datagidx@sortedlist
+ {%
+% \end{macrocode}
+% Yes, it's empty.
+% \begin{macrocode}
+ \edef\datagidx@newsortedlist{{\number\dtlrownum}{\Label}}%
+ }%
+ {%
+% \end{macrocode}
+% No, it's not empty. Need to insert into list.
+% \begin{macrocode}
+ \def\datagidx@newsortedlist{}%
+ \@for\@datagidx@thisval:=\datagidx@sortedlist\do
+ {%
+% \end{macrocode}
+% Get the index:
+% \begin{macrocode}
+ \edef\datagidx@thisidx{\expandafter\@firstoftwo\@datagidx@thisval}%
+% \end{macrocode}
+% Is index greater than \cs{dtlrownum}?
+% \begin{macrocode}
+ \ifnum\datagidx@thisidx>\dtlrownum\relax
+% \end{macrocode}
+% Yes, it is. So insert here.
+% \begin{macrocode}
+ \ifdefempty\datagidx@newsortedlist
+ {%
+ \eappto\datagidx@newsortedlist
+ {%
+ {\number\dtlrownum}{\Label},\@datagidx@thisval
+ }%
+ }%
+ {%
+ \eappto\datagidx@newsortedlist
+ {%
+ ,{\number\dtlrownum}{\Label},\@datagidx@thisval
+ }%
+ }%
+% \end{macrocode}
+% Break out of inner loop.
+% \begin{macrocode}
+ \@endfortrue
+ \else
+ \ifdefempty\datagidx@newsortedlist
+ {%
+ \edef\datagidx@newsortedlist{%
+ \@datagidx@thisval
+ }%
+ }%
+ {%
+ \eappto\datagidx@newsortedlist
+ {%
+ ,\@datagidx@thisval
+ }%
+ }%
+ \fi
+ }%
+% \end{macrocode}
+% Was the loop ended prematurely?
+% \begin{macrocode}
+ \if@endfor
+% \end{macrocode}
+% If loop was ended on the last iteration, \cs{@forremainder} will
+% be empty and there's nothing left to do.
+% \begin{macrocode}
+ \ifdefempty\@forremainder
+ {%
+ }%
+ {%
+% \end{macrocode}
+% Loop prematurely ended, so append remainder to list.
+ \eappto\datagidx@newsortedlist{,\@forremainder}%
+% \begin{macrocode}
+ }%
+ \else
+% \end{macrocode}
+% Loop wasn't prematurely terminated, so new value hasn't been
+% added. Add now.
+% \begin{macrocode}
+ \ifdefempty\datagidx@newsortedlist
+ {%
+ \edef\datagidx@newsortedlist{{\number\dtlrownum}{\Label}}%
+ }%
+ {%
+ \eappto\datagidx@newsortedlist{,{\number\dtlrownum}{\Label}}%
+ }%
+ \fi
+ }%
+% \end{macrocode}
+% Update.
+% \begin{macrocode}
+ \let\datagidx@sortedlist\datagidx@newsortedlist
+% \end{macrocode}
+% Don't break out of outer loop.
+% \begin{macrocode}
+ \@endforfalse
+ }%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\datagidx@sort@foreachchild}
+% Sorted iteration through all the child labels.
+% \begin{macrocode}
+\newcommand{\datagidx@sort@foreachchild}[1]{%
+ \datagidx@sortchildren
+% \end{macrocode}
+% Sorted list stored in \cs{datagidx@sortedlist}
+% \begin{macrocode}
+ \@for\@datagidx@thisval:=\datagidx@sortedlist\do
+ {%
+ \edef\Label{\expandafter\@secondoftwo\@datagidx@thisval}%
+ #1%
+ }%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\datagidx@unsort@foreachchild}
+% Unsorted iteration through all the child labels.
+% \begin{macrocode}
+\newcommand{\datagidx@unsort@foreachchild}[1]{%
+ \@for\Label:=\Children\do
+ {%
+ #1%
+ }%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%
+%\begin{macro}{\DTLgidxChildren}
+% How to display the children
+% \begin{macrocode}
+\newcommand*{\DTLgidxChildren}{%
+ \bgroup
+ \DTLifnull\Children
+ {}%
+ {%
+ \advance\datagidx@level by 1\relax
+ \datagidxchildstart
+ \let\Parent\Label
+ \datagidx@foreachchild
+ {%
+ \edef\do@getrow{%
+ \noexpand\dtlgetrowforvalue
+ {\DTLgidxCurrentdb}%
+ {\dtlcolumnindex{\DTLgidxCurrentdb}{Label}}%
+ {\Label}%
+ }%
+ \do@getrow
+ \dtlgetentryfromcurrentrow
+ {\Location}%
+ {\dtlcolumnindex{\DTLgidxCurrentdb}{Location}}%
+ \dtlgetentryfromcurrentrow
+ {\See}%
+ {\dtlcolumnindex{\DTLgidxCurrentdb}{See}}%
+ \dtlgetentryfromcurrentrow
+ {\SeeAlso}%
+ {\dtlcolumnindex{\DTLgidxCurrentdb}{SeeAlso}}%
+ \DTLifnull\Location
+ {%
+ \DTLifnull\See
+ {%
+ \DTLifnull\SeeAlso
+ {}%
+ {%
+ \datagidx@displaychild
+ }%
+ }%
+ {%
+ \datagidx@displaychild
+ }%
+ }%
+ {%
+ \datagidx@displaychild
+ }%
+ }%
+ \datagidxchildend
+ }%
+ \egroup
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\datagidxgetchildfields}
+% Get the child fields from the current row.
+% \begin{macrocode}
+\newcommand*{\datagidxgetchildfields}{%
+ \dtlgetentryfromcurrentrow
+ {\Name}%
+ {\dtlcolumnindex{\DTLgidxCurrentdb}{Name}}%
+ \dtlgetentryfromcurrentrow
+ {\Description}%
+ {\dtlcolumnindex{\DTLgidxCurrentdb}{Description}}%
+ \dtlgetentryfromcurrentrow
+ {\Symbol}%
+ {\dtlcolumnindex{\DTLgidxCurrentdb}{Symbol}}%
+ \dtlgetentryfromcurrentrow
+ {\Long}%
+ {\dtlcolumnindex{\DTLgidxCurrentdb}{Long}}%
+ \dtlgetentryfromcurrentrow
+ {\Short}%
+ {\dtlcolumnindex{\DTLgidxCurrentdb}{Short}}%
+ \dtlgetentryfromcurrentrow
+ {\Text}%
+ {\dtlcolumnindex{\DTLgidxCurrentdb}{Text}}%
+ \dtlgetentryfromcurrentrow
+ {\Plural}%
+ {\dtlcolumnindex{\DTLgidxCurrentdb}{Plural}}%
+ \dtlgetentryfromcurrentrow
+ {\Short}%
+ {\dtlcolumnindex{\DTLgidxCurrentdb}{Used}}%
+ \dtlgetentryfromcurrentrow
+ {\Children}%
+ {\dtlcolumnindex{\DTLgidxCurrentdb}{Child}}%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\datagidx@displaychild}
+% \begin{macrocode}
+\newcommand*{\datagidx@displaychild}{%
+ \datagidxgetchildfields
+ \datagidxchilditem
+}
+% \end{macrocode}
+%\end{macro}
+%
+%
+% Define some keys for \ics{newgloss}:
+%\begin{macro}{\datagidx@heading}
+% Indicates how to format the heading in the glossary/index.
+% \begin{macrocode}
+\ifdef{\chapter}
+{%
+ \newcommand*{\datagidx@heading}{\chapter*}
+}%
+{%
+ \newcommand*{\datagidx@heading}{\section*}
+}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\DTLgidxNoHeading}
+% Allow user to suppress the heading. (So to suppress the
+% heading do \texttt{heading=\cs{DTLgidxNoHeading}}).
+% \begin{macrocode}
+\let\DTLgidxNoHeading\@gobble
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\datagidx@postheading}
+% Indicates what to do immediately after the heading.
+% \begin{macrocode}
+\newcommand*{\datagidx@postheading}{}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\datagidx@multicols}
+% Should we use \env{multicols} or \env{multicols*}?
+% \begin{macrocode}
+\newcommand*{\datagidx@multicols}{multicols}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\datagidx@sort}
+% Indicates how to sort the glossary/index.
+% Defaults to word order.
+% \begin{macrocode}
+\newcommand*{\datagidx@sort}{%
+ \dtlsort{Sort,FirstId}{\DTLgidxCurrentdb}{\dtlwordindexcompare}%
+}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\datagidxstart}
+% Indicates what to do at the start of the glossary/index.
+% \begin{macrocode}
+\newcommand*{\datagidxstart}%
+{%
+ \bgroup
+ \setlength{\parindent}{0pt}%
+ \setlength{\parskip}{0pt plus 0.3pt}%
+ \let\item\@idxitem
+}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\datagidxend}
+% Indicates what to do at the end of the glossary/index.
+% \begin{macrocode}
+\newcommand*{\datagidxend}{\egroup}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\datagidxtarget}
+% Provide a means to add a hypertarget if \ics{hypertarget} has been
+% defined.
+% \begin{macrocode}
+\newcommand*{\@datagidxtarget}[2]{%
+ \ifdef\hypertarget
+ {%
+ \bgroup
+ \let\glsadd\@gobble
+ \settoheight\dimen@{#2}%
+ \raisebox{\dimen@}{\hypertarget{#1}{}}%
+ \egroup
+ }%
+ {%
+ }%
+ #2%
+}
+\newcommand*{\datagidxtarget}{\@datagidxtarget}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\datagidxlink}
+% Provide a means to add a link if \ics{hyperlink} has been
+% defined.
+% \begin{macrocode}
+\newcommand*{\@datagidxlink}[2]{%
+ \ifdef\hyperlink
+ {%
+ \hyperlink{#1}{#2}%
+ }%
+ {%
+ #2%
+ }%
+}
+\newcommand*{\datagidxlink}{\@datagidxlink}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\DTLgidxEnableHyper}
+% Enable hyperlinks (if they are defined).
+% \begin{macrocode}
+\newcommand*{\DTLgidxEnableHyper}{%
+ \let\datagidxtarget\@datagidxtarget
+ \let\datagidxlink\@datagidxlink
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\DTLgidxDisableHyper}
+% Disable hyperlinks (if they are defined).
+% \begin{macrocode}
+\newcommand*{\DTLgidxDisableHyper}{%
+ \let\datagidxtarget\@secondoftwo
+ \let\datagidxlink\@secondoftwo
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\datagidxgroupsep}
+% Indicates what to do between groups (after the previous group and
+% before the header of the next group).
+% \begin{macrocode}
+\newcommand*{\datagidxgroupsep}{}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\datagidxgroupheader}
+% Indicates what to do at the start of a group. (The current group
+% label can be accessed via \cs{datagidxcurrentgroup} and the previous
+% group label can be accessed via \cs{datagidxprevgroup}.)
+% \begin{macrocode}
+\newcommand*{\datagidxgroupheader}{}
+% \end{macrocode}
+%\end{macro}
+%
+%
+%\begin{macro}{\datagidxitem}
+% Indicates what to do at the start of each item of the glossary/index.
+% \begin{macrocode}
+\newcommand*{\datagidxitem}{}%
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\datagidxchildstart}
+% Indicates what to do at the start of the child glossary/index.
+% \begin{macrocode}
+\newcommand*{\datagidxchildstart}{}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\datagidxchildend}
+% Indicates what to do at the end of the child glossary/index.
+% \begin{macrocode}
+\newcommand*{\datagidxchildend}{}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\datagidxchilditem}
+% Indicates what to do at the start of each item of the child glossary/index.
+% \begin{macrocode}
+\newcommand*{\datagidxchilditem}{}%
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\datagidxseealsostart}
+% Indicates what to do at the start of the ``see also'' list.
+% \begin{macrocode}
+\newcommand*{\datagidxseealsostart}{}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\datagidxseealsoend}
+% Indicates what to do at the end of the ``see also'' list.
+% \begin{macrocode}
+\newcommand*{\datagidxseealsoend}{}
+% \end{macrocode}
+%\end{macro}
+%
+%
+%\begin{macro}{\datagidx@doifsymlocwidth}
+%\begin{definition}
+%\cs{datagidx@doifsymlocwidth}\marg{indent}\marg{Name code}\marg{Location code}
+%\end{definition}
+% What to do if both the symbol width and the location width have
+% been set.
+% \begin{macrocode}
+\newcommand*{\datagidx@doifsymlocwidth}[3]{%
+% \end{macrocode}
+% Calculate remaining space left for the description.
+% \begin{macrocode}
+ \setlength{\dtl@tmplength}{\linewidth}%
+ \addtolength{\dtl@tmplength}{-#1}%
+ \settowidth{\dimen@}{#2}%
+ \addtolength{\dtl@tmplength}{-\dimen@}%
+ \addtolength{\dtl@tmplength}{-\datagidxsymbolwidth}%
+ \addtolength{\dtl@tmplength}{-\datagidxlocationwidth}%
+ \settowidth{\dimen@}{\DTLgidxPreLocation}%
+ \addtolength{\dtl@tmplength}{-\dimen@}%
+ \settowidth{\dimen@}{\DTLgidxSymDescSep}%
+ \addtolength{\dtl@tmplength}{-\dimen@}%
+ \if@datagidxsymbolleft
+ \begin{minipage}[t]{\datagidxsymbolwidth}%
+ \datagidxsymalign
+ \let\DTLgidxSymDescSep\@empty
+ \DTLgidxSymbolDescLeft
+ \end{minipage}%
+ \DTLgidxSymDescSep
+ \begin{minipage}[t]{\dtl@tmplength}%
+ \let\DTLgidxSymDescSep\@empty
+ \DTLgidxSymbolDescRight
+ \end{minipage}%
+ \else
+ \begin{minipage}[t]{\dtl@tmplength}%
+ \let\DTLgidxSymDescSep\@empty
+ \DTLgidxSymbolDescRight
+ \end{minipage}%
+ \DTLgidxSymDescSep
+ \begin{minipage}[t]{\datagidxsymbolwidth}%
+ \datagidxsymalign
+ \let\DTLgidxSymDescSep\@empty
+ \DTLgidxSymbolDescLeft
+ \end{minipage}%
+ \fi
+ \DTLgidxPreLocation
+ \begin{minipage}[t]{\datagidxlocationwidth}%
+ \datagidxlocalign
+ \let\DTLgidxPreLocation\@empty
+ #3%
+ \end{minipage}%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\datagidx@doiflocwidth}
+%\begin{definition}
+%\cs{datagidx@doiflocwidth}\marg{indent}\marg{Name code}\marg{Location code}
+%\end{definition}
+% What to do if only the location width has
+% been set.
+% \begin{macrocode}
+\newcommand*{\datagidx@doiflocwidth}[3]{%
+% \end{macrocode}
+% Calculate remaining space left for the symbol and description.
+% \begin{macrocode}
+ \setlength{\dtl@tmplength}{\linewidth}%
+ \addtolength{\dtl@tmplength}{-#1}%
+ \settowidth{\dimen@}{#2}%
+ \addtolength{\dtl@tmplength}{-\dimen@}%
+ \addtolength{\dtl@tmplength}{-\datagidxlocationwidth}%
+ \settowidth{\dimen@}{\DTLgidxPreLocation}%
+ \addtolength{\dtl@tmplength}{-\dimen@}%
+ \begin{minipage}[t]{\dtl@tmplength}%
+ \DTLgidxSymbolDescription
+ \end{minipage}%
+ \DTLgidxPreLocation
+ \begin{minipage}[t]{\datagidxlocationwidth}%
+ \datagidxlocalign
+ \let\DTLgidxPreLocation\@empty
+ #3%
+ \end{minipage}%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\datagidx@doifsymwidth}
+%\begin{definition}
+%\cs{datagidx@doifsymwidth}\marg{indent}\marg{Name code}\marg{Location code}
+%\end{definition}
+% What to do if only the location width has
+% been set.
+% \begin{macrocode}
+\newcommand*{\datagidx@doifsymwidth}[3]{%
+% \end{macrocode}
+% Calculate remaining space left for the description and location.
+% \begin{macrocode}
+ \setlength{\dtl@tmplength}{\linewidth}%
+ \addtolength{\dtl@tmplength}{-#1}%
+ \settowidth{\dimen@}{#2}%
+ \addtolength{\dtl@tmplength}{-\dimen@}%
+ \addtolength{\dtl@tmplength}{-\datagidxsymbolwidth}%
+ \settowidth{\dimen@}{\DTLgidxSymDescSep}%
+ \addtolength{\dtl@tmplength}{-\dimen@}%
+ \if@datagidxsymbolleft
+ \begin{minipage}[t]{\datagidxsymbolwidth}%
+ \datagidxsymalign
+ \let\DTLgidxSymDescSep\@empty
+ \DTLgidxSymbolDescLeft
+ \end{minipage}%
+ \DTLgidxSymDescSep
+ \begin{minipage}[t]{\dtl@tmplength}%
+ \let\DTLgidxSymDescSep\@empty
+ \DTLgidxSymbolDescRight
+ #3%
+ \end{minipage}%
+ \else
+ \begin{minipage}[t]{\dtl@tmplength}%
+ \let\DTLgidxSymDescSep\@empty
+ \DTLgidxSymbolDescRight
+ \end{minipage}%
+ \DTLgidxSymDescSep
+ \begin{minipage}[t]{\datagidxsymbolwidth}%
+ \datagidxsymalign
+ \let\DTLgidxSymDescSep\@empty
+ \DTLgidxSymbolDescLeft
+% \end{macrocode}
+% This arrangement may look a bit weird.
+% \begin{macrocode}
+ #3%
+ \end{minipage}%
+ \fi
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\datagidxlocalign}
+% Alignment of the location when the location width has been set.
+% \begin{macrocode}
+\newcommand*{\datagidxlocalign}{\raggedleft}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\datagidxsymalign}
+% Alignment of the symbol when the symbol width has been set.
+% \begin{macrocode}
+\newcommand*{\datagidxsymalign}{\centering}
+% \end{macrocode}
+%\end{macro}
+%
+%
+%\subsection{Predefined styles}
+%
+%\begin{macro}{\datagidxsetstyle}
+% Sets the current index/glossary style
+% \begin{macrocode}
+\newcommand*{\datagidxsetstyle}[1]{%
+ \ifcsdef{datagidx@style@#1}%
+ {%
+ \csuse{datagidx@style@#1}%
+ }%
+ {%
+ \PackageError{datagidx}{Unknown style `#1'}{}%
+ }%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\subsubsection{index}
+%\begin{macro}{\datagidx@style@index}
+% Basic index style.
+% \begin{macrocode}
+\newcommand*{\datagidx@style@index}{%
+ \renewcommand*{\datagidxstart}%
+ {%
+ \bgroup
+ \setlength{\parindent}{0pt}%
+ \setlength{\parskip}{0pt plus 0.3pt}%
+% \end{macrocode}
+% Index columns are usually too narrow for fully justified text.
+% \begin{macrocode}
+ \raggedright
+ \let\item\@idxitem
+% \end{macrocode}
+% Have the symbol or location widths been set?
+% \begin{macrocode}
+ \ifdim\datagidxsymbolwidth>0pt\relax
+% \end{macrocode}
+% Symbol width has been set
+% Has the location width been set?
+% \begin{macrocode}
+ \ifdim\datagidxlocationwidth>0pt\relax
+% \end{macrocode}
+% Both have been set.
+% \begin{macrocode}
+ \def\datagidx@item@body{%
+ \datagidx@doifsymlocwidth{0pt}%
+ {\DTLgidxNameFont{\DTLgidxNameCase{\Name}}}%
+ {%
+ \DTLgidxDoSeeOrLocation
+ }%
+ }%
+ \else
+% \end{macrocode}
+% Location width hasn't been set.
+% \begin{macrocode}
+ \def\datagidx@item@body{%
+ \datagidx@doiflocwidth{0pt}%
+ {\DTLgidxNameFont{\DTLgidxNameCase{\Name}}}%
+ {%
+ \DTLgidxDoSeeOrLocation
+ }%
+ }%
+ \fi
+ \else
+% \end{macrocode}
+% Symbol width hasn't been set
+% Has the location width been set?
+% \begin{macrocode}
+ \ifdim\datagidxlocationwidth>0pt\relax
+% \end{macrocode}
+% Location width has been set.
+% \begin{macrocode}
+ \def\datagidx@item@body{%
+ \datagidx@doiflocwidth{0pt}%
+ {\DTLgidxNameFont{\DTLgidxNameCase{\Name}}}%
+ {%
+ \DTLgidxDoSeeOrLocation
+ }%
+ }%
+ \else
+% \end{macrocode}
+% Neither have been set.
+% \begin{macrocode}
+ \def\datagidx@item@body{%
+ \DTLgidxSymbolDescription
+ \DTLgidxDoSeeOrLocation
+ }%
+ \fi
+ \fi
+ }%
+ \renewcommand*{\datagidxend}{\egroup}%
+ \renewcommand*{\datagidxgroupsep}{\ifdatagidxshowgroups\indexspace\fi}%
+ \renewcommand{\datagidxgroupheader}{%
+ \ifdatagidxshowgroups
+ \item
+ \makebox[\linewidth]%
+ {%
+ \textbf{\DTLgidxGroupHeaderTitle{\datagidxcurrentgroup}}%
+ }%
+ \DTLpar\nobreak\@afterheading
+ \fi
+ }%
+ \renewcommand*{\datagidxitem}{%
+% \end{macrocode}
+% Is this the start of a new group?
+% \begin{macrocode}
+ \ifdefempty\datagidxprevgroup
+ {%
+% \end{macrocode}
+% First item of the list.
+% \begin{macrocode}
+ \datagidxgroupheader
+ }%
+ {%
+% \end{macrocode}
+% Not the first item of the list. Is this item's group the same as
+% the last item's group?
+% \begin{macrocode}
+ \ifdefequal\datagidxcurrentgroup\datagidxprevgroup
+ {%
+% \end{macrocode}
+% Same, so do nothing.
+% \begin{macrocode}
+ }%
+ {%
+% \end{macrocode}
+% Different, so do the separator and the header.
+% \begin{macrocode}
+ \datagidxgroupsep
+ \datagidxgroupheader
+ }%
+ }%
+% \end{macrocode}
+% Now get on with this item.
+% \begin{macrocode}
+ \item
+ \datagidxtarget{\Label}%
+ {%
+ \DTLgidxNameFont{\DTLgidxNameCase{\Name}}%
+ }%
+ \DTLgidxPostName
+ \datagidx@item@body
+ \DTLgidxChildrenSeeAlso
+ }%
+ \renewcommand*{\datagidxchildstart}%
+ {%
+ \bgroup
+ \setlength{\parindent}{0pt}%
+ \setlength{\parskip}{0pt plus 0.3pt}%
+ \let\item\@idxitem
+ }%
+ \renewcommand*{\datagidxchildend}{\egroup}%
+ \renewcommand*{\datagidxchilditem}{%
+ \setlength{\dimen@}{\datagidxindent}%
+ \multiply\dimen@ by \datagidx@level\relax
+ \@idxitem\hspace*{\dimen@}%
+ \refstepcounter{DTLgidxChildCount}%
+ \datagidxtarget{\Label}%
+ {%
+ \DTLgidxChildStyle
+ {%
+ \DTLgidxNameFont{\DTLgidxNameCase{\Name}}%
+ \DTLgidxPostChildName
+ }%
+ }%
+ \DTLgidxSymbolDescription
+ \DTLgidxDoSeeOrLocation
+ \DTLgidxChildrenSeeAlso
+ }%
+ \renewcommand*{\datagidxseealsostart}%
+ {%
+ \bgroup
+ \setlength{\parindent}{0pt}%
+ \setlength{\parskip}{0pt plus 0.3pt}%
+ \setlength{\dimen@}{\datagidxindent}%
+ \advance\datagidx@level by 1\relax
+ \multiply\dimen@ by \datagidx@level\relax
+ \@idxitem\hspace*{\dimen@}%
+ }%
+ \renewcommand{\datagidxseealsoend}{\egroup}%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%Make this the default style:
+% \begin{macrocode}
+\datagidx@style@index
+% \end{macrocode}
+%
+%\subsubsection{indexalign}
+% Similar to index style but aligns the descriptions.
+%\begin{macro}{\datagidx@style@indexalign}
+% \begin{macrocode}
+\newcommand*{\datagidx@style@indexalign}{%
+ \renewcommand*{\datagidxstart}%
+ {%
+ \bgroup
+ \setlength{\parindent}{0pt}%
+ \setlength{\parskip}{0pt plus 0.3pt}%
+ \setlength{\datagidxnamewidth}{0pt}%
+ \DTLforeach*{\DTLgidxCurrentdb}%
+ {\Name=Name,\Location=Location,\See=See,\SeeAlso=SeeAlso,%
+ \Parent=Parent}%
+ {%
+ \DTLifnull{\Parent}%
+ {%
+ \datagidx@doifdisplayed
+ {%
+ \settowidth{\dimen@}{\DTLgidxNameFont{\DTLgidxNameCase{\Name}}}%
+ \ifdim\dimen@>\datagidxnamewidth\relax
+ \datagidxnamewidth=\dimen@\relax
+ \fi
+ }%
+ }%
+ {}%
+ }%
+ \settowidth{\dimen@}{\DTLgidxPostName}%
+ \addtolength{\datagidxnamewidth}{\dimen@}%
+ \setlength{\datagidxdescwidth}{\linewidth}%
+ \addtolength{\datagidxdescwidth}{-\datagidxnamewidth}%
+ \ifdim\datagidxsymbolwidth>0pt\relax
+ \addtolength{\datagidxdescwidth}{-\datagidxsymbolwidth}%
+ \settowidth{\dimen@}{\DTLgidxSymDescSep}%
+ \addtolength{\datagidxdescwidth}{-\dimen@}%
+ \fi
+ \ifdim\datagidxlocationwidth>0pt\relax
+ \addtolength{\datagidxdescwidth}{-\datagidxlocationwidth}%
+ \settowidth{\dimen@}{\DTLgidxPreLocation}%
+ \addtolength{\datagidxdescwidth}{-\dimen@}%
+ \fi
+% \end{macrocode}
+% Has the symbol width been set?
+% \begin{macrocode}
+ \ifdim\datagidxsymbolwidth>0pt\relax
+% \end{macrocode}
+% Yes, symbol width has been set.
+% Has the location width been set?
+% \begin{macrocode}
+ \ifdim\datagidxlocationwidth>0pt\relax
+% \end{macrocode}
+% Both symbol and location widths have been set.
+% \begin{macrocode}
+ \if@datagidxsymbolleft
+% \end{macrocode}
+% Symbol is on the left.
+% \begin{macrocode}
+ \def\datagidx@item@body{%
+ \begin{minipage}[t]{\datagidxsymbolwidth}%
+ \datagidxsymalign
+ \let\DTLgidxSymDescSep\@empty
+ \DTLgidxSymbolDescLeft
+ \end{minipage}%
+ \DTLgidxSymDescSep
+ \begin{minipage}[t]{\datagidxdescwidth}%
+ \let\DTLgidxSymDescSep\@empty
+ \setlength{\parskip}{0pt plus 0.3pt}%
+ \DTLgidxSymbolDescRight
+ \end{minipage}%
+ \DTLgidxPreLocation
+ \begin{minipage}[t]{\datagidxlocationwidth}%
+ \datagidxlocalign
+ \let\DTLgidxPreLocation\@empty
+ \DTLgidxDoSeeOrLocation
+ \end{minipage}%
+ }%
+ \else
+% \end{macrocode}
+% Symbol is on the right.
+% \begin{macrocode}
+ \def\datagidx@item@body{%
+ \begin{minipage}[t]{\datagidxdescwidth}%
+ \let\DTLgidxSymDescSep\@empty
+ \DTLgidxSymbolDescLeft
+ \end{minipage}%
+ \DTLgidxSymDescSep
+ \begin{minipage}[t]{\datagidxsymbolwidth}%
+ \datagidxsymalign
+ \let\DTLgidxSymDescSep\@empty
+ \setlength{\parskip}{0pt plus 0.3pt}%
+ \DTLgidxSymbolDescRight
+ \end{minipage}%
+ \DTLgidxPreLocation
+ \begin{minipage}[t]{\datagidxlocationwidth}%
+ \datagidxlocalign
+ \let\DTLgidxPreLocation\@empty
+ \DTLgidxDoSeeOrLocation
+ \end{minipage}%
+ }%
+ \fi
+ \else
+% \end{macrocode}
+% Location width hasn't been set. (Only symbol width has been set.)
+% \begin{macrocode}
+ \if@datagidxsymbolleft
+ \def\datagidx@item@body{%
+ \begin{minipage}[t]{\datagidxsymbolwidth}%
+ \datagidxsymalign
+ \let\DTLgidxSymDescSep\@empty
+ \DTLgidxSymbolDescLeft
+ \end{minipage}%
+ \DTLgidxSymDescSep
+ \begin{minipage}[t]{\datagidxdescwidth}%
+ \let\DTLgidxSymDescSep\@empty
+ \setlength{\parskip}{0pt plus 0.3pt}%
+ \DTLgidxSymbolDescRight
+ \DTLgidxDoSeeOrLocation
+ \end{minipage}%
+ }%
+ \else
+% \end{macrocode}
+% Symbol is on the right.
+% This combination may look weird.
+% \begin{macrocode}
+ \def\datagidx@item@body{%
+ \begin{minipage}[t]{\datagidxdescwidth}%
+ \let\DTLgidxSymDescSep\@empty
+ \DTLgidxSymbolDescLeft
+ \end{minipage}%
+ \DTLgidxSymDescSep
+ \begin{minipage}[t]{\datagidxsymbolwidth}%
+ \datagidxsymalign
+ \let\DTLgidxSymDescSep\@empty
+ \setlength{\parskip}{0pt plus 0.3pt}%
+ \DTLgidxSymbolDescRight
+ \DTLgidxDoSeeOrLocation
+ \end{minipage}%
+ }%
+ \fi
+ \fi
+ \else
+% \end{macrocode}
+% Symbol width hasn't been set.
+% Has the location width been set?
+% \begin{macrocode}
+ \ifdim\datagidxlocationwidth>0pt\relax
+% \end{macrocode}
+% Only location width has been set.
+% \begin{macrocode}
+ \def\datagidx@item@body{%
+ \begin{minipage}[t]{\datagidxdescwidth}%
+ \setlength{\parskip}{0pt plus 0.3pt}%
+ \DTLgidxSymbolDescription
+ \end{minipage}%
+ \DTLgidxPreLocation
+ \begin{minipage}[t]{\datagidxlocationwidth}%
+ \datagidxlocalign
+ \let\DTLgidxPreLocation\@empty
+ \DTLgidxDoSeeOrLocation
+ }%
+ \else
+% \end{macrocode}
+% Neither location nor symbol widths have been set.
+% \begin{macrocode}
+ \def\datagidx@item@body{%
+ \begin{minipage}[t]{\datagidxdescwidth}%
+ \setlength{\parskip}{0pt plus 0.3pt}%
+ \DTLgidxSymbolDescription
+ \DTLgidxDoSeeOrLocation
+ \end{minipage}%
+ }%
+ \fi
+ \fi
+ }%
+ \renewcommand*{\datagidxend}{\egroup}%
+ \renewcommand*{\datagidxgroupsep}{}%
+ \renewcommand*{\datagidxgroupheader}{}%
+ \renewcommand*{\datagidxitem}{%
+% \end{macrocode}
+% Is this the start of a new group?
+% \begin{macrocode}
+ \ifdefempty\datagidxprevgroup
+ {%
+% \end{macrocode}
+% First item of the list.
+% \begin{macrocode}
+ \datagidxgroupheader
+ }%
+ {%
+% \end{macrocode}
+% Not the first item of the list. Is this item's group the same as
+% the last item's group?
+% \begin{macrocode}
+ \ifdefequal\datagidxcurrentgroup\datagidxprevgroup
+ {%
+% \end{macrocode}
+% Same, so do nothing.
+% \begin{macrocode}
+ }%
+ {%
+% \end{macrocode}
+% Different, so do the separator and the header.
+% \begin{macrocode}
+ \datagidxgroupsep
+ \datagidxgroupheader
+ }%
+ }%
+% \end{macrocode}
+% Get on with this item
+% \begin{macrocode}
+ \hangindent0pt\relax
+ \parindent0pt\relax
+ \makebox[\datagidxnamewidth][l]%
+ {%
+ \datagidxtarget{\Label}%
+ {%
+ \DTLgidxNameFont{\DTLgidxNameCase{\Name}}%
+ \DTLgidxPostName
+ }%
+ }%
+ \datagidx@item@body
+ \par
+ \DTLgidxChildrenSeeAlso
+ \par
+ }%
+ \renewcommand*{\datagidxchildstart}%
+ {%
+ \bgroup
+ \setlength{\dimen@}{\datagidxindent}%
+ \multiply\dimen@ by \datagidx@level\relax
+ \setlength{\dtl@tmplength}{\linewidth}%
+ \addtolength{\dtl@tmplength}{-\dimen@}%
+ \setlength{\parindent}{0pt}%
+ \setlength{\parskip}{0pt plus 0.3pt}%
+ \edef\item{\noexpand\parshape=1 \the\dimen@ \the\dtl@tmplength}%
+ \setlength{\datagidxnamewidth}{0pt}%
+ \DTLforeach*{\DTLgidxCurrentdb}%
+ {\Name=Name,\Location=Location,\See=See,\SeeAlso=SeeAlso,%
+ \Parent=Parent}%
+ {%
+ \DTLifnull{\Parent}%
+ {%
+ \datagidx@doifdisplayed
+ {%
+ \settowidth{\dimen@}%
+ {%
+ \DTLgidxChildStyle
+ {%
+ \DTLgidxNameFont{\DTLgidxNameCase{\Name}}%
+ }%
+ }%
+ \ifdim\dimen@>\datagidxnamewidth\relax
+ \datagidxnamewidth=\dimen@\relax
+ \fi
+ }%
+ }%
+ {}%
+ }%
+ \settowidth{\dimen@}{\DTLgidxChildStyle\DTLgidxPostChildName}%
+ \addtolength{\datagidxnamewidth}{\dimen@}%
+ \setlength{\datagidxdescwidth}{\dtl@tmplength}%
+ \addtolength{\datagidxdescwidth}{-\datagidxnamewidth}%
+ }%
+ \renewcommand{\datagidxchildend}{\egroup}%
+ \renewcommand*{\datagidxchilditem}{%
+ \item
+ \refstepcounter{DTLgidxChildCount}%
+ \makebox[\datagidxnamewidth][l]%
+ {%
+ \datagidxtarget{\Label}%
+ {%
+ \DTLgidxChildStyle
+ {%
+ \DTLgidxNameFont{\DTLgidxNameCase{\Name}}%
+ \DTLgidxPostChildName
+ }%
+ }%
+ }%
+ \begin{minipage}[t]{\datagidxdescwidth}%
+ \setlength{\parskip}{0pt plus 0.3pt}%
+ \DTLgidxSymbolDescription
+ \DTLgidxDoSeeOrLocation
+ \DTLgidxChildrenSeeAlso
+ \end{minipage}%
+ \par
+ }%
+}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\datagidxindent}
+% Indent used by "index" and "indexalign" styles.
+% \begin{macrocode}
+\newlength\datagidxindent
+\setlength\datagidxindent{10\p@}
+% \end{macrocode}
+%\end{macro}
+%
+%
+%\subsubsection{align}
+%\begin{macro}{\datagidxnamewidth}
+% Length used by "align" and "indexalign" style name.
+% \begin{macrocode}
+\newlength\datagidxnamewidth
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\datagidxdescwidth}
+% Length used by "align" and "indexalign" style description.
+% \begin{macrocode}
+\newlength\datagidxdescwidth
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\datagidx@style@align}
+% \begin{macrocode}
+\newcommand*{\datagidx@style@align}{%
+ \renewcommand*{\datagidxstart}%
+ {%
+ \bgroup
+ \setlength{\parindent}{0pt}%
+ \setlength{\parskip}{0pt plus 0.3pt}%
+ \setlength{\datagidxnamewidth}{0pt}%
+ \DTLforeach*{\DTLgidxCurrentdb}%
+ {\Name=Name,\Location=Location,\See=See,\SeeAlso=SeeAlso,%
+ \Parent=Parent}%
+ {%
+ \DTLifnull{\Parent}%
+ {%
+ \datagidx@doifdisplayed
+ {%
+ \settowidth{\dimen@}{\DTLgidxNameFont{\DTLgidxNameCase{\Name}}}%
+ \ifdim\dimen@>\datagidxnamewidth\relax
+ \datagidxnamewidth=\dimen@\relax
+ \fi
+ }%
+ }%
+ {}%
+ }%
+ \settowidth{\dimen@}{\DTLgidxPostName}%
+ \addtolength{\datagidxnamewidth}{\dimen@}%
+ \setlength{\datagidxdescwidth}{\linewidth}%
+ \addtolength{\datagidxdescwidth}{-\datagidxnamewidth}%
+ \ifdim\datagidxsymbolwidth>0pt\relax
+ \addtolength{\datagidxdescwidth}{-\datagidxsymbolwidth}%
+ \settowidth{\dimen@}{\DTLgidxSymDescSep}%
+ \addtolength{\datagidxdescwidth}{-\dimen@}%
+ \fi
+ \ifdim\datagidxlocationwidth>0pt\relax
+ \addtolength{\datagidxdescwidth}{-\datagidxlocationwidth}%
+ \settowidth{\dimen@}{\DTLgidxPreLocation}%
+ \addtolength{\datagidxdescwidth}{-\dimen@}%
+ \fi
+% \end{macrocode}
+% Has the symbol width been set?
+% \begin{macrocode}
+ \ifdim\datagidxsymbolwidth>0pt\relax
+% \end{macrocode}
+% Yes, symbol width has been set.
+% Has the location width been set?
+% \begin{macrocode}
+ \ifdim\datagidxlocationwidth>0pt\relax
+% \end{macrocode}
+% Both symbol and location widths have been set.
+% \begin{macrocode}
+ \if@datagidxsymbolleft
+% \end{macrocode}
+% Symbol is on the left.
+% \begin{macrocode}
+ \def\datagidx@item@body{%
+ \begin{minipage}[t]{\datagidxsymbolwidth}%
+ \datagidxsymalign
+ \let\DTLgidxSymDescSep\@empty
+ \DTLgidxSymbolDescLeft
+ \end{minipage}%
+ \DTLgidxSymDescSep
+ \begin{minipage}[t]{\datagidxdescwidth}%
+ \let\DTLgidxSymDescSep\@empty
+ \setlength{\parskip}{0pt plus 0.3pt}%
+ \DTLgidxSymbolDescRight
+ \end{minipage}%
+ \DTLgidxPreLocation
+ \begin{minipage}[t]{\datagidxlocationwidth}%
+ \datagidxlocalign
+ \let\DTLgidxPreLocation\@empty
+ \DTLgidxDoSeeOrLocation
+ \DTLgidxChildrenSeeAlso
+ \end{minipage}%
+ }%
+ \else
+% \end{macrocode}
+% Symbol is on the right.
+% \begin{macrocode}
+ \def\datagidx@item@body{%
+ \begin{minipage}[t]{\datagidxdescwidth}%
+ \let\DTLgidxSymDescSep\@empty
+ \DTLgidxSymbolDescLeft
+ \end{minipage}%
+ \DTLgidxSymDescSep
+ \begin{minipage}[t]{\datagidxsymbolwidth}%
+ \datagidxsymalign
+ \let\DTLgidxSymDescSep\@empty
+ \setlength{\parskip}{0pt plus 0.3pt}%
+ \DTLgidxSymbolDescRight
+ \end{minipage}%
+ \DTLgidxPreLocation
+ \begin{minipage}[t]{\datagidxlocationwidth}%
+ \datagidxlocalign
+ \let\DTLgidxPreLocation\@empty
+ \DTLgidxDoSeeOrLocation
+ \DTLgidxChildrenSeeAlso
+ \end{minipage}%
+ }%
+ \fi
+ \else
+% \end{macrocode}
+% Location width hasn't been set. (Only symbol width has been set.)
+% \begin{macrocode}
+ \if@datagidxsymbolleft
+ \def\datagidx@item@body{%
+ \begin{minipage}[t]{\datagidxsymbolwidth}%
+ \datagidxsymalign
+ \let\DTLgidxSymDescSep\@empty
+ \DTLgidxSymbolDescLeft
+ \end{minipage}%
+ \DTLgidxSymDescSep
+ \begin{minipage}[t]{\datagidxdescwidth}%
+ \let\DTLgidxSymDescSep\@empty
+ \setlength{\parskip}{0pt plus 0.3pt}%
+ \DTLgidxSymbolDescRight
+ \DTLgidxDoSeeOrLocation
+ \DTLgidxChildrenSeeAlso
+ \end{minipage}%
+ }%
+ \else
+% \end{macrocode}
+% Symbol is on the right.
+% This combination may look weird.
+% \begin{macrocode}
+ \def\datagidx@item@body{%
+ \begin{minipage}[t]{\datagidxdescwidth}%
+ \let\DTLgidxSymDescSep\@empty
+ \DTLgidxSymbolDescLeft
+ \end{minipage}%
+ \DTLgidxSymDescSep
+ \begin{minipage}[t]{\datagidxsymbolwidth}%
+ \datagidxsymalign
+ \let\DTLgidxSymDescSep\@empty
+ \setlength{\parskip}{0pt plus 0.3pt}%
+ \DTLgidxSymbolDescRight
+ \DTLgidxDoSeeOrLocation
+ \DTLgidxChildrenSeeAlso
+ \end{minipage}%
+ }%
+ \fi
+ \fi
+ \else
+% \end{macrocode}
+% Symbol width hasn't been set.
+% Has the location width been set?
+% \begin{macrocode}
+ \ifdim\datagidxlocationwidth>0pt\relax
+% \end{macrocode}
+% Only location width has been set.
+% \begin{macrocode}
+ \def\datagidx@item@body{%
+ \begin{minipage}[t]{\datagidxdescwidth}%
+ \setlength{\parskip}{0pt plus 0.3pt}%
+ \DTLgidxSymbolDescription
+ \end{minipage}%
+ \DTLgidxPreLocation
+ \begin{minipage}[t]{\datagidxlocationwidth}%
+ \datagidxlocalign
+ \let\DTLgidxPreLocation\@empty
+ \DTLgidxDoSeeOrLocation
+ \DTLgidxChildrenSeeAlso
+ \end{minipage}%
+ }%
+ \else
+% \end{macrocode}
+% Neither location nor symbol widths have been set.
+% \begin{macrocode}
+ \def\datagidx@item@body{%
+ \begin{minipage}[t]{\datagidxdescwidth}%
+ \setlength{\parskip}{0pt plus 0.3pt}%
+ \DTLgidxSymbolDescription
+ \DTLgidxDoSeeOrLocation
+ \DTLgidxChildrenSeeAlso
+ \end{minipage}%
+ }%
+ \fi
+ \fi
+ }%
+ \renewcommand*{\datagidxend}{\egroup}%
+ \renewcommand*{\datagidxgroupsep}{\ifdatagidxshowgroups\indexspace\fi}%
+ \renewcommand{\datagidxgroupheader}{%
+ \ifdatagidxshowgroups
+ \item
+ \makebox[\linewidth]%
+ {%
+ \textbf{\DTLgidxGroupHeaderTitle{\datagidxcurrentgroup}}%
+ }%
+ \DTLpar\nobreak\@afterheading
+ \fi
+ }%
+ \renewcommand*{\datagidxitem}{%
+% \end{macrocode}
+% Is this the start of a new group?
+% \begin{macrocode}
+ \ifdefempty\datagidxprevgroup
+ {%
+% \end{macrocode}
+% First item of the list.
+% \begin{macrocode}
+ \datagidxgroupheader
+ }%
+ {%
+% \end{macrocode}
+% Not the first item of the list. Is this item's group the same as
+% the last item's group?
+% \begin{macrocode}
+ \ifdefequal\datagidxcurrentgroup\datagidxprevgroup
+ {%
+% \end{macrocode}
+% Same, so do nothing.
+% \begin{macrocode}
+ }%
+ {%
+% \end{macrocode}
+% Different, so do the separator and the header.
+% \begin{macrocode}
+ \datagidxgroupsep
+ \datagidxgroupheader
+ }%
+ }%
+ \hangindent0pt\relax
+ \parindent0pt\relax
+ \makebox[\datagidxnamewidth][l]%
+ {%
+ \datagidxtarget{\Label}%
+ {%
+ \DTLgidxNameFont{\DTLgidxNameCase{\Name}}%
+ \DTLgidxPostName
+ }%
+ }%
+ \datagidx@item@body
+ \par
+ }%
+ \renewcommand*{\datagidxchildstart}%
+ {%
+ \bgroup
+ \setlength{\parindent}{0pt}%
+ \setlength{\parskip}{0pt plus 0.3pt}%
+ \setlength{\datagidxnamewidth}{0pt}%
+ \DTLforeach*{\DTLgidxCurrentdb}%
+ {\Name=Name,\Location=Location,\See=See,\SeeAlso=SeeAlso,%
+ \Parent=Parent}%
+ {%
+ \DTLifnull{\Parent}%
+ {%
+ \datagidx@doifdisplayed
+ {%
+ \settowidth{\dimen@}%
+ {%
+ \DTLgidxChildStyle
+ {%
+ \DTLgidxNameFont{\DTLgidxNameCase{\Name}}%
+ }%
+ }%
+ \ifdim\dimen@>\datagidxnamewidth\relax
+ \datagidxnamewidth=\dimen@\relax
+ \fi
+ }%
+ }%
+ {}%
+ }%
+ \settowidth{\dimen@}{\DTLgidxChildStyle\DTLgidxPostChildName}%
+ \addtolength{\datagidxnamewidth}{\dimen@}%
+ \setlength{\datagidxdescwidth}{\linewidth}%
+ \addtolength{\datagidxdescwidth}{-\datagidxnamewidth}%
+ }%
+ \renewcommand{\datagidxchildend}{\egroup}%
+ \renewcommand*{\datagidxchilditem}{%
+ \hangindent0pt\relax
+ \parindent0pt\relax
+ \refstepcounter{DTLgidxChildCount}%
+ \makebox[\datagidxnamewidth][l]%
+ {%
+ \datagidxtarget{\Label}%
+ {%
+ \DTLgidxChildStyle
+ {%
+ \DTLgidxNameFont{\DTLgidxNameCase{\Name}}%
+ \DTLgidxPostChildName
+ }%
+ }%
+ }%
+ \begin{minipage}[t]{\datagidxdescwidth}%
+ \setlength{\parskip}{0pt plus 0.3pt}%
+ \DTLgidxSymbolDescription
+ \DTLgidxDoSeeOrLocation
+ \DTLgidxChildrenSeeAlso
+ \end{minipage}%
+ \par
+ }%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\subsubsection{gloss}
+%\begin{macro}{\datagidx@style@gloss}
+% \begin{macrocode}
+\newcommand*{\datagidx@style@gloss}{%
+ \renewcommand*{\datagidxstart}%
+ {%
+ \bgroup
+ \setlength{\parindent}{0pt}%
+ \setlength{\parskip}{0pt plus 0.3pt}%
+ \setlength{\datagidxnamewidth}{0pt}%
+ \DTLforeach*{\DTLgidxCurrentdb}%
+ {\Name=Name,\Location=Location,\See=See,\SeeAlso=SeeAlso,%
+ \Parent=Parent}%
+ {%
+ \DTLifnull{\Parent}%
+ {%
+ \datagidx@doifdisplayed
+ {%
+ \settowidth{\dimen@}{\DTLgidxNameFont{\DTLgidxNameCase{\Name}}}%
+ \ifdim\dimen@>\datagidxnamewidth\relax
+ \datagidxnamewidth=\dimen@\relax
+ \fi
+ }%
+ }%
+ {}%
+ }%
+ \settowidth{\dimen@}{\DTLgidxPostName}%
+ \addtolength{\datagidxnamewidth}{\dimen@}%
+ \setlength{\datagidxdescwidth}{\linewidth}%
+ \addtolength{\datagidxdescwidth}{-\datagidxnamewidth}%
+ }%
+ \renewcommand*{\datagidxend}{\egroup}%
+ \renewcommand*{\datagidxgroupsep}{\ifdatagidxshowgroups\indexspace\fi}%
+ \renewcommand{\datagidxgroupheader}{%
+ \ifdatagidxshowgroups
+ \item
+ \makebox[\linewidth]%
+ {%
+ \textbf{\DTLgidxGroupHeaderTitle{\datagidxcurrentgroup}}%
+ }%
+ \DTLpar\nobreak\@afterheading
+ \fi
+ }%
+ \renewcommand*{\datagidxitem}{%
+% \end{macrocode}
+% Is this the start of a new group?
+% \begin{macrocode}
+ \ifdefempty\datagidxprevgroup
+ {%
+% \end{macrocode}
+% First item of the list.
+% \begin{macrocode}
+ \datagidxgroupheader
+ }%
+ {%
+% \end{macrocode}
+% Not the first item of the list. Is this item's group the same as
+% the last item's group?
+% \begin{macrocode}
+ \ifdefequal\datagidxcurrentgroup\datagidxprevgroup
+ {%
+% \end{macrocode}
+% Same, so do nothing.
+% \begin{macrocode}
+ }%
+ {%
+% \end{macrocode}
+% Different, so do the separator and the header.
+% \begin{macrocode}
+ \datagidxgroupsep
+ \datagidxgroupheader
+ }%
+ }%
+ \hangindent0pt\relax
+ \parindent0pt\relax
+ \makebox[\datagidxnamewidth][l]%
+ {%
+ \datagidxtarget{\Label}%
+ {%
+ \DTLgidxNameFont{\DTLgidxNameCase{\Name}}%
+ \DTLgidxPostName
+ }%
+ }%
+ \begin{minipage}[t]{\datagidxdescwidth}%
+ \setlength{\parskip}{0pt plus 0.3pt}%
+ \@tempswatrue
+ \ifdefempty{\Description}%
+ {%
+ \ifdefempty{\Symbol}%
+ {%
+ \ifdefempty{\Location}{\@tempswafalse}{}%
+ }%
+ {}%
+ }%
+ {}%
+ \if@tempswa
+ \DTLgidxSymbolDescription
+ \DTLgidxDoSeeOrLocation
+ \DTLgidxSeeAlso
+ \else
+ \mbox{}%
+ \fi
+ \DTLgidxChildrenSeeAlso
+ \end{minipage}%
+ \par
+ }%
+ \renewcommand*{\datagidxchildstart}%
+ {%
+ \bgroup
+ \def\datagidx@childsep{}%
+ \setcounter{DTLgidxChildCount}{0}%
+ }%
+ \renewcommand{\datagidxchildend}{\DTLgidxPostChild\egroup}%
+ \renewcommand*{\datagidxchilditem}{%
+ \datagidx@childsep
+ \refstepcounter{DTLgidxChildCount}%
+ \datagidxtarget{\Label}%
+ {%
+ \DTLgidxChildStyle
+ {%
+ \DTLgidxNameFont{\DTLgidxNameCase{\Name}}%
+ \DTLgidxPostChildName
+ }%
+ }%
+ \DTLgidxSymbolDescription
+ \DTLgidxDoSeeOrLocation
+ \DTLgidxChildrenSeeAlso
+ \let\datagidx@childsep\DTLgidxChildSep
+ }%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\DTLgidxChildSep}
+% Separator between child entries for gloss style.
+% \begin{macrocode}
+\newcommand*{\DTLgidxChildSep}{ }
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\DTLgidxPostChild}
+%What to put at the end of child entries for gloss style.
+% \begin{macrocode}
+\newcommand*{\DTLgidxPostChild}{}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\DTLgidxDictHead}
+% Group header for dict style.
+% \begin{macrocode}
+\ifdef\chapter
+{%
+ \newcommand\DTLgidxDictHead{%
+ \chapter{\DTLgidxGroupHeaderTitle{\datagidxcurrentgroup}}%
+ }%
+}%
+{%
+ \newcommand\DTLgidxDictHead{%
+ \section{\DTLgidxGroupHeaderTitle{\datagidxcurrentgroup}}%
+ }%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\DTLgidxCategoryNameFont}
+% Font used for `category' entries with `dict' style.
+% \begin{macrocode}
+\newcommand*{\DTLgidxCategoryNameFont}[1]{#1}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\DTLgidxCategorySep}
+% Separator used with `dict' style.
+% \begin{macrocode}
+\newcommand*{\DTLgidxCategorySep}{\space}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\DTLgidxSubCategorySep}
+% Separator used with `dict' style.
+% \begin{macrocode}
+\newcommand*{\DTLgidxSubCategorySep}{\space}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\datagidxdictindent}
+% Indent used by `dict' style.
+% \begin{macrocode}
+\newcommand*{\datagidxdictindent}{1em}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\DTLgidxDictPostItem}
+% What to do at the end of each item in the `dict' style.
+% \begin{macrocode}
+\newcommand{\DTLgidxDictPostItem}{\par}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\datagidx@style@dict}
+% Dictionary style. This assumes a hierarchical structure where the
+% top level entries have a name. The next level is used to indicate
+% a category, such as ``adjective'' or ``noun''. If there is only
+% one meaning this level also has a description. If there is more
+% than one meaning, each meaning should be a child of the category
+% entry. Only third level entries are numbered. The "child" key is
+% ignored in this style. The symbol is ignored. The location and
+% symbols widths are also ignored.
+% \begin{macrocode}
+\newcommand*{\datagidx@style@dict}{%
+ \renewcommand*{\datagidxstart}%
+ {%
+ \bgroup
+ \setlength{\parindent}{0pt}%
+ \setlength{\parskip}{0pt plus 0.3pt}%
+ \dimen@=\linewidth
+ \advance\dimen@ by -\datagidxdictindent\relax
+ \dtl@tmplength=\datagidxdictindent\relax
+ \xdef\datagidxdictparshape{%
+ \noexpand\parshape=2 0pt \the\linewidth\space
+ \the\dtl@tmplength\space \the\dimen@\relax
+ }%
+ \datagidx@level=1\relax
+% \end{macrocode}
+% Index columns are usually too narrow for fully justified text.
+% \begin{macrocode}
+ \raggedright
+ }%
+ \renewcommand*{\datagidxend}{\egroup}%
+ \renewcommand*{\datagidxgroupsep}{}%
+ \renewcommand{\datagidxgroupheader}{%
+ \ifdatagidxshowgroups
+ \datagidxend
+ \datagidx@postend
+ \DTLgidxDictHead
+ \datagidx@prestart
+ \datagidxstart
+ \fi
+ }%
+ \renewcommand*{\datagidxitem}{%
+% \end{macrocode}
+% Is this the start of a new group?
+% \begin{macrocode}
+ \ifdefempty\datagidxprevgroup
+ {%
+% \end{macrocode}
+% First item of the list.
+% \begin{macrocode}
+ \datagidxgroupheader
+ }%
+ {%
+% \end{macrocode}
+% Not the first item of the list. Is this item's group the same as
+% the last item's group?
+% \begin{macrocode}
+ \ifdefequal\datagidxcurrentgroup\datagidxprevgroup
+ {%
+% \end{macrocode}
+% Same, so do nothing.
+% \begin{macrocode}
+ }%
+ {%
+% \end{macrocode}
+% Different, so do the separator and the header.
+% \begin{macrocode}
+ \datagidxgroupsep
+ \datagidxgroupheader
+ }%
+ }%
+% \end{macrocode}
+% Now get on with this item.
+% \begin{macrocode}
+ \datagidxdictparshape
+ \datagidxtarget{\Label}%
+ {%
+ \DTLgidxNameFont{\DTLgidxNameCase{\Name}}%
+ }%
+ \DTLgidxPostName
+% \end{macrocode}
+% Initialise category separator to do nothing.
+% \begin{macrocode}
+ \let\datagidx@catsep\@empty
+ \let\datagidx@subcatsep\@empty
+ \DTLgidxSymbolDescription
+% \end{macrocode}
+% No location list.
+% \begin{macrocode}
+ \DTLgidxChildrenSeeAlso
+ \DTLgidxDictPostItem
+ }%
+ \renewcommand*{\datagidxchildstart}%
+ {%
+ \bgroup
+ }%
+ \renewcommand*{\datagidxchildend}{\egroup}%
+ \renewcommand*{\datagidxchilditem}{%
+% \end{macrocode}
+% Which level are we on?
+% \begin{macrocode}
+ \ifnum\datagidx@level=2\relax
+% \end{macrocode}
+% Category entry
+% \begin{macrocode}
+ \datagidx@catsep
+ \let\datagidx@catsep\DTLgidxCategorySep
+ \let\datagidx@subcapsep\@empty
+ \datagidxtarget{\Label}%
+ {%
+ \DTLgidxChildStyle
+ {%
+ \DTLgidxCategoryNameFont{\DTLgidxNameCase{\Name}}%
+ \DTLgidxPostChildName
+ }%
+ }%
+ \setcounter{DTLgidxChildCount}{0}%
+ \else
+% \end{macrocode}
+% Sub Category entry
+% \begin{macrocode}
+ \datagidx@subcatsep
+ \let\datagidx@subcatsep\DTLgidxSubCategorySep
+ \refstepcounter{DTLgidxChildCount}%
+ \DTLgidxChildCountLabel
+ \DTLgidxPostChildName
+ \fi
+ \DTLgidxSymbolDescription
+ \DTLgidxDoSeeOrLocation
+ \DTLgidxChildrenSeeAlso
+ }%
+ \renewcommand*{\datagidxseealsostart}%
+ {%
+ \bgroup
+ \setlength{\parindent}{0pt}%
+ \setlength{\parskip}{0pt plus 0.3pt}%
+ \setlength{\dimen@}{\datagidxindent}%
+ \advance\datagidx@level by 1\relax
+ \multiply\dimen@ by \datagidx@level\relax
+ \@idxitem\hspace*{\dimen@}%
+ }%
+ \renewcommand{\datagidxseealsoend}{\egroup}%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\subsection{Location Lists}
+%\begin{macro}{\dtldofirstlocation}
+% Only display the first location in the list.
+% \begin{macrocode}
+\newcommand*{\dtldofirstlocation}{%
+ \@for\dtl@thisloc:=\Location\do{%
+ \ifdefempty\dtl@thisloc
+ {}%
+ {%
+ \expandafter\datagidx@getlocation\dtl@thisloc
+ \datagidxlink{\datagidx@current@target}%
+ {%
+ \datagidx@formatlocation
+ \datagidx@current@format\datagidx@current@locationstring
+ }%
+% \end{macrocode}
+% Only interested in the first item, so break out of loop.
+% \begin{macrocode}
+ \@endfortrue
+ }%
+ }%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\datagidx@formatlocation}
+% \begin{macrocode}
+\newcommand*{\datagidx@formatlocation}[2]{%
+ \ifdefempty{#1}%
+ {#2}%
+ {%
+ \ifcsdef{#1}%
+ {%
+ \csuse{#1}{#2}%
+ }%
+ {%
+ \PackageWarning{datagidx}{Unknown format `#1'}%
+ #2%
+ }%
+ }%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\dtldolocationlist}
+% Display the location list.
+% \begin{macrocode}
+\newcommand*{\dtldolocationlist}{%
+ \DTLifnull{\Location}%
+ {}%
+ {%
+ \def\datagidx@prev@location{-1}%
+ \def\datagidx@prev@locationstring{}%
+ \def\datagidx@prev@format{}%
+ \def\datagidx@prev@locationformat{}%
+ \def\datagidx@prev@prefix{}%
+ \def\datagidx@prev@target{}%
+ \def\datagidx@location@sep{}%
+ \def\datagidx@location@start{-1}%
+ \expandafter\forcsvlist\expandafter\datagidx@parse@location
+ \expandafter{\Location}%
+ \do@prevlocation % tidy up loose ends
+ }%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\if@dtl@sequential}
+% Conditional to keep track of sequences.
+% \begin{macrocode}
+\newif\if@dtl@sequential
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\datagidx@getlocdo}
+% Handler for \cs{datagidx@docomplist}
+% \begin{macrocode}
+\newcommand*\datagidx@getlocdo[1]{%
+ \ifdefempty\datagidx@current@location
+ {}%
+ {%
+ \eappto\datagidx@current@prefix{%
+ \datagidx@current@location\datagidx@compositor
+ }%
+ }%
+ \def\datagidx@current@location{#1}%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\datagidx@getlocation}
+% Get the location and store in \cs{current@location}:
+% \begin{macrocode}
+\def\datagidx@getlocation[#1]#2#3{%
+% \end{macrocode}
+% Store the original value.
+% \begin{macrocode}
+ \def\datagidx@current@locationstring{#2}%
+% \end{macrocode}
+% \begin{macrocode}
+ \bgroup
+ \datagidx@escapelocationformat
+ \xdef\datagidx@current@locationformat{#2}%
+ \datagidx@clearlocationformat
+ \xdef\datagidx@current@location{#2}%
+ \egroup
+% \end{macrocode}
+% If the location contains a compositor, we need to get the final
+% element and store the rest as a prefix:
+% \begin{macrocode}
+ \let\datagidx@list\datagidx@current@location
+ \def\datagidx@current@prefix{}%
+ \def\datagidx@current@location{}%
+ \let\do\datagidx@getlocdo
+ \expandafter\datagidx@docomplist
+ \expandafter{\datagidx@list}%
+% \end{macrocode}
+% Store the format:
+% \begin{macrocode}
+ \def\datagidx@current@format{#1}%
+% \end{macrocode}
+% Store the target:
+% \begin{macrocode}
+ \def\datagidx@current@target{#3}%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\datagidx@parse@location}
+% Parses the location list (given in the argument).
+% \begin{macrocode}
+\newcommand*{\datagidx@parse@location}[1]{%
+% \end{macrocode}
+% Parse location format.
+% \begin{macrocode}
+ \datagidx@getlocation#1\relax
+% \end{macrocode}
+% If this is the same as the previous location, do nothing.
+% \begin{macrocode}
+ \ifdefequal{\datagidx@prev@locationstring}{\datagidx@current@locationstring}%
+ {%
+% \end{macrocode}
+% If the format is different, let the non-empty format over-ride
+% the empty format.
+% \begin{macrocode}
+ \ifstrequal{\datagidx@prev@format}{\datagidx@current@format}
+ {%
+ }%
+ {%
+ \ifdefempty{\datagidx@current@format}
+ {%
+% \end{macrocode}
+% Current format is empty, so keep previous unchanged.
+% \begin{macrocode}
+ }%
+ {%
+ \ifdefempty{\datagidx@prev@format}
+ {%
+% \end{macrocode}
+% Previous format is empty, so update.
+% \begin{macrocode}
+ \let\datagidx@prev@format\datagidx@current@format
+ }%
+ {%
+ \PackageWarning{datagidx}%
+ {%
+ Conflicting location formats `\datagidx@prev@format' and
+ `\datagidx@current@format' for location `\datagidx@current@location'%
+ }%
+ }%
+ }%
+ }%
+ }%
+ {%
+ \@datagidx@parse@location
+ }%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\@datagidx@parse@location}
+% \begin{macrocode}
+\newcommand*{\@datagidx@parse@location}{%
+% \end{macrocode}
+% Check if we have a sequence.
+% \begin{macrocode}
+ \@dtl@sequentialtrue
+% \end{macrocode}
+% A change in font format breaks the sequence.
+% \begin{macrocode}
+ \ifdefequal{\datagidx@prev@format}{\datagidx@current@format}
+ {%
+% \end{macrocode}
+% A change in location format breaks the sequence.
+% \begin{macrocode}
+ \ifdefequal{\datagidx@prev@locationformat}{\datagidx@current@locationformat}
+ {%
+% \end{macrocode}
+% A change in prefix breaks the sequence.
+% \begin{macrocode}
+ \ifdefequal{\datagidx@prev@prefix}{\datagidx@current@prefix}
+ {%
+ }%
+ {%
+% \end{macrocode}
+% Prefixes are different, so not a sequence.
+% \begin{macrocode}
+ \@dtl@sequentialfalse
+ }%
+ }%
+ {%
+% \end{macrocode}
+% Formats are different, so not a sequence.
+% \begin{macrocode}
+ \@dtl@sequentialfalse
+ }%
+ }%
+ {%
+% \end{macrocode}
+% Formats are different, so not a sequence.
+% \begin{macrocode}
+ \@dtl@sequentialfalse
+ }%
+ \if@dtl@sequential
+% \end{macrocode}
+% Is this location one more than the previous location?
+% \begin{macrocode}
+ \ifnumequal{\datagidx@prev@location+1}{\datagidx@current@location}%
+ {%
+% \end{macrocode}
+% It is one more than previous value.
+% Is this location the same type as the previous location?
+% \begin{macrocode}
+ \ifdefequal
+ \datagidx@current@locationformat
+ \datagidx@prev@locationformat
+ {%
+% \end{macrocode}
+% They are the same, so we have a sequence.
+% \begin{macrocode}
+ \@dtl@sequentialtrue
+ }%
+ {%
+% \end{macrocode}
+% They aren't the same, so we don't have a sequence.
+% \begin{macrocode}
+ \@dtl@sequentialfalse
+ }%
+ }%
+ {%
+ \@dtl@sequentialfalse
+ }%
+ \fi
+% \end{macrocode}
+% Has the sequence flag been set?
+% \begin{macrocode}
+ \if@dtl@sequential
+% \end{macrocode}
+% Yes, we have a sequence.
+% Has the start of the sequence been set?
+% \begin{macrocode}
+ \ifnumequal{\datagidx@location@start}{-1}%
+ {%
+% \end{macrocode}
+% No it hasn't, so set it
+% \begin{macrocode}
+ \let\datagidx@location@start\datagidx@prev@location
+ \let\datagidx@location@startval\datagidx@prev@locationstring
+ \let\datagidx@location@format\datagidx@prev@format
+ \let\datagidx@location@target\datagidx@prev@target
+ }%
+ {%
+ }%
+ \else
+% \end{macrocode}
+% We don't have a sequence, so do the previous location.
+% \begin{macrocode}
+ \do@prevlocation
+ \fi
+% \end{macrocode}
+% Update previous location macros to this location.
+% \begin{macrocode}
+ \let\datagidx@prev@location\datagidx@current@location
+ \let\datagidx@prev@format\datagidx@current@format
+ \let\datagidx@prev@prefix\datagidx@current@prefix
+ \let\datagidx@prev@locationformat\datagidx@current@locationformat
+ \let\datagidx@prev@locationstring\datagidx@current@locationstring
+ \let\datagidx@prev@target\datagidx@current@target
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\DTLgidxLocationSep}
+% Separator between locations.
+% \begin{macrocode}
+\newcommand*{\DTLgidxLocationSep}{, }
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\DTLgidxLocationF}
+% How to format a location list consisting of only two locations.
+% \begin{macrocode}
+\newcommand*{\DTLgidxLocationF}[2]{%
+ #1\DTLgidxLocationSep#2%
+}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\DTLgidxLocationFF}
+% How to format a location list consisting of three or more locations.
+% \begin{macrocode}
+\newcommand*{\DTLgidxLocationFF}[2]{%
+ #1--#2%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\do@prevlocation}
+% Do the previous location in the current list.
+% \begin{macrocode}
+\newcommand*{\do@prevlocation}{%
+% \end{macrocode}
+% Have we come to the end of a sequence?
+% \begin{macrocode}
+ \ifnumequal{\datagidx@location@start}{-1}%
+ {%
+% \end{macrocode}
+% Not the end of a sequence.
+% \begin{macrocode}
+ \ifdefempty{\datagidx@prev@locationstring}%
+ {}%
+ {%
+ \datagidx@location@sep
+ \datagidxlink{\datagidx@prev@target}%
+ {%
+ \datagidx@formatlocation
+ \datagidx@prev@format\datagidx@prev@locationstring
+ }%
+ \def\datagidx@location@sep{\DTLgidxLocationSep}%
+ }%
+ }%
+ {%
+% \end{macrocode}
+% At the end of a sequence.
+% \begin{macrocode}
+ \datagidx@location@sep
+ \do@locrange
+ \def\datagidx@location@sep{\DTLgidxLocationSep}%
+ \def\datagidx@location@start{-1}%
+ }%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\do@locrange}
+% Format the location range.
+% \begin{macrocode}
+\newcommand*{\do@locrange}{%
+% \end{macrocode}
+% Are the start and end locations 2 or more apart?
+% \begin{macrocode}
+ \ifnumgreater{\datagidx@prev@location}{\datagidx@location@start+1}%
+ {%
+% \end{macrocode}
+% Yes, they are, so form a range:
+% \begin{macrocode}
+ \DTLgidxLocationFF
+ {%
+ \datagidxlink{\datagidx@location@target}%
+ {%
+ \datagidx@formatlocation
+ \datagidx@location@format\datagidx@location@startval
+ }%
+ }%
+ {%
+ \datagidxlink{\datagidx@prev@target}%
+ {%
+ \datagidx@formatlocation
+ \datagidx@prev@format\datagidx@prev@locationstring
+ }%
+ }%
+ }%
+ {%
+% \end{macrocode}
+% No, they aren't so don't form a range:
+% \begin{macrocode}
+ \DTLgidxLocationF
+ {
+ \datagidxlink{\datagidx@location@target}%
+ {%
+ \datagidx@formatlocation
+ \datagidx@location@format\datagidx@location@startval
+ }%
+ }%
+ {%
+ \datagidxlink{\datagidx@prev@target}%
+ {%
+ \datagidx@formatlocation
+ \datagidx@prev@format\datagidx@prev@locationstring
+ }%
+ }%
+ }%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\section{Defining New Glossary/Index Databases}
+%
+%\begin{macro}{\datagidx@defaultdatabase}
+% The default database to which terms should be added.
+% \begin{macrocode}
+\newcommand*{\datagidx@defaultdatabase}{}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\DTLgidxSetDefaultDB}
+% Allow user to set the default database
+% \begin{macrocode}
+\newcommand*{\DTLgidxSetDefaultDB}[1]{%
+ \renewcommand*{\datagidx@defaultdatabase}{#1}%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%Define keys for \cs{newgidx}:
+% \begin{macrocode}
+\define@key{newgloss}{heading}{\renewcommand*{\datagidx@heading}{#1}}
+\define@key{newgloss}{postheading}{%
+ \renewcommand*{\datagidx@postheading}{#1}%
+}
+\define@choicekey{newgloss}{balance}[\val\nr]{true,false}[true]{%
+ \ifcase\nr\relax
+ \renewcommand*{\datagidx@multicols}{multicols}%
+ \or
+ \renewcommand*{\datagidx@multicols}{multicols*}%
+ \fi
+}
+\define@key{newgloss}{sort}{\renewcommand*{\datagidx@sort}{#1}}
+% \end{macrocode}
+% Default style is `index':
+% \begin{macrocode}
+\newcommand*{\datagidx@style}{index}
+\define@key{newgloss}{style}{\renewcommand*{\datagidx@style}{#1}}
+% \end{macrocode}
+% Define conditional to determine whether or not to show group
+% headers and do sep. (Default is false.)
+%\begin{macro}{\ifdatagidxshowgroups}
+% \begin{macrocode}
+\newif\ifdatagidxshowgroups
+\newcommand*{\datagidx@showgroups}{false}
+% \end{macrocode}
+%\end{macro}
+% \begin{macrocode}
+\define@choicekey{newgloss}{showgroups}{true,false}[true]%
+{%
+ \renewcommand{\datagidx@showgroups}{#1}%
+}%
+% \end{macrocode}
+%
+%\begin{macro}{\newgidx}
+%\begin{definition}
+% \cs{newgloss}\oarg{options}\marg{database name}\marg{title}
+%\end{definition}
+% Define \cs{newgidx} if it hasn't already been defined by the
+% `highopt' optimize setting.
+% \begin{macrocode}
+\ifundef\newgidx
+{%
+ \newcommand*{\newgidx}{\datagidx@newgidx}
+}%
+{}
+% \end{macrocode}
+% May only be used in the preamble (otherwise the entries will be
+% undefined when their locations are read from the aux file).
+% \begin{macrocode}
+\@onlypreamble\newgidx
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\datagidx@highopt@newgidx}
+% The behaviour of \cs{newgidx} when the `highopt' optimize option has
+% been set.
+% \begin{macrocode}
+\newcommand*{\datagidx@highopt@newgidx}[3][]{%
+% \end{macrocode}
+% Get the file name:
+% \begin{macrocode}
+ \edef\datagidx@indexfilename{\datagidxhighoptfilename{#2}}%
+% \end{macrocode}
+% Has the file been created?
+% \begin{macrocode}
+ \IfFileExists{\datagidx@indexfilename}%
+ {%
+% \end{macrocode}
+% File does exists. Load it.
+% \begin{macrocode}
+ \input{\datagidx@indexfilename}%
+% \end{macrocode}
+% Update the `datagidx' database.
+% \begin{macrocode}
+ \bgroup
+ \setkeys{newgloss}{#1}%
+ \datagidx@newgidx@update{#2}{#3}%
+ \egroup
+ }%
+ {%
+% \end{macrocode}
+% File doesn't exist. Behave as normal.
+% \begin{macrocode}
+ \datagidx@newgidx[#1]{#2}{#3}%
+ }%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\datagidx@newgidx}
+% The normal behaviour of \cs{newgidx}
+% \begin{macrocode}
+\newcommand*{\datagidx@newgidx}[3][]{%
+\bgroup
+ \setkeys{newgloss}{#1}%
+% \end{macrocode}
+% If no default database has been identified, set the default to
+% this database.
+% \begin{macrocode}
+ \ifdefempty{\datagidx@defaultdatabase}%
+ {\xdef\datagidx@defaultdatabase{#2}}%
+ {}%
+ \DTLgnewdb{#2}%
+ \DTLaddcolumn{#2}{Label}%
+ \DTLaddcolumn{#2}{Location}%
+ \DTLaddcolumn{#2}{CurrentLocation}%
+ \DTLaddcolumn{#2}{FirstId}%
+ \DTLaddcolumn{#2}{Name}%
+ \DTLaddcolumn{#2}{Text}%
+ \DTLaddcolumn{#2}{Parent}%
+ \DTLaddcolumn{#2}{Child}%
+ \DTLaddcolumn{#2}{Description}%
+ \DTLaddcolumn{#2}{Used}%
+ \DTLaddcolumn{#2}{Symbol}%
+ \DTLaddcolumn{#2}{Long}%
+ \DTLaddcolumn{#2}{Short}%
+ \DTLaddcolumn{#2}{See}%
+ \DTLaddcolumn{#2}{SeeAlso}%
+ \datagidx@newgidx@update{#2}{#3}%
+\egroup
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\datagidx@newgidx@update}
+% Update the `datagidx' database.
+% \begin{macrocode}
+\newcommand*{\datagidx@newgidx@update}[2]{%
+ \DTLnewrow{datagidx}%
+ \DTLnewdbentry{datagidx}{Glossary}{#1}%
+ \DTLnewdbentry{datagidx}{Title}{#2}%
+ {%
+ \dtlexpandnewvalue
+ \DTLnewdbentry{datagidx}{Heading}{\expandonce\datagidx@heading}%
+ \DTLnewdbentry{datagidx}{PostHeading}{\expandonce\datagidx@postheading}%
+ \DTLnewdbentry{datagidx}{MultiCols}{\expandonce\datagidx@multicols}%
+ \DTLnewdbentry{datagidx}{Sort}{\expandonce\datagidx@sort}%
+ \DTLnewdbentry{datagidx}{Style}{\expandonce\datagidx@style}%
+ \DTLnewdbentry{datagidx}{ShowGroups}{\expandonce\datagidx@showgroups}%
+ }%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\section{Defining New Terms}
+%
+%\subsection{Options}
+% Define some keys for \cs{newterm}:
+%\begin{macro}{\newterm@label}
+% \begin{macrocode}
+\newcommand*{\newterm@label}{}
+\define@key{newterm}{label}{\renewcommand*{\newterm@label}{#1}}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\newterm@parent}
+% \begin{macrocode}
+\newcommand*{\newterm@parent}{}
+\define@key{newterm}{parent}{\renewcommand*{\newterm@parent}{#1}}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\newterm@text}
+% \begin{macrocode}
+\newcommand*{\newterm@text}{}
+\define@key{newterm}{text}{\renewcommand*{\newterm@text}{#1}}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\newterm@description}
+% \begin{macrocode}
+\newcommand*{\newterm@description}{}
+\define@key{newterm}{description}{%
+ \renewcommand*{\newterm@description}{#1}%
+}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\newterm@plural}
+% \begin{macrocode}
+\define@key{newterm}{plural}{\def\newterm@plural{#1}}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\newterm@sort}
+% \begin{macrocode}
+\newcommand*{\newterm@sort}{}
+\define@key{newterm}{sort}{\renewcommand*{\newterm@sort}{#1}}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\newterm@symbol}
+% \begin{macrocode}
+\newcommand*{\newterm@symbol}{}
+\define@key{newterm}{symbol}{\renewcommand*{\newterm@symbol}{#1}}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\newterm@database}
+% \begin{macrocode}
+\newcommand*{\newterm@database}{}
+\define@key{newterm}{database}{\renewcommand*{\newterm@database}{#1}}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\newterm@long}
+% \begin{macrocode}
+\newcommand*{\newterm@long}{}
+\define@key{newterm}{long}{%
+ \renewcommand*{\newterm@long}{#1}%
+ \def\newterm@longplural{#1s}%
+}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\newterm@short}
+% \begin{macrocode}
+\newcommand*{\newterm@short}{}
+\define@key{newterm}{short}{%
+ \renewcommand*{\newterm@short}{#1}%
+ \def\newterm@shortplural{#1s}%
+}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\newterm@longplural}
+% \begin{macrocode}
+\define@key{newterm}{longplural}{%
+ \def\newterm@longplural{#1}%
+}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\newterm@shortplural}
+% \begin{macrocode}
+\define@key{newterm}{shortplural}{%
+ \def\newterm@shortplural{#1}%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\newterm@see}
+% ``see'' should not be used with a location list. If you have a
+% location list and want a cross-reference use ``see also'' instead.
+% \begin{macrocode}
+\newcommand*{\newterm@see}{}
+\define@key{newterm}{see}{%
+ \renewcommand*{\newterm@see}{#1}%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\newterm@seealso}
+% ``see also'' should be used with a location list (or with child
+% entries with location lists). If an entry has no location list and
+% not child entries use ``see'' instead.
+% \begin{macrocode}
+\newcommand*{\newterm@seealso}{}
+\define@key{newterm}{seealso}{%
+ \renewcommand*{\newterm@seealso}{#1}%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\subsection{New Terms}
+%
+%\begin{macro}{\newterm@defaultshook}
+% \begin{macrocode}
+\newcommand*{\newterm@defaultshook}{}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\newterm@extrafields}
+% \begin{macrocode}
+\newcommand*{\newterm@extrafields}{}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\DTLgidxAssignList}
+% Assignment list used by \ics{printterms}
+% \begin{macrocode}
+\newcommand*{\DTLgidxAssignList}{%
+ \Name=Name,\Description=Description,\Used=Used,\Symbol=Symbol,%
+ \Long=Long,\Short=Short,\LongPlural=LongPlural,\ShortPlural=ShortPlural,%
+ \Location=Location,\See=See,\SeeAlso=SeeAlso,%
+ \Text=Text,\Plural=Plural,\CurrentLocation=CurrentLocation,%
+ \Label=Label,\Parent=Parent,\Children=Child,\FirstId=FirstId,\Sort=Sort%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\datagidxtermkeys}
+% Keys defined for \cs{newterm} corresponding to fields (``name'' is
+% added for convenience).
+% \begin{macrocode}
+\newcommand*{\datagidxtermkeys}{%
+ name,description,symbol,long,short,see,seealso,text,plural,%
+ label,parent,sort%
+}
+% \end{macrocode}
+%\end{macro}
+% Access keys corresponding to given fields
+% \begin{macrocode}
+\newcommand*\@datagidx@fieldkey@Name{name}%
+\newcommand*\@datagidx@fieldkey@Description{description}%
+\newcommand*\@datagidx@fieldkey@Symbol{symbol}%
+\newcommand*\@datagidx@fieldkey@Long{long}%
+\newcommand*\@datagidx@fieldkey@Short{short}%
+\newcommand*\@datagidx@fieldkey@See{see}%
+\newcommand*\@datagidx@fieldkey@SeeAlso{seealso}%
+\newcommand*\@datagidx@fieldkey@Text{text}%
+\newcommand*\@datagidx@fieldkey@Plural{plural}%
+\newcommand*\@datagidx@fieldkey@Label{label}%
+\newcommand*\@datagidx@fieldkey@Parent{parent}%
+\newcommand*\@datagidx@fieldkey@Sort{sort}%
+% \end{macrocode}
+%
+%\begin{macro}{\newtermaddfield}
+%\begin{definition}
+%\cs{newtermaddfield}\oarg{db list}\marg{column key}\marg{new term
+%key}\marg{default value}
+%\end{definition}
+% The default value may contain \ics{field}\marg{key} to get the
+% value of another field.
+% \begin{macrocode}
+\newcommand*{\newtermaddfield}[4][]{%
+% \end{macrocode}
+% If optional argument not specified, iterate over all defined
+% glossaries/indices
+% \begin{macrocode}
+ \ifstrempty{#1}%
+ {%
+ \dtlforcolumn{\datagidx@thisidx}{datagidx}{Glossary}%
+ {%
+ \DTLaddcolumn{\datagidx@thisidx}{#2}%
+ }%
+ }%
+ {%
+ \@for\datagidx@thisidx:=#1\do
+ {%
+ \DTLaddcolumn{\datagidx@thisidx}{#2}%
+ }%
+ }%
+ \expandafter\gdef\csname newterm@#3\endcsname{}%
+ \define@key{newterm}{#3}%
+ {%
+ \expandafter\def\csname newterm@#3\endcsname{##1}%
+ }%
+ \gappto\newterm@defaultshook
+ {%
+ \expandafter\protected@edef\csname newterm@#3\endcsname{#4}%
+ }%
+ \gappto\newterm@extrafields
+ {%
+ \protected@edef\datagidx@value{\csname newterm@#3\endcsname}%
+ \DTLnewdbentry{\newterm@database}{#2}{\expandonce\datagidx@value}%
+ }%
+ \xappto\DTLgidxAssignList
+ {%
+ ,\expandafter\noexpand\csname#2\endcsname=#2%
+ }%
+ \xappto\datagidxtermkeys{,#3}%
+ \expandafter\xdef\csname @datagidx@fieldkey@#2\endcsname{#3}%
+ \xappto\datagidxgetchildfields
+ {%
+ \noexpand\dtlgetentryfromcurrentrow
+ {\expandafter\noexpand\csname#2\endcsname}%
+ {\noexpand\dtlcolumnindex{\noexpand\DTLgidxCurrentdb}{#2}}%
+ }%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\newtermlabelhook}
+% \begin{macrocode}
+\newcommand*{\newtermlabelhook}{}
+% \end{macrocode}
+%\end{macro}
+%
+%
+%\begin{macro}{\DTLgidxNoFormat}
+% \begin{macrocode}
+\newcommand*{\DTLgidxNoFormat}[1]{#1}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\DTLgidxGobble}
+% \begin{macrocode}
+\newcommand*{\DTLgidxGobble}[1]{}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\DTLgidxStripBackslash}
+% Argument must be a control sequence. This is stringified and the
+% first character (The backslash) is removed).
+% \begin{macrocode}
+\newcommand*{\DTLgidxStripBackslash}[1]{%
+ \expandafter\@gobble\string#1%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\DTLgidxName}
+%\begin{definition}
+%\cs{DTLgidxName}\marg{forenames}\marg{surname}
+%\end{definition}
+% How to format a person's name in the text.
+% \begin{macrocode}
+\newcommand*{\DTLgidxName}[2]{%
+ #1\space #2%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\DTLgidxNameNum}
+%\begin{definition}
+%\cs{DTLgidxNameNum}\marg{n}
+%\end{definition}
+% The argument \meta{n} should be a number applied to a name
+% (e.g.\ \verb*"James "\cs{DTLgidxNameNum}{1}). This is converted to
+% a two-digit number for sorting but a Roman numeral for the label
+% and in the text.
+% \begin{macrocode}
+\newcommand*{\DTLgidxNameNum}[1]{\@Roman{#1}}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\datagidx@namenum}
+% Conversion for sort key.
+% \begin{macrocode}
+\newcommand*{\datagidx@namenum}[1]{\two@digits{#1}}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\DTLgidxPlace}
+%\begin{definition}
+%\cs{DTLgidxPlace}\marg{country}\marg{town/city}
+%\end{definition}
+% How to format a place in the text.
+% \begin{macrocode}
+\newcommand*{\DTLgidxPlace}[2]{%
+ #2%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\DTLgidxSubject}
+%\begin{definition}
+%\cs{DTLgidxSubject}\marg{main}\marg{category}
+%\end{definition}
+% How to format a subject in the text. Ignore the main part in the
+% text.
+% \begin{macrocode}
+\newcommand*{\DTLgidxSubject}[2]{%
+ #2%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\DTLgidxOffice}
+%\begin{definition}
+%\cs{DTLgidxOffice}\marg{office}\marg{name}
+%\end{definition}
+% Put the office in parentheses in the document text.
+% \begin{macrocode}
+\newcommand*{\DTLgidxOffice}[2]{%
+ #2 (#1)%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\DTLgidxIgnore}
+% Show argument in document text, but disregard in the sort and
+% label.
+% \begin{macrocode}
+\newcommand*{\DTLgidxIgnore}[1]{#1}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\DTLgidxMac}
+%\begin{definition}
+%\cs{DTLgidxMac}\marg{text}
+%\end{definition}
+% In the document, just does \meta{text}, but gets converted to
+% ``Mac'' in the sort key. (Unless overridden by the user.)
+% \begin{macrocode}
+\newcommand*{\DTLgidxMac}[1]{#1}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\datagidx@mac}
+%\cs{DTLgidxMac} gets temporarily redefined to \cs{datagidx@mac}
+%when construction the sort key.
+% \begin{macrocode}
+\newcommand*{\datagidx@mac}[1]{Mac}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\DTLgidxSaint}
+%\begin{definition}
+%\cs{DTLgidxSaint}\marg{text}
+%\end{definition}
+% In the document, just does \meta{text}, but gets converted to
+% ``Saint'' in the sort key. (Unless overridden by the user.)
+% \begin{macrocode}
+\newcommand*{\DTLgidxSaint}[1]{#1}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\datagidx@saint}
+%\cs{DTLgidxMac} gets temporarily redefined to \cs{datagidx@saint}
+%when construction the sort key.
+% \begin{macrocode}
+\newcommand*{\datagidx@saint}[1]{Saint}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\DTLgidxRank}
+%\begin{definition}
+%\cs{DTLgidxRank}\marg{rank}\marg{forenames}
+%\end{definition}
+% A person's title, rank or sanctity should be ignored when sorting.
+% \begin{macrocode}
+\newcommand*{\DTLgidxRank}[2]{#1~#2}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\datagidx@rank}
+%\cs{DTLidxRank} gets temporarily redefined to \cs{datagidx@rank}
+%when constructing the sort key. An extra dot is added to the end to
+%ensure names without a rank are sorted before identical names with
+%a rank.
+% \begin{macrocode}
+\newcommand*{\datagidx@rank}[2]{#2.}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\DTLgidxParticle}
+%\begin{definition}
+%\cs{DTLgidxParticle}\marg{particle}\marg{surname}
+%\end{definition}
+% A particle such as ``of'', ``de'' or ``von'' should be ignored when sorting.
+% \begin{macrocode}
+\newcommand*{\DTLgidxParticle}[2]{#1~#2}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\datagidx@particle}
+%\cs{DTLidxParticle} gets temporarily redefined to \cs{datagidx@particle}
+%when constructing the sort key. An extra dot is added to the end to
+%ensure names without a particle are sorted before identical names with
+%a particle.
+% \begin{macrocode}
+\newcommand*{\datagidx@particle}[2]{#2.}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\datagidx@bothoftwo}
+% \begin{macrocode}
+\newcommand*{\datagidx@bothoftwo}[2]{#1#2}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\datagidx@person}
+% Used when constructing the sort key for a name.
+% \begin{macrocode}
+\newcommand*{\datagidx@person}[2]{#2\noexpand\datatoolpersoncomma #1}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\datagidx@place}
+% Used when constructing the sort key for a place.
+% \begin{macrocode}
+\newcommand*{\datagidx@place}[2]{#2\noexpand\datatoolplacecomma #1}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\datagidx@subject}
+% Used when constructing the sort key for a place.
+% \begin{macrocode}
+\newcommand*{\datagidx@subject}[2]{#2\noexpand\datatoolsubjectcomma #1}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\datagidx@paren}
+% Used when constructing the sort key for a parenthesis.
+% \begin{macrocode}
+\newcommand*{\datagidx@paren}[1]{\noexpand\datatoolparenstart #1}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\datagidx@invert}
+% \begin{macrocode}
+\newcommand*{\datagidx@invert}[2]{#2, #1}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\DTLgidxParen}
+% Parenthetical material.
+% \begin{macrocode}
+\newcommand*{\DTLgidxParen}[1]{\space(#1)}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\datagidxwordifygreek}
+% Convert commands like \ics{alpha} into words for indexing and
+% labelling purposes.
+% \begin{macrocode}
+\newcommand*{\datagidxwordifygreek}{%
+ \def\alpha{alpha}%
+ \def\beta{beta}%
+ \def\gamma{gamma}%
+ \def\delta{delta}%
+ \def\epsilon{epsilon}%
+ \def\varepsilon{epsilon}%
+ \def\zeta{zeta}%
+ \def\eta{eta}%
+ \def\theta{theta}%
+ \def\vartheta{theta}%
+ \def\iota{iota}%
+ \def\kappa{kappa}%
+ \def\lambda{lambda}%
+ \def\mu{mu}%
+ \def\nu{nu}%
+ \def\xi{xi}%
+ \def\pi{pi}%
+ \def\varpi{pi}%
+ \def\rho{rho}%
+ \def\varrho{rho}%
+ \def\sigma{sigma}%
+ \def\varsigma{sigma}%
+ \def\tau{tau}%
+ \def\upsilon{upsilon}%
+ \def\phi{phi}%
+ \def\varphi{phi}%
+ \def\chi{chi}%
+ \def\psi{psi}%
+ \def\omega{omega}%
+ \def\Gamma{Gamma}%
+ \def\Delta{Delta}%
+ \def\Theta{Theta}%
+ \def\Lambda{Lambda}%
+ \def\Xi{Xi}%
+ \def\Pi{Pi}%
+ \def\Sigma{Sigma}%
+ \def\Upsilon{Upsilon}%
+ \def\Phi{Phi}%
+ \def\Psi{Psi}%
+ \def\Omega{Omega}%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\datagidxstripaccents}
+% Strip accents so they don't interfere with the label and sort.
+% If you want to write your own comparison handler macro, you'll
+% need to redefine this if you want accented letters to be sorted
+% differently from the unaccented version.
+% \begin{macrocode}
+\newcommand*{\datagidxstripaccents}{%
+ \expandafter\def\csname \encodingdefault-cmd\endcsname##1##2##3{##3}%
+ \expandafter\def\csname OT1-cmd\endcsname##1##2##3{##3}%
+ \expandafter\def\csname T1-cmd\endcsname##1##2##3{##3}%
+ \expandafter\def\csname PD1-cmd\endcsname##1##2##3{##3}%
+ \def\IeC##1{\@gobbletwo##1}%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\newterm}
+%\begin{definition}
+% \cs{newterm}\oarg{options}{name}
+%\end{definition}
+% Defaults to normal behaviour.
+% \begin{macrocode}
+\ifdef\newterm
+{%
+}%
+{%
+ \newcommand{\newterm}{\datagidx@newterm}
+}
+% \end{macrocode}
+%\end{macro}
+%
+%May only be used in the preamble. (Terms must be defined before the
+%aux file is read.)
+% \begin{macrocode}
+\@onlypreamble\newterm
+% \end{macrocode}
+%
+%\begin{macro}{\datagidx@setfieldvalues}
+% Sets the values for all the field.
+% \begin{macrocode}
+\newcommand{\datagidx@setfieldvalues}[2]{%
+% \end{macrocode}
+% Set defaults.
+% \begin{macrocode}
+ \def\newterm@name{#2}%
+ \renewcommand*\newterm@label{#2}%
+ \renewcommand*\newterm@text{#2}%
+ \undef\newterm@plural
+ \renewcommand*{\newterm@description}{}%
+ \renewcommand*{\newterm@sort}{#2}%
+ \renewcommand*{\newterm@symbol}{}%
+ \let\newterm@database\datagidx@defaultdatabase
+ \renewcommand*{\newterm@short}{#2}%
+ \undef\newterm@shortplural
+ \renewcommand*{\newterm@long}{#2}%
+ \undef\newterm@longplural
+ \renewcommand*{\newterm@see}{}%
+ \renewcommand*{\newterm@seealso}{}%
+ \renewcommand*{\newterm@parent}{}%
+% \end{macrocode}
+% Allow hook to access other fields.
+% \begin{macrocode}
+ \let\datagidx@orgfield\field
+ \def\field##1{\expandafter\noexpand\csname newterm@##1\endcsname}%
+% \end{macrocode}
+% Hook to make it easier to add extra fields.
+% \begin{macrocode}
+ \newterm@defaultshook
+ \let\field\datagidx@orgfield
+% \end{macrocode}
+% Assign values given in optional argument.
+% \begin{macrocode}
+ \setkeys{newterm}{#1}%
+% \end{macrocode}
+% Temporary redefine commands likely to be contained in the name
+% that may interfere with the label and sort.
+% \begin{macrocode}
+ \bgroup
+% \end{macrocode}
+% Allow users to, say, specify the name as
+% \meta{name}\ics{glsadd}\marg{other label} without having to specify
+% a separate label.
+% \begin{macrocode}
+ \let\glsadd\@gobble
+% \end{macrocode}
+% Strip common formatting commands.
+% \begin{macrocode}
+ \let\MakeUppercase\DTLgidxNoFormat
+ \let\MakeTextUppercase\DTLgidxNoFormat
+ \let\MakeLowercase\DTLgidxNoFormat
+ \let\MakeTextLowercase\DTLgidxNoFormat
+ \let\acronymfont\DTLgidxNoFormat
+ \let\textrm\DTLgidxNoFormat
+ \let\texttt\DTLgidxNoFormat
+ \let\textsf\DTLgidxNoFormat
+ \let\textsc\DTLgidxNoFormat
+ \let\textbf\DTLgidxNoFormat
+ \let\textmd\DTLgidxNoFormat
+ \let\textit\DTLgidxNoFormat
+ \let\textsl\DTLgidxNoFormat
+ \let\emph\DTLgidxNoFormat
+ \let\textsuperscript\DTLgidxNoFormat
+ \let~\space
+ \ifdef\andname
+ {%
+ \let\&\andname
+ }%
+ {%
+ \def\&{and}%
+ }%
+% \end{macrocode}
+% Strip \cs{ensuremath}.
+% \begin{macrocode}
+ \let\ensuremath\DTLgidxNoFormat
+% \end{macrocode}
+% Ensure that inversions are dealt with for the label.
+% \begin{macrocode}
+ \let\DTLgidxParen\@gobble
+ \let\DTLgidxName\@secondoftwo
+ \let\DTLgidxPlace\datagidx@invert
+ \let\DTLgidxSubject\datagidx@invert
+ \let\DTLgidxOffice\@secondoftwo
+ \let\DTLgidxParticle\datagidx@bothoftwo
+% \end{macrocode}
+% Convert Greek maths (such as \cs{alpha}) to text.
+% \begin{macrocode}
+ \datagidxwordifygreek
+% \end{macrocode}
+% Strip accent commands so they don't interfere with the label.
+% \begin{macrocode}
+ \datagidxstripaccents
+% \end{macrocode}
+% Allow user to hook into this.
+% \begin{macrocode}
+ \newtermlabelhook
+ \protected@xdef\newterm@label{\newterm@label}%
+% \end{macrocode}
+% These commands behave differently for the sort key:
+% \begin{macrocode}
+ \let\DTLgidxName\datagidx@person
+ \let\DTLgidxPlace\datagidx@place
+ \let\DTLgidxSubject\datagidx@subject
+ \let\DTLgidxOffice\datagidx@person
+ \let\DTLgidxParen\datagidx@paren
+ \let\DTLgidxMac\datagidx@mac
+ \let\DTLgidxSaint\datagidx@saint
+ \let\DTLgidxIgnore\@gobble
+ \let\DTLgidxRank\datagidx@rank
+ \let\DTLgidxParticle\datagidx@particle
+ \let\DTLgidxNameNum\datagidx@namenum
+ \protected@xdef\newterm@sort{\newterm@sort}%
+ \egroup
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\datagidx@add@term}
+% Add term (once all fields have been set. Argument is the name
+% field.
+% \begin{macrocode}
+\newcommand*{\datagidx@add@term}[1]{%
+ \global\cslet{datagidxentry@\newterm@label}{\newterm@database}%
+ \DTLnewrow{\newterm@database}%
+ \DTLnewdbentry{\newterm@database}{Name}{#1}%
+ \DTLnewdbentry{\newterm@database}{Used}{0}%
+ {%
+ \dtlexpandnewvalue
+ \DTLnewdbentry{\newterm@database}{Text}{\expandonce\newterm@text}%
+ \DTLnewdbentry{\newterm@database}{Description}{\expandonce\newterm@description}%
+ \DTLnewdbentry{\newterm@database}{Label}{\expandonce\newterm@label}%
+ \DTLnewdbentry{\newterm@database}{Sort}{\expandonce\newterm@sort}%
+ \DTLnewdbentry{\newterm@database}{Symbol}{\expandonce\newterm@symbol}%
+ \DTLnewdbentry{\newterm@database}{Short}{\expandonce\newterm@short}%
+ \DTLnewdbentry{\newterm@database}{Long}{\expandonce\newterm@long}%
+ \ifundef\newterm@plural
+ {%
+ \DTLnewdbentry{\newterm@database}{Plural}{\expandonce\newterm@text s}%
+ }%
+ {%
+ \DTLnewdbentry{\newterm@database}{Plural}{\expandonce\newterm@plural}%
+ }%
+ \ifundef\newterm@shortplural
+ {%
+ \DTLnewdbentry{\newterm@database}{ShortPlural}{\expandonce\newterm@short s}%
+ }%
+ {%
+ \DTLnewdbentry{\newterm@database}{ShortPlural}{\expandonce\newterm@shortplural}%
+ }%
+ \ifundef\newterm@longplural
+ {%
+ \DTLnewdbentry{\newterm@database}{LongPlural}{\expandonce\newterm@long s}%
+ }%
+ {%
+ \DTLnewdbentry{\newterm@database}{LongPlural}{\expandonce\newterm@longplural}%
+ }%
+ \ifdefempty{\newterm@see}%
+ {}%
+ {\DTLnewdbentry{\newterm@database}{See}{\newterm@see}}%
+ \ifdefempty{\newterm@seealso}%
+ {}%
+ {\DTLnewdbentry{\newterm@database}{SeeAlso}{\newterm@seealso}}%
+% \end{macrocode}
+% Hook to make it easier to add extra fields.
+% \begin{macrocode}
+ \newterm@extrafields
+% \end{macrocode}
+% Add parent, if supplied.
+% \begin{macrocode}
+ \ifdefempty{\newterm@parent}%
+ {}%
+ {%
+ \iftermexists{\newterm@parent}%
+ {%
+ \edef\newterm@parentdatabase{\csuse{datagidxentry@\newterm@parent}}%
+% \end{macrocode}
+% Parent entry must belong to same database as child entry.
+% \begin{macrocode}
+ \ifthenelse{\equal{\newterm@parentdatabase}{\newterm@database}}
+ {%
+ \DTLnewdbentry{\newterm@database}{Parent}{\newterm@parent}%
+ \datagidx@addchild{\newterm@database}{\newterm@parent}{\newterm@label}%
+ }%
+ {%
+ \PackageError{datagidx}%
+ {%
+ Parent entry `\newterm@parent' must belong to the
+ same database as child entry `\newterm@label'%
+ }%
+ {%
+ Parent entry is in database
+ `\newterm@parentdatabase' and child entry is in
+ database `\newterm@database'%
+ }%
+ }%
+ }%
+ {%
+ \PackageError{datagidx}%
+ {%
+ Can't assign parent to `\newterm@label':
+ `\newterm@parent' doesn't exist%
+ }%
+ {}%
+ }%
+ }%
+ }%
+% \end{macrocode}
+% Provide user with a means to access the label of the latest defined
+% term:
+% \begin{macrocode}
+ \global\let\datagidxlastlabel\newterm@label
+}%
+%\end{macro}
+%
+%\begin{macro}{\datagidx@newterm}
+% Normal behaviour for \cs{newterm}
+% \begin{macrocode}
+\newcommand{\datagidx@newterm}[2][]{%
+% \end{macrocode}
+% Assign values to all the fields.
+% \begin{macrocode}
+ \datagidx@setfieldvalues{#1}{#2}%
+% \end{macrocode}
+% Check if database exists.
+% \begin{macrocode}
+ \DTLifdbexists{\newterm@database}%
+ {%
+% \end{macrocode}
+% Database exists. Check if term already exists.
+% \begin{macrocode}
+ \iftermexists{\newterm@label}%
+ {%
+ \PackageError{datagidx}{Term `\newterm@label' already
+ exists in database `\newterm@database'}{}%
+ }%
+ {%
+% \end{macrocode}
+% Add this entry to the database.
+% \begin{macrocode}
+ \datagidx@add@term{#2}%
+ }%
+ }%
+ {%
+% \end{macrocode}
+% Database doesn't exist.
+% \begin{macrocode}
+ \PackageError{datagidx}%
+ {Glossary/index data base `\newterm@database' doesn't exist}%
+ {%
+ You must define the glossary/index data base before you can
+ add any terms to it.%
+ }%
+ }%
+}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\datagidx@highopt@newterm}
+% Used when high optimized setting enabled. This setting must be
+% switched off if the user wants to modify the database.
+% \begin{macrocode}
+\newcommand{\datagidx@highopt@newterm}[2][]{%
+% \end{macrocode}
+% Assign values to all the fields.
+% \begin{macrocode}
+ \datagidx@setfieldvalues{#1}{#2}%
+% \end{macrocode}
+% Check if database exists.
+% \begin{macrocode}
+ \DTLifdbexists{\newterm@database}%
+ {%
+% \end{macrocode}
+% Database exists. If this is the first run, we need to add the term
+% as usual, otherwise we just need to define
+% \cs{datagidxentry@}\meta{label}
+% \begin{macrocode}
+ \edef\dtl@dogetrow{%
+ \noexpand\dtlgetrowindex
+ {\noexpand\dtl@rowidx}%
+ {\newterm@database}%
+ {%
+ \dtlcolumnindex{\newterm@database}{Label}%
+ }%
+ {\newterm@label}}%
+ \dtl@dogetrow
+ \ifx\dtl@rowidx\dtlnovalue
+% \end{macrocode}
+% Hasn't been defined so add.
+% \begin{macrocode}
+ \datagidx@add@term{#2}%
+% \end{macrocode}
+% Database will need to be sorted.
+% \begin{macrocode}
+ \csdef{datagidx@do@highopt@sort@\newterm@database}{\datagidx@sort}%
+ \else
+% \end{macrocode}
+% Has been defined, so just define \cs{datagidxentry@}\meta{label}
+% and \cs{datagidxlastlabel}
+% \begin{macrocode}
+ \global\cslet{datagidxentry@\newterm@label}{\newterm@database}%
+ \global\let\datagidxlastlabel\newterm@label
+ \fi
+ }%
+ {%
+% \end{macrocode}
+% Database doesn't exist.
+% \begin{macrocode}
+ \PackageError{datagidx}%
+ {Glossary/index data base `\newterm@database' doesn't exist}%
+ {%
+ You must define the glossary/index data base before you can
+ add any terms to it.%
+ }%
+ }%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%
+%\begin{macro}{\datagidx@addchild}
+% \begin{macrocode}
+\newcommand*{\datagidx@addchild}[3]{%
+ \edef\dtl@dogetrow{%
+ \noexpand\dtlgetrowforvalue
+ {#1}%
+ {%
+ \dtlcolumnindex{\newterm@database}{Label}%
+ }%
+ {#2}}%
+ \dtl@dogetrow
+ \dtlgetentryfromcurrentrow
+ {\datagidx@child}%
+ {\dtlcolumnindex{#1}{Child}}%
+ \ifx\datagidx@child\dtlnovalue
+ \edef\datagidx@child{#3}%
+ \else
+ \edef\datagidx@child{\datagidx@child,#3}%
+ \fi
+ \edef\do@update{\noexpand\dtlupdateentryincurrentrow
+ {Child}{\datagidx@child}}%
+ \do@update
+ \dtlrecombine
+}
+% \end{macrocode}
+%\end{macro}
+%\subsection{Defining Acronyms}
+%\begin{macro}{\newacro}
+%\begin{definition}
+%\cs{newacro}\oarg{options}\marg{short}\marg{long}
+%\end{definition}
+% Shortcut command for acronyms.
+% \begin{macrocode}
+\newcommand{\newacro}[3][]{%
+ \newterm
+ [%
+ description={\capitalisewords{#3}},%
+ short={\acronymfont{#2}},%
+ long={#3},%
+ text={\DTLgidxAcrStyle{#3}{\acronymfont{#2}}},%
+ plural={\DTLgidxAcrStyle{#3s}{\acronymfont{#2s}}},%
+ sort={#2},%
+ #1%
+ ]%
+ {\MakeTextUppercase{#2}}%
+}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\acronymfont}
+% The font to use for the acronym.
+% \begin{macrocode}
+\newcommand*{\acronymfont}[1]{#1}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\DTLgidxAcrStyle}
+%\begin{definition}
+%\cs{DTLgidxAcrStyle}\marg{long}\marg{short}
+%\end{definition}
+% \begin{macrocode}
+\newcommand*{\DTLgidxAcrStyle}[2]{#1 (#2)}
+% \end{macrocode}
+%\end{macro}
+%
+%
+%\section{Conditionals}
+%
+%\begin{macro}{\iftermexists}
+%\begin{definition}
+% \cs{iftermexists}\marg{label}\marg{true part}\marg{false part}
+%\end{definition}
+% Check if term with given label exists.
+% \begin{macrocode}
+\newcommand{\iftermexists}[3]{%
+ \ifcsdef{datagidxentry@#1}{#2}{#3}%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\ifentryused}
+%\begin{definition}
+% \cs{ifentryused}\marg{label}\marg{true part}\marg{false part}
+%\end{definition}
+% Check if entry with given label has been used.
+% \begin{macrocode}
+\newcommand*{\ifentryused}[3]{%
+ \letcs{\newterm@database}{datagidxentry@#1}%
+% \end{macrocode}
+% \cs{dtlgetrowforvalue} doesn't expand the value when it checks for
+% a match, so make sure label is fully expanded.
+% \begin{macrocode}
+ \edef\dtl@dogetrow{%
+ \noexpand\dtlgetrowforvalue
+ {\newterm@database}%
+ {%
+ \dtlcolumnindex{\newterm@database}{Label}%
+ }%
+ {#1}}%
+ \dtl@dogetrow
+ \dtlgetentryfromcurrentrow
+ {\datagidx@value}%
+ {\dtlcolumnindex{\newterm@database}{Used}}%
+ \ifnum\datagidx@value=1\relax
+ #2%
+ \else
+ #3%
+ \fi
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\section{Unsetting and Resetting}
+%
+%\begin{macro}{\glsreset}
+%\begin{definition}
+%\cs{glsunset}\marg{label}
+%\end{definition}
+% Mark as un-used.
+% \begin{macrocode}
+\newcommand*{\glsreset}[1]{%
+% \end{macrocode}
+% Fetch the name of the database with which this entry is
+% associated.
+% \begin{macrocode}
+ \letcs{\newterm@database}{datagidxentry@#1}%
+% \end{macrocode}
+% Get the row associated with this label and make it the current row.
+% \begin{macrocode}
+ \edef\do@getrow{%
+ \noexpand\dtlgetrowforvalue
+ {\newterm@database}%
+ {\dtlcolumnindex{\newterm@database}{Label}}%
+ {#1}%
+ }%
+ \do@getrow
+% \end{macrocode}
+% Update the "Used" field.
+% \begin{macrocode}
+ \dtlreplaceentryincurrentrow
+ {0}{\dtlcolumnindex{\newterm@database}{Used}}%
+% \end{macrocode}
+% Current row has been edited, so we need to merge the current row
+% back into the database.
+% \begin{macrocode}
+ \dtlrecombine
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\glsunset}
+%\begin{definition}
+%\cs{glsunset}\marg{label}
+%\end{definition}
+% Mark as used without affecting location.
+% \begin{macrocode}
+\newcommand*{\glsunset}[1]{%
+% \end{macrocode}
+% Fetch the name of the database with which this entry is
+% associated.
+% \begin{macrocode}
+ \letcs{\newterm@database}{datagidxentry@#1}%
+% \end{macrocode}
+% Get the row associated with this label and make it the current row.
+% \begin{macrocode}
+ \edef\do@getrow{%
+ \noexpand\dtlgetrowforvalue
+ {\newterm@database}%
+ {\dtlcolumnindex{\newterm@database}{Label}}%
+ {#1}%
+ }%
+ \do@getrow
+% \end{macrocode}
+% Update the "Used" field.
+% \begin{macrocode}
+ \dtlreplaceentryincurrentrow
+ {1}{\dtlcolumnindex{\newterm@database}{Used}}%
+% \end{macrocode}
+% Current row has been edited, so we need to merge the current row
+% back into the database.
+% \begin{macrocode}
+ \dtlrecombine
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\glsresetall}
+%\begin{definition}
+%\cs{glsresetall}\marg{db}
+%\end{definition}
+% Resets all entries in the given database.
+% \begin{macrocode}
+\newcommand*{\glsresetall}[1]{%
+ \def\datagidx@list{}%
+ \dtlforcolumn{\datagidx@label}{#1}{Label}%
+ {%
+ \ifdefempty\datagidx@list
+ {%
+ \let\datagidx@list\datagidx@label
+ }%
+ {%
+ \eappto\datagidx@list{,\datagidx@label}%
+ }%
+ }%
+ \@for\datagidx@thislabel:=\datagidx@list\do
+ {%
+ \glsreset{\datagidx@thislabel}%
+ }%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\glsunsetall}
+%\begin{definition}
+%\cs{glsunsetall}\marg{db}
+%\end{definition}
+% Resets all entries in the given database.
+% \begin{macrocode}
+\newcommand*{\glsunsetall}[1]{%
+ \def\datagidx@list{}%
+ \dtlforcolumn{\datagidx@label}{#1}{Label}%
+ {%
+ \ifdefempty\datagidx@list
+ {%
+ \let\datagidx@list\datagidx@label
+ }%
+ {%
+ \eappto\datagidx@list{,\datagidx@label}%
+ }%
+ }%
+ \@for\datagidx@thislabel:=\datagidx@list\do
+ {%
+ \glsunset{\datagidx@thislabel}%
+ }%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\section{Accessing Entry Information}
+%
+%\begin{macro}{\datagidx@anchorcount}
+% Register to make unique anchors.
+% \begin{macrocode}
+\newcount\datagidx@anchorcount
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\datagidx@formatanchor}
+% Format number using six digits.
+% \begin{macrocode}
+\newcommand*{\datagidx@formatanchor}[1]{%
+ \ifnum#1<10000
+ 0%
+ \ifnum#1<1000
+ 0%
+ \ifnum#1<100
+ 0%
+ \ifnum#1<10
+ 0%
+ \fi
+ \fi
+ \fi
+ \fi
+ \number#1%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\@datagidx@escloc}
+% \begin{macrocode}
+\newcommand*{\@datagidx@escloc}[2]{%
+ \expandafter\string\csname#1\endcsname{\noexpand\number#2}%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\datagidx@escapelocation}
+% \begin{macrocode}
+\newcommand*{\datagidx@escapelocation}{%
+ \def\@arabic{\@datagidx@escloc{@arabic}}%
+ \def\@roman{\@datagidx@escloc{@roman}}%
+ \def\@Roman{\@datagidx@escloc{@Roman}}%
+ \def\@alph{\@datagidx@escloc{@alph}}%
+ \def\@Alph{\@datagidx@escloc{@Alph}}%
+}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\datagidx@escapelocationformat}
+% \begin{macrocode}
+\newcommand*{\datagidx@escapelocationformat}{%
+ \def\@arabic##1{arabic}%
+ \def\@roman##1{roman}%
+ \def\@Roman##1{Roman}%
+ \def\@alph##1{alph}%
+ \def\@Alph##1{Alph}%
+}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\datagidx@clearlocationformat}
+% \begin{macrocode}
+\newcommand*{\datagidx@clearlocationformat}{%
+ \let\@arabic\@firstofone
+ \let\@roman\@firstofone
+ \let\@Roman\@firstofone
+ \let\@alph\@firstofone
+ \let\@Alph\@firstofone
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\DTLgidxAddLocationType}
+% Allow user to add their own location type. Argument must be
+% control sequence name without initial backslash.
+% \begin{macrocode}
+\newcommand*{\DTLgidxAddLocationType}[1]{%
+ \gappto\datagidx@escapelocation{%
+ \expandafter\def\csname#1\endcsname{\@datagidx@escloc{#1}}%
+ }%
+ \gappto\datagidx@escapelocationformat{%
+ \expandafter\def\csname#1\endcsname##1{#1}%
+ }%
+ \gappto\datagidx@clearlocationformat{%
+ \expandafter\let\csname#1\endcsname\@firstofone
+ }%
+}
+% \end{macrocode}
+% May only be used in the preamble. (Needs to be set before the aux
+% file is read.)
+% \begin{macrocode}
+\@onlypreamble\DTLgidxAddLocationType
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\datagidx@target}
+%\begin{definition}
+%\cs{datagidx@target}\marg{label}\marg{format}\marg{location}\marg{text}
+%\end{definition}
+% Make a target if \cs{hypertarget} has been defined.
+% \begin{macrocode}
+\newcommand*{\datagidx@target}[4]{%
+ \global\advance\datagidx@anchorcount by 1\relax
+ \edef\@datagidx@target{datagidx.\datagidx@formatanchor\datagidx@anchorcount}%
+ \ifstrempty{#3}
+ {%
+ \datagidx@write@usedentry{#1}{}%
+ }%
+ {%
+ \bgroup
+ \datagidx@escapelocation
+ \protected@edef\@datagidx@dowriteaux{%
+ \noexpand\datagidx@write@usedentry{#1}%
+ {[#2]{#3}{\@datagidx@target}}%
+ }%
+ \@datagidx@dowriteaux
+ \egroup
+ }%
+ \ifdef\hypertarget
+ {%
+% \end{macrocode}
+% Make sure the current line doesn't scroll off the top of the
+% screen.
+% \begin{macrocode}
+ \datagidxshowifdraft
+ {%
+ [\@datagidx@target]%
+ \discretionary{}{}{}%
+ }%
+ \bgroup
+ \let\glsadd\@gobble
+ \settoheight\dimen@{#4}%
+ \raisebox{\dimen@}%
+ {%
+ \datagidxtarget{\@datagidx@target}{}%
+ }%
+ \egroup
+ }%
+ {%
+ }%
+ \datagidxshowifdraft{[#1]\discretionary{}{}{}}%
+ #4%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\glsdispentry}
+%\begin{definition}
+%\cs{glsdispentry}\marg{label}\marg{field}
+%\end{definition}
+% Short cut that fetches and displays a value.
+% \begin{macrocode}
+\DeclareRobustCommand*{\glsdispentry}[2]{%
+ \DTLgidxFetchEntry{\datagidx@dispentryval}{#1}{#2}%
+ \datagidx@dispentryval
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\Glsdispentry}
+%\begin{definition}
+%\cs{Glsdispentry}\marg{label}\marg{field}
+%\end{definition}
+% As previous but makes the first letter upper case.
+% \begin{macrocode}
+\DeclareRobustCommand*{\Glsdispentry}[2]{%
+ \DTLgidxFetchEntry{\datagidx@dispentryval}{#1}{#2}%
+ \xmakefirstuc\datagidx@dispentryval
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\DTLgidxFetchEntry}
+% Fetch value for the given field for the term identified by
+% \meta{label} and store the value in \meta{cs} (a control sequence).
+% \begin{macrocode}
+\newcommand*{\DTLgidxFetchEntry}[3]{%
+% \end{macrocode}
+% Does this entry exist?
+% \begin{macrocode}
+ \ifcsdef{datagidxentry@#2}%
+ {%
+% \end{macrocode}
+% Fetch the name of the database with which this entry is
+% associated.
+% \begin{macrocode}
+ \letcs{\newterm@database}{datagidxentry@#2}%
+% \end{macrocode}
+% Get the row associated with this label and make it the current row.
+% \begin{macrocode}
+ \edef\do@getrow{%
+ \noexpand\dtlgetrowforvalue
+ {\newterm@database}%
+ {\dtlcolumnindex{\newterm@database}{Label}}%
+ {#2}%
+ }%
+ \do@getrow
+% \end{macrocode}
+% Get the entry for the given field in the current row and store in
+% \meta{cs}.
+% \begin{macrocode}
+ \dtlgetentryfromcurrentrow
+ {#1}%
+ {\dtlcolumnindex{\newterm@database}{#3}}%
+ }%
+ {%
+% \end{macrocode}
+% Entry hasn't been defined.
+% \begin{macrocode}
+ \PackageError{datagidx}{No term `#2' defined}{}%
+ }%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\datagidx@parse@formatlabel}
+%\begin{definition}
+%\cs{parse@formatlabel}\marg{\oarg{format}label}
+%\end{definition}
+% Separate format and label from argument.
+% \begin{macrocode}
+\newcommand*{\datagidx@parse@formatlabel}[1]{%
+ \datagidx@parse@format@label@#1\@endparse@formatlabel@
+}
+\newcommand*\datagidx@parse@format@label@{%
+ \@ifnextchar[{\datagidx@parse@formatlabel@}{\datagidx@parse@formatlabel@[]}%
+}
+\def\datagidx@parse@formatlabel@[#1]#2\@endparse@formatlabel@{%
+ \def\datagidx@format{#1}%
+ \def\datagidx@label{#2}%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\datagidx@use@entry}
+%\begin{definition}
+%\cs{use@entry}\marg{field}\marg{link text}
+%\end{definition}
+% The label and format should have been stored in
+% \cs{datagidx@label} and \cs{datagidx@format} before calling this
+% macro.
+% \begin{macrocode}
+\newcommand*{\datagidx@use@entry}[2]{%
+% \end{macrocode}
+% Does this term exist?
+% \begin{macrocode}
+ \ifcsundef{datagidxentry@\datagidx@label}
+ {%
+ \PackageError{datagidx}{Entry `\datagidx@label' doesn't exist}{}%
+ }%
+ {%
+% \end{macrocode}
+% Fetch the name of the database with which this entry is
+% associated.
+% \begin{macrocode}
+ \letcs{\newterm@database}{datagidxentry@\datagidx@label}%
+% \end{macrocode}
+% Get the row associated with this label and make it the current row.
+% \begin{macrocode}
+ \edef\do@getrow{%
+ \noexpand\dtlgetrowforvalue
+ {\newterm@database}%
+ {\dtlcolumnindex{\newterm@database}{Label}}%
+ {\datagidx@label}%
+ }%
+ \do@getrow
+% \end{macrocode}
+% Get the entry for the "FirstId" field and store in \cs{datagidx@id}
+% \begin{macrocode}
+ \dtlgetentryfromcurrentrow
+ {\datagidx@id}%
+ {\dtlcolumnindex{\newterm@database}{FirstId}}%
+% \end{macrocode}
+% If it hasn't been defined set it.
+% \begin{macrocode}
+ \DTLifnull\datagidx@id
+ {%
+% \end{macrocode}
+% Count register hasn't been updated yet.
+% \begin{macrocode}
+ \count@=\datagidx@anchorcount\relax
+ \advance\count@ by 1\relax
+ \dtlappendentrytocurrentrow{FirstId}{\datagidx@formatanchor\count@}%
+ }%
+ {}%
+% \end{macrocode}
+% Get the entry for the given field in the current row and store in
+% \cs{datagidx@value}.
+% \begin{macrocode}
+ \dtlgetentryfromcurrentrow
+ {\datagidx@value}%
+ {\dtlcolumnindex{\newterm@database}{#1}}%
+% \end{macrocode}
+% Update the "Used" field.
+% \begin{macrocode}
+ \dtlreplaceentryincurrentrow
+ {1}{\dtlcolumnindex{\newterm@database}{Used}}%
+% \end{macrocode}
+% Get the parent entry label (if one exists).
+% \begin{macrocode}
+ \dtlgetentryfromcurrentrow
+ {\datagidx@parent}%
+ {\dtlcolumnindex{\newterm@database}{Parent}}%
+% \end{macrocode}
+% Current row has been edited, so we need to merge the current row
+% back into the database.
+% \begin{macrocode}
+ \dtlrecombine
+% \end{macrocode}
+% If parent hasn't be used, give it an empty location.
+% \begin{macrocode}
+ \datagidx@markparent{\newterm@database}{\datagidx@parent}%
+% \end{macrocode}
+% Write the location to the auxiliary file and display value of
+% field.
+% \begin{macrocode}
+ \datagidx@target{\datagidx@label}{\datagidx@format}%
+ {\csuse{the\DTLgidxCounter}}{#2}%
+ }%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\DTLgidxCounter}
+% The counter used for the location lists.
+% \begin{macrocode}
+\newcommand*{\DTLgidxCounter}{page}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\datagidx@markparent}
+% Assign empty location to parent, if location of that parent is null.
+% (Recursive).
+% \begin{macrocode}
+\newcommand*{\datagidx@markparent}[2]{%
+ \ifx#2\dtlnovalue
+% \end{macrocode}
+% Null parent, so break out of recursion.
+% \begin{macrocode}
+ \else
+% \end{macrocode}
+% Write empty location to the auxiliary file.
+% \begin{macrocode}
+ \datagidx@target{#2}{}{}{}%
+% \end{macrocode}
+% Fetch this parent's parent entry.
+% Get the row associated with this and make it the current row.
+% \begin{macrocode}
+ \edef\do@getrow{%
+ \noexpand\dtlgetrowforvalue
+ {#1}%
+ {\dtlcolumnindex{#1}{Label}}%
+ {#2}}%
+ \do@getrow
+% \end{macrocode}
+% Get the entry for the "FirstId" field and store in \cs{datagidx@id}
+% \begin{macrocode}
+ \dtlgetentryfromcurrentrow
+ {\datagidx@id}%
+ {\dtlcolumnindex{\newterm@database}{FirstId}}%
+% \end{macrocode}
+% If it hasn't been defined set it.
+% \begin{macrocode}
+ \DTLifnull\datagidx@id
+ {%
+ \dtlappendentrytocurrentrow{FirstId}{\datagidx@formatanchor\datagidx@anchorcount}%
+ }%
+ {}%
+% \end{macrocode}
+% Get the parent
+% \begin{macrocode}
+ \dtlgetentryfromcurrentrow
+ {\datagidx@parent}%
+ {\dtlcolumnindex{#1}{Parent}}%
+% \end{macrocode}
+% Current row has been edited, so we need to merge the current row
+% back into the database.
+% \begin{macrocode}
+ \dtlrecombine
+% \end{macrocode}
+% Recurse
+% \begin{macrocode}
+ \datagidx@markparent{#1}{\datagidx@parent}%
+ \fi
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\datagidx@write@usedentry}
+% Write out location to aux file and add location to the location
+% list for the current run.
+% \begin{macrocode}
+\newcommand*{\datagidx@write@usedentry}[2]{%
+% \end{macrocode}
+% Do update if `highopt optimize' setting is on.
+% \begin{macrocode}
+ \datagidx@do@highopt@update{#1}%
+% \end{macrocode}
+% Write out location to aux file.
+% \begin{macrocode}
+ \protected@write{\@auxout}{}%
+ {%
+ \string\datagidx@usedentry{#1}{#2}%
+ }%
+% \end{macrocode}
+% Add to this run's location field.
+% \begin{macrocode}
+ \protected@edef\datagidx@do@usedentry{%
+ \noexpand\datagidx@usedentry[CurrentLocation]{#1}{#2}%
+ }%
+ \datagidx@do@usedentry
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\datagidx@usedentry}
+%\begin{definition}
+%\cs{datagidx@usedentry}\oarg{location tag}\marg{label}\marg{location}
+%\end{definition}
+% Add to the location list for the given entry.
+% \begin{macrocode}
+\newcommand*{\datagidx@usedentry}[3][Location]{%
+% \end{macrocode}
+% Check if label exists. (It may have been deleted or had a label
+% change.)
+% \begin{macrocode}
+ \ifcsundef{datagidxentry@#2}%
+ {%
+ \PackageWarning{datagidx}{No term `#2' defined. Ignoring}%
+ }%
+ {%
+% Fetch the name of the database with which this entry is
+% associated.
+% \begin{macrocode}
+ \letcs{\newterm@database}{datagidxentry@#2}%
+% \end{macrocode}
+% Get the row associated with this label and make it the current row.
+% \begin{macrocode}
+ \edef\do@getrow{%
+ \noexpand\dtlgetrowforvalue
+ {\newterm@database}%
+ {\dtlcolumnindex{\newterm@database}{Label}}%
+ {#2}%
+ }%
+ \do@getrow
+% \end{macrocode}
+% \begin{macrocode}
+% Get the entry for the \meta{location tag} field in the current row and store in
+% \cs{datagidx@loc}.
+% \begin{macrocode}
+ \dtlgetentryfromcurrentrow
+ {\datagidx@loc}%
+ {\dtlcolumnindex{\newterm@database}{#1}}%
+% \end{macrocode}
+% Check the success of the previous command.
+% \begin{macrocode}
+ \ifx\datagidx@loc\dtlnovalue
+% \end{macrocode}
+% There's no \meta{location tag} field in the current row, so add one with
+% the given location.
+% \begin{macrocode}
+ \def\datagidx@loc{#3}%
+ \dtlappendentrytocurrentrow{#1}{\expandonce\datagidx@loc}%
+ \else
+% \end{macrocode}
+% There is a \meta{location tag} field in the current row, so append the
+% given location to the list, unless one or the other is empty.
+% \begin{macrocode}
+ \ifdefempty{\datagidx@loc}%
+ {%
+ \def\datagidx@loc{#3}%
+ }%
+ {%
+ \ifstrempty{#3}%
+ {}%
+ {%
+ \appto\datagidx@loc{,#3}%
+ }%
+ }%
+% \end{macrocode}
+% and update the entry in the current row.
+% \begin{macrocode}
+ \expandafter\dtlreplaceentryincurrentrow\expandafter
+ {\datagidx@loc}%
+ {\dtlcolumnindex{\newterm@database}{#1}}%
+ \fi
+% \end{macrocode}
+% Current row has been edited, so we need to merge the current row
+% back into the database.
+% \begin{macrocode}
+ \dtlrecombine
+ }%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\datagidx@save@loc}
+% Store the current location from the previous run.
+% \begin{macrocode}
+\newcommand*{\datagidx@save@loc}[2]{%
+ \bgroup
+ \datagidx@escapelocation
+ \xdef\datagidx@tmp{#2}%
+ \egroup
+ \expandafter\xdef\csname datagidx@prev@loc@#1\endcsname{\datagidx@tmp}%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\glsadd}
+%\begin{definition}
+%\cs{glsadd}\marg{\oarg{format}label}
+%\end{definition}
+% \begin{macrocode}
+\newcommand*{\glsadd}[1]{%
+ \NoCaseChange{\@glsadd{#1}}%
+}
+\DeclareRobustCommand*{\@glsadd}[1]{%
+% \end{macrocode}
+% Check term has been defined.
+% \begin{macrocode}
+ \ifcsundef{datagidxentry@\datagidx@label}%
+ {%
+ \PackageError{datagidx}{Term `\datagidx@label' doesn't exist}{}%
+ }%
+ {%
+% \end{macrocode}
+% \begin{macrocode}
+ \datagidx@parse@formatlabel{#1}%
+% \end{macrocode}
+% Write the location to the auxiliary file.
+% \begin{macrocode}
+ \datagidx@target{\datagidx@label}{\datagidx@format}%
+ {\csuse{the\DTLgidxCounter}}{}%
+% \end{macrocode}
+% Fetch the name of the database with which this entry is
+% associated.
+% \begin{macrocode}
+ \letcs{\newterm@database}{datagidxentry@\datagidx@label}%
+% \end{macrocode}
+% Get the row associated with this label and make it the current row.
+% \begin{macrocode}
+ \edef\do@getrow{%
+ \noexpand\dtlgetrowforvalue
+ {\newterm@database}%
+ {\dtlcolumnindex{\newterm@database}{Label}}%
+ {\datagidx@label}%
+ }%
+ \do@getrow
+% \end{macrocode}
+% Update the "Used" field.
+% \begin{macrocode}
+ \dtlreplaceentryincurrentrow
+ {1}{\dtlcolumnindex{\newterm@database}{Used}}%
+% \end{macrocode}
+% Get the entry for the "FirstId" field and store in \cs{datagidx@id}
+% \begin{macrocode}
+ \dtlgetentryfromcurrentrow
+ {\datagidx@id}%
+ {\dtlcolumnindex{\newterm@database}{FirstId}}%
+% \end{macrocode}
+% If it hasn't been defined set it.
+% \begin{macrocode}
+ \DTLifnull\datagidx@id
+ {%
+ \dtlappendentrytocurrentrow{FirstId}{\datagidx@formatanchor\datagidx@anchorcount}%
+ }%
+ {}%
+% \end{macrocode}
+% Current row has been edited, so we need to merge the current row
+% back into the database.
+% \begin{macrocode}
+ \dtlrecombine
+ }%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\datagidx@count}
+% Loop counter used by \cs{glsaddall}
+% \begin{macrocode}
+\newcount\datagidx@count
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\glsaddall}
+%\begin{definition}
+%\cs{glsaddall}\marg{db}
+%\end{definition}
+% Adds all entries in the given database.
+% \begin{macrocode}
+\newcommand*{\glsaddall}[1]{%
+ \DTLifdbexists{#1}%
+ {%
+ \edef\datagidx@rowcount{\number\DTLrowcount{#1}}%
+ \datagidx@count=0\relax
+ \loop
+ \advance\datagidx@count by 1\relax
+ \dtlgetrow{#1}{\datagidx@count}%
+% \end{macrocode}
+% Get the label for this row.
+% \begin{macrocode}
+ \dtlgetentryfromcurrentrow
+ {\datagidx@label}%
+ {\dtlcolumnindex{\newterm@database}{Label}}%
+% \end{macrocode}
+% Write blank location to the auxiliary file but temporarily undefine
+% \cs{hypertarget} as it doesn't make sense to have a target here.
+% \begin{macrocode}
+ \bgroup
+ \undef\hypertarget
+ \datagidx@target{\datagidx@label}{}{}{}%
+ \egroup
+% \end{macrocode}
+% Update the "Used" field.
+% \begin{macrocode}
+ \dtlreplaceentryincurrentrow
+ {1}{\dtlcolumnindex{\newterm@database}{Used}}%
+% \end{macrocode}
+% Get the entry for the "FirstId" field and store in \cs{datagidx@id}
+% \begin{macrocode}
+ \dtlgetentryfromcurrentrow
+ {\datagidx@id}%
+ {\dtlcolumnindex{\newterm@database}{FirstId}}%
+% \end{macrocode}
+% If it hasn't been defined set it.
+% \begin{macrocode}
+ \DTLifnull\datagidx@id
+ {%
+ \dtlappendentrytocurrentrow{FirstId}{\datagidx@formatanchor\datagidx@anchorcount}%
+ }%
+ {}%
+% \end{macrocode}
+% Current row has been edited, so we need to merge the current row
+% back into the database.
+% \begin{macrocode}
+ \dtlrecombine
+% \end{macrocode}
+% Repeat loop if not finished.
+% \begin{macrocode}
+ \ifnum\datagidx@count<\datagidx@rowcount
+ \repeat
+ }%
+ {%
+ \PackageError{datagidx}{Database `#1' doesn't exist}{}%
+ }%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%
+%\begin{macro}{\useentry}
+%\begin{definition}
+%\cs{useentry}\marg{label}\marg{field}
+%\end{definition}
+% Fetch and use the given field for the given entry.
+% \begin{macrocode}
+\DeclareRobustCommand*{\useentry}[2]{%
+ \datagidx@parse@formatlabel{#1}%
+ \DTLgidxFetchEntry{\datagidx@value}{\datagidx@label}{#2}%
+ \datagidxlink{\datagidx@label}%
+ {%
+ \datagidx@use@entry{#2}{\datagidx@value}%
+ }%
+}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\Useentry}
+%\begin{definition}
+%\cs{Useentry}\marg{label}\marg{field}
+%\end{definition}
+% As \cs{useentry}, but capitalise the first word.
+% \begin{macrocode}
+\DeclareRobustCommand*{\Useentry}[2]{%
+ \datagidx@parse@formatlabel{#1}%
+ \DTLgidxFetchEntry{\datagidx@value}{\datagidx@label}{#2}%
+ \datagidxlink{\datagidx@label}%
+ {%
+ \datagidx@use@entry{#2}{\xmakefirstuc{\datagidx@value}}%
+ }%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\USEentry}
+%\begin{definition}
+%\cs{USEentry}\marg{label}\marg{field}
+%\end{definition}
+% As \cs{useentry}, but make the whole term upper case.
+% \begin{macrocode}
+\DeclareRobustCommand*{\USEentry}[2]{%
+ \datagidx@parse@formatlabel{#1}%
+ \DTLgidxFetchEntry{\datagidx@value}{\datagidx@label}{#2}%
+ \datagidxlink{\datagidx@label}%
+ {%
+ \datagidx@use@entry{#2}{\MakeTextUppercase{\datagidx@value}}%
+ }%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\useentrynl}
+%\begin{definition}
+%\cs{useentrynl}\marg{label}\marg{field}
+%\end{definition}
+% Fetch and use the given field for the given entry without creating
+% a hyperlink.
+% \begin{macrocode}
+\DeclareRobustCommand*{\useentrynl}[2]{%
+ \datagidx@parse@formatlabel{#1}%
+ \DTLgidxFetchEntry{\datagidx@value}{\datagidx@label}{#2}%
+ \datagidx@use@entry{#2}{\datagidx@value}%
+}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\Useentrynl}
+%\begin{definition}
+%\cs{Useentrynl}\marg{label}\marg{field}
+%\end{definition}
+% As \cs{useentry}, but capitalise the first word.
+% \begin{macrocode}
+\DeclareRobustCommand*{\Useentrynl}[2]{%
+ \datagidx@parse@formatlabel{#1}%
+ \DTLgidxFetchEntry{\datagidx@value}{\datagidx@label}{#2}%
+ \datagidx@use@entry{#2}{\xmakefirstuc{\datagidx@value}}%
+}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\USEentrynl}
+%\begin{definition}
+%\cs{USEentrynl}\marg{label}\marg{field}
+%\end{definition}
+% As \cs{useentry}, but make the whole term upper case.
+% \begin{macrocode}
+\DeclareRobustCommand*{\USEentrynl}[2]{%
+ \datagidx@parse@formatlabel{#1}%
+ \DTLgidxFetchEntry{\datagidx@value}{\datagidx@label}{#2}%
+ \datagidx@use@entry{#2}{\MakeTextUppercase{\datagidx@value}}%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%
+% Short cuts to common fields.
+%\begin{macro}{\gls}
+% \begin{macrocode}
+\DeclareRobustCommand*{\gls}[1]{\useentry{#1}{Text}}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\glspl}
+% \begin{macrocode}
+\DeclareRobustCommand*{\glspl}[1]{\useentry{#1}{Plural}}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\Gls}
+% \begin{macrocode}
+\DeclareRobustCommand*{\Gls}[1]{\Useentry{#1}{Text}}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\Glspl}
+% \begin{macrocode}
+\DeclareRobustCommand*{\Glspl}[1]{\Useentry{#1}{Plural}}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\glsnl}
+% \begin{macrocode}
+\DeclareRobustCommand*{\glsnl}[1]{\useentrynl{#1}{Text}}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\glsplnl}
+% \begin{macrocode}
+\DeclareRobustCommand*{\glsplnl}[1]{\useentrynl{#1}{Plural}}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\Glsnl}
+% \begin{macrocode}
+\DeclareRobustCommand*{\Glsnl}[1]{\Useentrynl{#1}{Text}}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\Glsplnl}
+% \begin{macrocode}
+\DeclareRobustCommand*{\Glsplnl}[1]{\Useentrynl{#1}{Plural}}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\glssym}
+% \begin{macrocode}
+\DeclareRobustCommand*{\glssym}[1]{\useentry{#1}{Symbol}}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\Glssym}
+% \begin{macrocode}
+\DeclareRobustCommand*{\Glssym}[1]{\Useentry{#1}{Symbol}}
+% \end{macrocode}
+%\end{macro}
+%
+%\subsection{Using Acronyms}
+%\begin{macro}{\DTLgidxFormatAcr}
+%\begin{definition}
+%\cs{DTLgidxFormatAcr}\marg{label}\marg{long field}\marg{short field}
+%\end{definition}
+% \begin{macrocode}
+\newcommand*{\DTLgidxFormatAcr}[3]{%
+ \DTLgidxAcrStyle{\glsdispentry{#1}{#2}}{\useentry{#1}{#3}}%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\DTLgidxFormatAcrUC}
+%\begin{definition}
+%\cs{DTLgidxFormatAcr}\marg{label}\marg{long field}\marg{short field}
+%\end{definition}
+%As previous but capitalise first word.
+% \begin{macrocode}
+\newcommand*{\DTLgidxFormatAcrUC}[3]{%
+ \DTLgidxAcrStyle{\Glsdispentry{#1}{#2}}{\useentry{#1}{#3}}%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\acr}
+% \begin{macrocode}
+\DeclareRobustCommand*{\acr}[1]{%
+ \ifentryused{#1}%
+ {\useentry{#1}{Short}}%
+ {\DTLgidxFormatAcr{#1}{Long}{Short}}%
+}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\acrpl}
+% \begin{macrocode}
+\DeclareRobustCommand*{\acrpl}[1]{%
+ \ifentryused{#1}%
+ {\useentry{#1}{ShortPlural}}%
+ {\DTLgidxFormatAcr{#1}{LongPlural}{ShortPlural}}%
+}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\Acr}
+% \begin{macrocode}
+\DeclareRobustCommand*{\Acr}[1]{%
+ \ifentryused{#1}%
+ {\Useentry{#1}{Short}}%
+ {\DTLgidxFormatAcrUC{#1}{Long}{Short}}%
+}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\Acrpl}
+% \begin{macrocode}
+\DeclareRobustCommand*{\Acrpl}[1]{%
+ \ifentryused{#1}%
+ {\Useentry{#1}{ShortPlural}}%
+ {\DTLgidxFormatAcrUC{#1}{LongPlural}{ShortPlural}}%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\section{Displaying Glossaries, Lists of Acronyms, Indices}
+% Define keys for \cs{printterms}:
+% \begin{macrocode}
+\define@key{printterms}{database}{\renewcommand*{\newterm@database}{#1}}
+% \end{macrocode}
+% Options for post description.
+% \begin{macrocode}
+\define@choicekey{printterms}{postdesc}[\val\nr]%
+ {none,dot}%
+ {%
+ \datagidx@setpostdesc\nr
+ }
+% \end{macrocode}
+% Options for pre-location.
+% \begin{macrocode}
+\define@choicekey{printterms}{prelocation}[\val\nr]%
+ {none,enspace,space,dotfill,hfill}%
+ {%
+ \datagidx@setprelocation\nr
+ }
+% \end{macrocode}
+% How to display the location list.
+% \begin{macrocode}
+\define@choicekey{printterms}{location}[\val\nr]%
+ {hide,list,first}%
+ {\datagidx@setlocation\nr}
+% \end{macrocode}
+% How to format the symbol in relation to the description.
+% \begin{macrocode}
+\define@choicekey{printterms}{symboldesc}[\val\nr]%
+ {symbol,desc,(symbol) desc,desc (symbol),symbol desc,desc symbol}%
+ {\datagidx@formatsymdesc\nr}
+% \end{macrocode}
+% How many columns to have.
+% \begin{macrocode}
+\define@key{printterms}{columns}%
+{%
+ \DTLgidxSetColumns{#1}%
+}
+% \end{macrocode}
+% How to format the name.
+% \begin{macrocode}
+\define@choicekey{printterms}{namecase}[\val\nr]%
+ {nochange,uc,lc,firstuc,capitalise}%
+ {%
+ \datagidx@setnamecase\nr
+ }
+% \end{macrocode}
+% \begin{macrocode}
+\define@key{printterms}{namefont}%
+{%
+ \renewcommand*{\DTLgidxNameFont}[1]{{#1{##1}}}%
+}
+% \end{macrocode}
+% \begin{macrocode}
+\define@key{printterms}{postname}
+{%
+ \renewcommand*{\DTLgidxPostName}{#1}%
+}
+% \end{macrocode}
+% \begin{macrocode}
+\define@choicekey{printterms}{see}[\val\nr]%
+ {comma,brackets,dot,space,nosep,semicolon,location}%
+ {\datagidx@setsee\nr}
+% \end{macrocode}
+%
+% \begin{macrocode}
+\define@choicekey{printterms}{child}[\val\nr]%
+ {named,noname}%
+ {%
+ \datagidx@setchildstyle\nr
+ }
+% \end{macrocode}
+% Symbol width
+% \begin{macrocode}
+\define@key{printterms}{symbolwidth}%
+{%
+ \setlength{\datagidxsymbolwidth}{#1}%
+}
+% \end{macrocode}
+% Location width
+% \begin{macrocode}
+\define@key{printterms}{locationwidth}%
+{%
+ \setlength{\datagidxlocationwidth}{#1}%
+}
+% \end{macrocode}
+% Child sort:
+% \begin{macrocode}
+\define@choicekey{printterms}{childsort}[\val\nr]%
+ {true,false}[true]%
+ {%
+ \datagidx@setchildsort\nr
+ }
+% \end{macrocode}
+% Change style:
+% \begin{macrocode}
+\define@choicekey{printterms}{showgroups}{true,false}[true]{%
+ \appto\newterm@styles{showgroups={#1},}%
+}
+% \end{macrocode}
+% \begin{macrocode}
+\define@key{printterms}{style}{\appto\newterm@styles{style={#1},}}
+% \end{macrocode}
+% \begin{macrocode}
+\define@key{printterms}{heading}{\appto\newterm@styles{heading={#1},}}
+% \end{macrocode}
+% \begin{macrocode}
+\define@key{printterms}{postheading}{%
+ \appto\newterm@styles{postheading={#1},}%
+}
+% \end{macrocode}
+% \begin{macrocode}
+\define@key{printterms}{sort}{\appto\newterm@styles{sort={#1},}}
+% \end{macrocode}
+% \begin{macrocode}
+\define@choicekey{printterms}{balance}[\val\nr]{true,false}[true]{%
+ \ifcase\nr\relax
+ \appto\newterm@styles{balance=true,}%
+ \or
+ \appto\newterm@styles{balance=false,}%
+ \fi
+}
+% \end{macrocode}
+%
+%\begin{macro}{\printterms}
+%\begin{definition}
+%\cs{printterms}[options]
+%\end{definition}
+% Print the list of terms
+% \begin{macrocode}
+\newcommand{\printterms}[1][]{%
+\bgroup
+% \end{macrocode}
+% Set default database.
+% \begin{macrocode}
+ \let\newterm@database\datagidx@defaultdatabase
+% \end{macrocode}
+% Initialise key list for style:
+% \begin{macrocode}
+ \let\newterm@styles\@empty
+% \end{macrocode}
+% Set options:
+% \begin{macrocode}
+ \setkeys{printterms}{#1}%
+% \end{macrocode}
+% Check if database exists.
+% \begin{macrocode}
+ \DTLifdbexists{\newterm@database}%
+ {%
+% \end{macrocode}
+% Provide user the means to access the current database name.
+% \begin{macrocode}
+ \edef\DTLgidxCurrentdb{\newterm@database}%
+% \end{macrocode}
+% Get the fields from datagidx:
+% \begin{macrocode}
+ \edef\do@getrow{\noexpand\dtlgetrowforvalue
+ {datagidx}%
+ {\dtlcolumnindex{datagidx}{Glossary}}%
+ {\newterm@database}%
+ }%
+ \do@getrow
+ \dtlgetentryfromcurrentrow
+ {\datagidx@title}%
+ {\dtlcolumnindex{datagidx}{Title}}%
+ \dtlgetentryfromcurrentrow
+ {\datagidx@heading}%
+ {\dtlcolumnindex{datagidx}{Heading}}%
+ \dtlgetentryfromcurrentrow
+ {\datagidx@postheading}%
+ {\dtlcolumnindex{datagidx}{PostHeading}}%
+ \dtlgetentryfromcurrentrow
+ {\datagidx@multicols}%
+ {\dtlcolumnindex{datagidx}{MultiCols}}%
+ \dtlgetentryfromcurrentrow
+ {\datagidx@sort}%
+ {\dtlcolumnindex{datagidx}{Sort}}%
+ \dtlgetentryfromcurrentrow
+ {\datagidx@style}%
+ {\dtlcolumnindex{datagidx}{Style}}%
+ \dtlgetentryfromcurrentrow
+ {\datagidx@showgroups}%
+ {\dtlcolumnindex{datagidx}{ShowGroups}}%
+% \end{macrocode}
+% Allow user to override style here.
+% \begin{macrocode}
+ \edef\dtl@do@setkeys{\noexpand\setkeys{newgloss}{\expandonce\newterm@styles}}%
+ \dtl@do@setkeys
+% \end{macrocode}
+% Do we need to use \env{multicols}?
+% \begin{macrocode}
+ \ifnum\datagidx@columns>1\relax
+ \edef\datagidx@prestart{%
+ \noexpand\begin{\datagidx@multicols}{\datagidx@columns}%
+ }%
+ \edef\datagidx@postend{%
+ \noexpand\end{\datagidx@multicols}%
+ }%
+ \else
+ \def\datagidx@prestart{}%
+ \def\datagidx@postend{}%
+ \fi
+ \let\@dtl@dbname\DTLgidxCurrentdb
+% \end{macrocode}
+% Set the style
+% \begin{macrocode}
+ \csuse{datagidxshowgroups\datagidx@showgroups}%
+ \datagidxsetstyle{\datagidx@style}%
+% \end{macrocode}
+% Now display the glossary/index:
+% \begin{macrocode}
+ \def\datagidx@labellist{}%
+ \datagidx@heading{\datagidx@title}%
+ \datagidx@postheading
+ \datagidx@do@sort
+ \datagidx@prestart
+ \datagidxstart
+ \let\DTLgidxName\datagidx@invert
+ \let\DTLgidxPlace\datagidx@invert
+ \let\DTLgidxSubject\datagidx@invert
+ \let\DTLgidxOffice\datagidx@invert
+ \DTLgidxForeachEntry
+ {%
+ \datagidxitem
+ }%
+ \datagidxend
+ \datagidx@postend
+ }%
+ {%
+% \end{macrocode}
+% Database doesn't exist.
+% \begin{macrocode}
+ \PackageError{datagidx}%
+ {Glossary/index data base `\newterm@database' doesn't exist}%
+ {%
+ You must define the glossary/index data base before you can
+ use it.%
+ }%
+ }%
+\egroup
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\datagidx@getgroup}
+% Get the current group.
+% \begin{macrocode}
+\def\datagidx@getgroup#1#2\datagidx@endgetgroup{%
+ \dtl@setcharcode{#1}{\count@}%
+ \dtlifintclosedbetween{\count@}{48}{57}%
+ {%
+ \gdef\datagidxcurrentgroup{Numbers}%
+ }%
+ {%
+ \dtlifintclosedbetween{\count@}{97}{122}%
+ {%
+ \advance\count@ by -96\relax
+ \xdef\datagidxcurrentgroup{\@Alph\count@}%
+ }%
+ {%
+ \dtlifintclosedbetween{\count@}{65}{90}%
+ {%
+ \gdef\datagidxcurrentgroup{#1}%
+ }%
+ {%
+ \gdef\datagidxcurrentgroup{Symbols}%
+ }%
+ }%
+ }%
+}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\DTLgidxGroupHeaderTitle}
+% Produce the group title from the group label.
+% \begin{macrocode}
+\newcommand*{\DTLgidxGroupHeaderTitle}[1]{%
+ \ifcsdef{datagidx#1name}
+ {%
+ \csuse{datagidx#1name}%
+ }%
+ {%
+ #1%
+ }%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\DTLgidxForeachEntry}
+%\begin{definition}
+%\cs{DTLgidxForeachEntry}\marg{body}
+%\end{definition}
+% Iterate through the current database, but only do \meta{body}
+% if there is a location or cross-reference.
+% \begin{macrocode}
+\newcommand{\DTLgidxForeachEntry}[1]{%
+ \def\datagidxprevgroup{}%
+ \edef\datagidx@doforeachentry{%
+ \noexpand\DTLforeach*{\DTLgidxCurrentdb}%
+ {\expandonce\DTLgidxAssignList}
+ }%
+ \datagidx@doforeachentry
+ {%
+% \end{macrocode}
+% Iterate through top-level entries.
+% \begin{macrocode}
+ \DTLifnull{\Parent}%
+ {%
+% \end{macrocode}
+% If there's no location, but there is a current location, then
+% document needs updating.
+% \begin{macrocode}
+ \DTLifnull\Location
+ {%
+ \DTLifnull\CurrentLocation
+ {%
+ }%
+ {%
+% \end{macrocode}
+% We have a current location but not a location.
+% \begin{macrocode}
+ \global\let\@datagidx@dorerun@warn\@data@rerun@warn
+ }%
+ }%
+ {%
+% \end{macrocode}
+% We have a location. Is it up-to-date?
+% \begin{macrocode}
+ \ifcsdef{datagidx@prev@loc@\Label}%
+ {%
+% \end{macrocode}
+% Current location was saved in the previous run. Has it changed?
+% \begin{macrocode}
+ \ifcsequal{datagidx@prev@loc@\Label}{CurrentLocation}%
+ {}%
+ {%
+ \global\let\@datagidx@dorerun@warn\@data@rerun@warn
+ }%
+ }%
+ {%
+% \end{macrocode}
+% Current location wasn't saved last run, so rerun required.
+% \begin{macrocode}
+ \global\let\@datagidx@dorerun@warn\@data@rerun@warn
+ }%
+ }%
+ \datagidx@doifdisplayed
+ {%
+% \end{macrocode}
+% Write current location to file to compare current and previous
+% lists. (Can't compare \cs{Location} with \cs{CurrentLocation} as
+% there may be locations occurring across a page boundary.)
+% \begin{macrocode}
+ \edef\datagidx@dowrite{%
+ \noexpand\protected@write\noexpand\@auxout{}%
+ {%
+ \string\datagidx@save@loc{\Label}{\CurrentLocation}%
+ }%
+ }%
+ \datagidx@dowrite
+% \end{macrocode}
+% Initialise level.
+% \begin{macrocode}
+ \datagidx@level=1\relax
+ \expandafter\datagidx@getgroup\Sort{}\datagidx@endgetgroup
+ #1%
+ \global\let\datagidxprevgroup\datagidxcurrentgroup
+ }%
+ }%
+ {}%
+ }%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\datagidx@doifdisplayed}
+%\begin{definition}
+%\cs{datagidx@doifdisplayed}\marg{body}
+%\end{definition}
+% Do \meta{body} if entry should appear in the glossary/index.
+% \cs{Location}, \cs{See} and \cs{SeeAlso} must be set before use.
+% \begin{macrocode}
+\newcommand{\datagidx@doifdisplayed}[1]{%
+ \DTLifnull{\Location}%
+ {%
+ \DTLifnull{\See}
+ {%
+ \DTLifnull{\SeeAlso}{}%
+ {%
+ #1%
+ }%
+ }%
+ {%
+% \end{macrocode}
+% "See" is not null, but have any of the cross-referenced items been
+% used?
+% \begin{macrocode}
+ \@for\dtl@thislabel:=\See\do
+ {%
+% \end{macrocode}
+% Does the cross-referenced term exist?
+% \begin{macrocode}
+ \iftermexists{\dtl@thislabel}%
+ {%
+% \end{macrocode}
+% Has it been used?
+% \begin{macrocode}
+ \ifentryused{\dtl@thislabel}%
+ {%
+ #1%
+% \end{macrocode}
+% Break out of loop.
+% \begin{macrocode}
+ \@endfortrue
+ }%
+ {}%
+ }%
+ {%
+ }%
+ }%
+ }%
+ }%
+ {%
+ #1%
+ }%
+}%
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\datagidx@level}
+% Keep track of current level
+% \begin{macrocode}
+\newcount\datagidx@level
+% \end{macrocode}
+%\end{macro}
+%\iffalse
+% \begin{macrocode}
+%</datagidx.sty>
+% \end{macrocode}
+%\fi
+%\iffalse
+% \begin{macrocode}
%<*databib.sty>
% \end{macrocode}
%\fi
@@ -11748,7 +18555,7 @@ datatool.dtx
%\section{Package Declaration}
% \begin{macrocode}
\NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{databib}[2012/09/25 v2.11 (NLCT)]
+\ProvidesPackage{databib}[2013/01/15 v2.13 (NLCT)]
% \end{macrocode}
% Load required packages:
% \begin{macrocode}
@@ -14455,7 +21262,7 @@ already exists}{}}}}
% Declare package:
% \begin{macrocode}
\NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{databar}[2012/09/25 v2.11 (NLCT)]
+\ProvidesPackage{databar}[2013/01/15 v2.13 (NLCT)]
% \end{macrocode}
% Require \sty{xkeyval} package
% \begin{macrocode}
@@ -15756,7 +22563,7 @@ already exists}{}}}}
% Declare package:
% \begin{macrocode}
\NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{datapie}[2012/09/25 v2.11 (NLCT)]
+\ProvidesPackage{datapie}[2013/01/15 v2.13 (NLCT)]
% \end{macrocode}
% Require \sty{xkeyval} package
% \begin{macrocode}
@@ -16434,7 +23241,7 @@ Try #2-#1 instead of #1-#2}%
% Declare package:
% \begin{macrocode}
\NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{dataplot}[2012/09/25 v2.11 (NLCT)]
+\ProvidesPackage{dataplot}[2013/01/15 v2.13 (NLCT)]
% \end{macrocode}
% Required packages
% \begin{macrocode}
@@ -17863,7 +24670,7 @@ east,southeast,south,southwest,west,northwest}[northeast]{%
% Package identification:
% \begin{macrocode}
\NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{person}[2012/09/25 v2.11 (NLCT)]
+\ProvidesPackage{person}[2013/01/15 v2.13 (NLCT)]
% \end{macrocode}
% Requires the \sty{ifthen} package.
% \begin{macrocode}
diff --git a/Master/texmf-dist/source/latex/datatool/datatool.ins b/Master/texmf-dist/source/latex/datatool/datatool.ins
index 54ea5c65490..bb4789b5e04 100644
--- a/Master/texmf-dist/source/latex/datatool/datatool.ins
+++ b/Master/texmf-dist/source/latex/datatool/datatool.ins
@@ -1,10 +1,10 @@
-% datatool.ins generated using makedtx version 0.94b 2012/10/6 20:31
+% datatool.ins generated using makedtx version 0.94b 2013/1/15 15:04
\input docstrip
\preamble
datatool.dtx
- Copyright 2012 Nicola Talbot
+ Copyright 2013 Nicola Talbot
This work may be distributed and/or modified under the
conditions of the LaTeX Project Public License, either version 1.3
@@ -18,7 +18,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-base.sty, datatool-fp.sty, datatool-pgfmath.sty, datatool.sty, databib.sty, databar.sty, datapie.sty, dataplot.sty, person.sty, databib.bst.
+ This work consists of the files datatool.dtx and datatool.ins and the derived files datatool-base.sty, datatool-fp.sty, datatool-pgfmath.sty, datatool.sty, datagidx.sty, databib.sty, databar.sty, datapie.sty, dataplot.sty, person.sty, databib.bst.
\endpreamble
@@ -32,6 +32,8 @@
\usepostamble\defaultpostamble\from{datatool.dtx}{datatool-pgfmath.sty,package}}
\file{datatool.sty}{\usepreamble\defaultpreamble
\usepostamble\defaultpostamble\from{datatool.dtx}{datatool.sty,package}}
+\file{datagidx.sty}{\usepreamble\defaultpreamble
+\usepostamble\defaultpostamble\from{datatool.dtx}{datagidx.sty,package}}
\file{databib.sty}{\usepreamble\defaultpreamble
\usepostamble\defaultpostamble\from{datatool.dtx}{databib.sty,package}}
\file{databar.sty}{\usepreamble\defaultpreamble
diff --git a/Master/texmf-dist/tex/latex/datatool/databar.sty b/Master/texmf-dist/tex/latex/datatool/databar.sty
index 972aa20eceb..e0ab21dfffc 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 2012 Nicola Talbot
+%% Copyright 2013 Nicola Talbot
%%
%% This work may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either version 1.3
@@ -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-base.sty, datatool-fp.sty, datatool-pgfmath.sty, datatool.sty, databib.sty, databar.sty, datapie.sty, dataplot.sty, person.sty, databib.bst.
+%% This work consists of the files datatool.dtx and datatool.ins and the derived files datatool-base.sty, datatool-fp.sty, datatool-pgfmath.sty, datatool.sty, datagidx.sty, databib.sty, databar.sty, datapie.sty, dataplot.sty, person.sty, databib.bst.
%%
%% \CharacterTable
%% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
@@ -39,7 +39,7 @@
%% Grave accent \` Left brace \{ Vertical bar \|
%% Right brace \} Tilde \~}
\NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{databar}[2012/09/25 v2.11 (NLCT)]
+\ProvidesPackage{databar}[2013/01/15 v2.13 (NLCT)]
\RequirePackage{xkeyval}
\RequirePackage{dataplot}
\newif\ifDTLcolorbarchart
diff --git a/Master/texmf-dist/tex/latex/datatool/databib.sty b/Master/texmf-dist/tex/latex/datatool/databib.sty
index c5c7ada4dfc..3ebe84cea78 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 2012 Nicola Talbot
+%% Copyright 2013 Nicola Talbot
%%
%% This work may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either version 1.3
@@ -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-base.sty, datatool-fp.sty, datatool-pgfmath.sty, datatool.sty, databib.sty, databar.sty, datapie.sty, dataplot.sty, person.sty, databib.bst.
+%% This work consists of the files datatool.dtx and datatool.ins and the derived files datatool-base.sty, datatool-fp.sty, datatool-pgfmath.sty, datatool.sty, datagidx.sty, databib.sty, databar.sty, datapie.sty, dataplot.sty, person.sty, databib.bst.
%%
%% \CharacterTable
%% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
@@ -39,7 +39,7 @@
%% Grave accent \` Left brace \{ Vertical bar \|
%% Right brace \} Tilde \~}
\NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{databib}[2012/09/25 v2.11 (NLCT)]
+\ProvidesPackage{databib}[2013/01/15 v2.13 (NLCT)]
\RequirePackage{datatool}
\newcommand*{\dtlbib@style}{plain}
\define@choicekey{databib.sty}{style}{plain,abbrv,alpha}{%
diff --git a/Master/texmf-dist/tex/latex/datatool/datagidx.sty b/Master/texmf-dist/tex/latex/datatool/datagidx.sty
new file mode 100644
index 00000000000..63b778f0cff
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/datatool/datagidx.sty
@@ -0,0 +1,3147 @@
+%%
+%% This is file `datagidx.sty',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% datatool.dtx (with options: `datagidx.sty,package')
+%%
+%% datatool.dtx
+%% Copyright 2013 Nicola Talbot
+%%
+%% This work may be distributed and/or modified under the
+%% conditions of the LaTeX Project Public License, either version 1.3
+%% of this license of (at your option) any later version.
+%% The latest version of this license is in
+%% http://www.latex-project.org/lppl.txt
+%% and version 1.3 or later is part of all distributions of LaTeX
+%% version 2005/12/01 or later.
+%%
+%% This work has the LPPL maintenance status `maintained'.
+%%
+%% The Current Maintainer of this work is Nicola Talbot.
+%%
+%% This work consists of the files datatool.dtx and datatool.ins and the derived files datatool-base.sty, datatool-fp.sty, datatool-pgfmath.sty, datatool.sty, datagidx.sty, databib.sty, databar.sty, datapie.sty, dataplot.sty, person.sty, databib.bst.
+%%
+%% \CharacterTable
+%% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
+%% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
+%% Digits \0\1\2\3\4\5\6\7\8\9
+%% Exclamation \! Double quote \" Hash (number) \#
+%% Dollar \$ Percent \% Ampersand \&
+%% Acute accent \' Left paren \( Right paren \)
+%% Asterisk \* Plus \+ Comma \,
+%% Minus \- Point \. Solidus \/
+%% Colon \: Semicolon \; Less than \<
+%% Equals \= Greater than \> Question mark \?
+%% Commercial at \@ Left bracket \[ Backslash \\
+%% Right bracket \] Circumflex \^ Underscore \_
+%% Grave accent \` Left brace \{ Vertical bar \|
+%% Right brace \} Tilde \~}
+\NeedsTeXFormat{LaTeX2e}
+\ProvidesPackage{datagidx}[2013/01/15 v2.13 (NLCT)]
+\RequirePackage{datatool}
+\RequirePackage{etoolbox}
+\RequirePackage{xkeyval}
+\RequirePackage{mfirstuc}
+\RequirePackage{xfor}
+\RequirePackage{multicol}
+\RequirePackage{textcase}
+\newcommand*{\datagidx@columns}{2}
+\newcommand*{\DTLgidxSetColumns}[1]{%
+ \DTLifint{#1}%
+ {%
+ \def\datagidx@columns{#1}%
+ }%
+ {%
+ \PackageError{datagidx}%
+ {Number of columns must be an integer}%
+ {%
+ You have requested `#1' columns, which can't be parsed as a
+ number%
+ }%
+ }%
+}
+\newcounter{DTLgidxChildCount}
+\def\theHDTLgidxChildCount{\Label.\arabic{DTLgidxChildCount}}
+\newcommand*{\DTLgidxChildCountLabel}{\theDTLgidxChildCount) }
+\newcommand*{\DTLgidxChildStyle}[1]{#1}
+\newcommand*{\datagidx@setchildstyle}[1]{%
+ \ifcase#1\relax
+ \renewcommand*{\DTLgidxChildStyle}[1]{##1}%
+ \or
+ \renewcommand*{\DTLgidxChildStyle}[1]{%
+ \DTLgidxChildCountLabel
+ }%
+ \fi
+}
+\newcommand{\datagidx@foreachchild}{%
+ \datagidx@sort@foreachchild
+}
+\newcommand*{\datagidx@setchildsort}[1]{%
+ \ifcase#1\relax
+ \renewcommand*{\datagidx@foreachchild}{%
+ \datagidx@sort@foreachchild
+ }%
+ \or
+ \renewcommand*{\datagidx@foreachchild}{%
+ \datagidx@unsort@foreachchild
+ }%
+ \fi
+}
+\newcommand*{\DTLgidxPostName}{ }
+\newcommand*{\DTLgidxPostChildName}{\DTLgidxPostName}
+\newcommand*{\DTLgidxNameCase}[1]{#1}
+\newcommand*{\datagidx@setnamecase}[1]{%
+ \ifcase#1\relax
+ \renewcommand*{\DTLgidxNameCase}[1]{##1}%
+ \or
+ \let\DTLgidxNameCase\MakeTextUppercase
+ \or
+ \let\DTLgidxNameCase\MakeTextLowercase
+ \or
+ \let\DTLgidxNameCase\xmakefirstuc
+ \or
+ \let\DTLgidxNameCase\xcapitalisewords
+ \fi
+}
+\newcommand*{\DTLgidxNameFont}[1]{\textnormal{#1}}
+\newcommand*{\DTLgidxPostDescription}{}
+\newcommand*{\datagidx@setpostdesc}[1]{%
+ \ifcase#1\relax
+ \renewcommand*{\DTLgidxPostDescription}{}%
+ \or
+ \renewcommand*{\DTLgidxPostDescription}{.}%
+ \fi
+ }
+\newcommand*{\DTLgidxPreLocation}{\enspace}
+\newcommand*{\datagidx@setprelocation}[1]{%
+ \ifcase#1\relax
+ \renewcommand*{\DTLgidxPreLocation}{}%
+ \or
+ \renewcommand*{\DTLgidxPreLocation}{\enspace}%
+ \or
+ \renewcommand*{\DTLgidxPreLocation}{ }%
+ \or
+ \renewcommand*{\DTLgidxPreLocation}{\dotfill}%
+ \or
+ \renewcommand*{\DTLgidxPreLocation}{\hfill}%
+ \fi
+ }
+\newcommand*{\DTLgidxLocation}{\dtldolocationlist}
+\newcommand*{\datagidx@setlocation}[1]{%
+ \ifcase#1\relax
+ \renewcommand*{\DTLgidxLocation}{}%
+ \or
+ \renewcommand*{\DTLgidxLocation}{\dtldolocationlist}%
+ \or
+ \renewcommand*{\DTLgidxLocation}{\dtldofirstlocation}%
+ \fi
+}
+\newcommand*{\DTLgidxSee}{%
+ \DTLifnull{\See}%
+ {}%
+ {%
+ \DTLgidxPreLocation
+ \DTLgidxFormatSee{\seename}{\See}%
+ }%
+}
+\newcommand*{\DTLgidxSeeAlso}{%
+ \DTLifnull{\SeeAlso}%
+ {}%
+ {%
+ \DTLgidxFormatSeeAlso{\seealsoname}{\SeeAlso}%
+ }%
+}
+\newcommand*{\DTLgidxChildrenSeeAlso}{%
+ \DTLgidxChildren
+ \DTLgidxSeeAlso
+}
+\newcommand*{\datagidx@setsee}[1]{%
+ \ifcase#1\relax
+ \renewcommand*{\DTLgidxSee}{%
+ \DTLifnull{\See}{}%
+ {%
+ , \DTLgidxFormatSee{\seename}{\See}%
+ }%
+ }%
+ \or
+ \renewcommand*{\DTLgidxSee}{%
+ \DTLifnull{\See}{}
+ {%
+ \space(\DTLgidxFormatSee{\seename}{\See})%
+ }%
+ }%
+ \or
+ \renewcommand*{\DTLgidxSee}{%
+ \DTLifnull{\See}{}%
+ {%
+ . \DTLgidxFormatSee{\xmakefirstuc{\seename}}{\See}%
+ }%
+ }%
+ \or
+ \renewcommand*{\DTLgidxSee}{%
+ \DTLifnull{\See}{}
+ {%
+ \space\DTLgidxFormatSee{\seename}{\See}%
+ }%
+ }%
+ \or
+ \renewcommand*{\DTLgidxSee}{%
+ \DTLifnull{\See}{}
+ {%
+ \DTLgidxFormatSee{\seename}{\See}%
+ }%
+ }%
+ \or
+ \renewcommand*{\DTLgidxSee}{%
+ \DTLifnull{\See}{}
+ {%
+ ; \DTLgidxFormatSee{\seename}{\See}%
+ }%
+ }%
+ \or
+ \renewcommand*{\DTLgidxSee}{%
+ \DTLifnull{\See}{}
+ {%
+ \DTLgidxPreLocation\DTLgidxFormatSee{\seename}{\See}%
+ }%
+ }%
+ \fi
+}
+\newcommand*{\DTLgidxSymDescSep}{\space}
+\newlength\datagidxsymbolwidth
+\newlength\datagidxlocationwidth
+\newcommand{\DTLgidxFormatDesc}[1]{#1}
+\newcommand*{\DTLgidxSymbolDescription}{%
+ \DTLgidxSymbolDescLeft
+ \DTLgidxSymbolDescRight
+}
+\newcommand*{\DTLgidxSymbolDescLeft}{%
+ \ifdefempty{\Symbol}{}{(\Symbol)\DTLgidxSymDescSep}%
+}
+\newcommand*{\DTLgidxSymbolDescRight}{%
+ \ifdefempty{\Description}{}%
+ {%
+ \DTLgidxFormatDesc{\Description}\DTLgidxPostDescription
+ }%
+}
+\newif\if@datagidxsymbolleft
+\@datagidxsymbollefttrue
+\newcommand*{\datagidx@formatsymdesc}[1]{%
+ \ifcase#1\relax
+ \renewcommand*{\DTLgidxSymbolDescLeft}{%
+ \ifdefempty{\Symbol}{}{\Symbol}%
+ }%
+ \renewcommand*{\DTLgidxSymbolDescRight}{}%
+ \@datagidxsymbollefttrue
+ \or
+ \renewcommand*{\DTLgidxSymbolDescLeft}{%
+ \ifdefempty{\Description}{}%
+ {%
+ \DTLgidxFormatDesc{\Description}\DTLgidxPostDescription
+ }%
+ }%
+ \renewcommand*{\DTLgidxSymbolDescRight}{}%
+ \@datagidxsymbolleftfalse
+ \or
+ \renewcommand*{\DTLgidxSymbolDescLeft}{%
+ \ifdefempty{\Symbol}{}{(\Symbol)\DTLgidxSymDescSep}%
+ }%
+ \renewcommand*{\DTLgidxSymbolDescRight}{%
+ \ifdefempty{\Description}{}%
+ {%
+ \DTLgidxFormatDesc{\Description}\DTLgidxPostDescription
+ }%
+ }%
+ \@datagidxsymbollefttrue
+ \or
+ \renewcommand*{\DTLgidxSymbolDescLeft}{%
+ \ifdefempty{\Description}{}%
+ {%
+ \DTLgidxFormatDesc{\Description}%
+ \DTLgidxPostDescription\DTLgidxSymDescSep
+ }%
+ }%
+ \renewcommand*{\DTLgidxSymbolDescRight}{%
+ \ifdefempty{\Symbol}{}{(\Symbol)}%
+ }%
+ \@datagidxsymbolleftfalse
+ \or
+ \renewcommand*{\DTLgidxSymbolDescLeft}{%
+ \ifdefempty{\Symbol}{}{\Symbol\DTLgidxSymDescSep}%
+ }%
+ \renewcommand*{\DTLgidxSymbolDescRight}{%
+ \ifdefempty{\Description}{}%
+ {%
+ \DTLgidxFormatDesc{\Description}%
+ \DTLgidxPostDescription
+ }%
+ }%
+ \@datagidxsymbollefttrue
+ \or
+ \renewcommand*{\DTLgidxSymbolDescLeft}{%
+ \ifdefempty{\Description}{}%
+ {%
+ \DTLgidxFormatDesc{\Description}%
+ \DTLgidxPostDescription\DTLgidxSymDescSep
+ }%
+ }%
+ \renewcommand*{\DTLgidxSymbolDescRight}{%
+ \ifdefempty{\Symbol}{}{\Symbol}%
+ }%
+ \@datagidxsymbolleftfalse
+ \fi
+ }
+\newcommand*{\DTLgidxSetCompositor}[1]{%
+ \undef\datagidx@docomplist
+ \DeclareListParser{\datagidx@docomplist}{#1}%
+ \def\datagidx@compositor{#1}%
+}
+\DTLgidxSetCompositor{.}
+\newcommand*{\datagidx@do@sort}{\datagidx@sort}
+\newcommand*{\datagidx@optimize@sort}{%
+ \ifdef\datagidx@do@optimize@sort
+ {%
+ \datagidx@sort
+ }%
+ {%
+ \protected@write\@auxout{}{%
+ \string\gdef\string\datagidx@do@optimize@sort{}%
+ }%
+ \global\let\@datagidx@dorerun@warn@sort\@data@rerun@warn@sort
+ }%
+}
+\newcommand*\@datagidx@dorerun@warn{}
+\AtEndDocument{\@datagidx@dorerun@warn}
+\newcommand*\@datagidx@dorerun@warn@sort{}
+\AtEndDocument{\@datagidx@dorerun@warn@sort}
+\newcommand*\@data@rerun@warn@sort{%
+ \PackageWarningNoLine{datagidx}{Rerun required to sort the
+ index/glossary databases}%
+}
+\newcommand*\@data@rerun@warn{%
+ \PackageWarningNoLine{datagidx}{Rerun required to ensure the
+ index/glossary location lists are up-to-date}%
+}
+\newcommand*{\datagidx@do@highopt@optimize}{%
+ \renewcommand*{\datagidx@do@sort}{%
+ \ifcsdef{datagidx@do@highopt@sort@\DTLgidxCurrentdb}%
+ {%
+ \csuse{datagidx@do@highopt@sort@\DTLgidxCurrentdb}%
+ }%
+ {%
+ }%
+ \bgroup
+ \def\dtl@saverawdbhook{%
+ \let\db@col@id@w\@datagidx@db@col@id@w
+ \def\DTLgidxName{\string\DTLgidxName\space}%
+ \def\DTLgidxMac{\string\DTLgidxMac\space}%
+ \def\DTLgidxRank{\string\DTLgidxRank\space}%
+ \def\DTLgidxParen{\string\DTLgidxParen\space}%
+ \def\DTLgidxParticle{\string\DTLgidxParticle\space}%
+ \def\DTLgidxOffice{\string\DTLgidxOffice\space}%
+ \def\DTLgidxSaint{\string\DTLgidxSaint\space}%
+ \def\DTLgidxPlace{\string\DTLgidxPlace\space}%
+ \def\DTLgidxIgnore{\string\DTLgidxIgnore\space}%
+ \def\DTLgidxNameNum{\string\DTLgidxNameNum\space}%
+ \def\DTLgidxSubject{\string\DTLgidxSubject\space}%
+ }%
+ \DTLsaverawdb{\DTLgidxCurrentdb}{\datagidxhighoptfilename\DTLgidxCurrentdb}%
+ \egroup
+ }%
+ \def\newgidx{\datagidx@highopt@newgidx}%
+ \def\newterm{\datagidx@highopt@newterm}%
+}
+\def\@datagidx@db@col@id@w#1\db@col@id@end@\db@col@elt@w#2\db@col@elt@end@\db@col@id@w#3\db@col@id@end@{%
+ \expandafter\@gobble\string\%^^J
+ \string\db@col@id@w\space #1%
+ \expandafter\@gobble\string\%^^J
+ \string\db@col@id@end@\space
+ \expandafter\@gobble\string\%^^J
+ \string\db@col@elt@w\space
+ \expandafter\ifnum\csname dtl@ci@\DTLgidxCurrentdb @Used\endcsname=#1\space
+ 0%
+ \else
+ \expandafter\ifnum\csname dtl@ci@\DTLgidxCurrentdb @Location\endcsname=#1\space
+ \else
+ \expandafter\ifnum\csname dtl@ci@\DTLgidxCurrentdb @CurrentLocation\endcsname=#1\space
+ \else
+ \expandafter\ifnum\csname dtl@ci@\DTLgidxCurrentdb @Sort\endcsname=#1\space
+ \protect#2%
+ \else
+ #2%
+ \fi
+ \fi
+ \fi
+ \fi
+ \expandafter\@gobble\string\%^^J
+ \string\db@col@elt@end@\space
+ \expandafter\@gobble\string\%^^J
+ \string\db@col@id@w\space #3%
+ \expandafter\@gobble\string\%^^J
+ \string\db@col@id@end@\space
+}
+\newcommand*{\datagidx@do@highopt@update}[1]{}
+\newcommand*{\datagidxhighoptfilename}[1]{\jobname-#1.gidx}
+\define@choicekey{datagidx.sty}{optimize}[\val\nr]%
+ {off,low,high}[high]%
+ {%
+ \ifcase\nr\relax
+ \renewcommand*{\datagidx@do@sort}{\datagidx@sort}
+ \or
+ \renewcommand*{\datagidx@do@sort}{\datagidx@optimize@sort}
+ \or
+ \datagidx@do@highopt@optimize
+ \fi
+ }
+\define@key{datagidx.sty}{columns}%
+{%
+ \DTLgidxSetColumns{#1}%
+}
+\define@choicekey{datagidx.sty}{child}[\val\nr]%
+ {named,noname}%
+ {%
+ \datagidx@setchildstyle\nr
+ }
+\define@choicekey{datagidx.sty}{namecase}[\val\nr]%
+ {nochange,uc,lc,firstuc,capitalise}%
+ {%
+ \datagidx@setnamecase\nr
+ }
+\define@key{datagidx.sty}{namefont}%
+{%
+ \renewcommand*{\DTLgidxNameFont}[1]{{#1{##1}}}%
+}
+\define@key{datagidx.sty}{postname}
+{%
+ \renewcommand*{\DTLgidxPostName}{#1}%
+}
+\define@choicekey{datagidx.sty}{postdesc}[\val\nr]%
+ {none,dot}%
+ {%
+ \datagidx@setpostdesc\nr
+ }
+\define@choicekey{datagidx.sty}{prelocation}[\val\nr]%
+ {none,enspace,space,dotfill,hfill}%
+ {%
+ \datagidx@setprelocation\nr
+ }
+\define@choicekey{datagidx.sty}{location}[\val\nr]%
+ {hide,list,first}%
+ {\datagidx@setlocation\nr}
+\define@choicekey{datagidx.sty}{see}[\val\nr]%
+ {comma,brackets,dot,space,nosep,semicolon,location}%
+ {\datagidx@setsee\nr}
+\define@choicekey{datagidx.sty}{symboldesc}[\val\nr]%
+ {symbol,desc,(symbol) desc,desc (symbol),symbol desc,desc symbol}%
+ {\datagidx@formatsymdesc\nr}
+\define@key{datagidx.sty}{compositor}%
+{%
+ \DTLgidxSetCompositor{#1}%
+}%
+\DeclareOptionX{final}{%
+ \let\datagidxshowifdraft\@gobble
+}
+\let\datagidxshowifdraft\@gobble
+\DeclareOptionX{draft}{%
+ \let\datagidxshowifdraft\@firstofone
+}
+\define@choicekey{datagidx.sty}{verbose}[\val\nr]%
+ {true,false}[true]%
+ {%
+ \csuse{dtlverbose\val}%
+ }
+\ProcessOptionsX
+\DTLnewdb{datagidx}
+\providecommand*{\seename}{see}
+\providecommand*{\seealsoname}{see also}
+\newcommand*{\DTLgidxSeeTagFont}[1]{\emph{#1}}
+\newcommand*{\DTLgidxFormatSee}[2]{%
+ \DTLgidxSeeTagFont{#1} \DTLgidxSeeList{#2}%
+}
+\newcommand*{\DTLgidxFormatSeeAlso}[2]{%
+ \datagidxdoseealso
+ {%
+ \DTLgidxSeeTagFont{#1} \DTLgidxSeeList{#2}%
+ }%
+}
+\newcommand*{\datagidxdoseealso}[1]{%
+ \datagidxseealsostart
+ #1%
+ \datagidxseealsoend
+}
+\newcommand*{\DTLgidxSeeList}[1]{%
+ \def\datagidx@sep{}%
+ \@for\dtl@thislabel:=#1\do
+ {%
+ \ifx\@xfor@nextelement\@nnil
+ \ifdefempty{\datagidx@sep}%
+ {%
+ }%
+ {%
+ \DTLidxSeeLastSep
+ }%
+ \else
+ \datagidx@sep
+ \let\datagidx@sep\DTLidxSeeSep
+ \fi
+ \DTLidxFormatSeeItem{\dtl@thislabel}%
+ }%
+}
+\newcommand*{\DTLidxFormatSeeItem}[1]{%
+ \DTLgidxFetchEntry{\datagidx@value}{#1}{Name}%
+ \datagidxlink{#1}%
+ {%
+ \datagidx@value
+ }%
+}
+\newcommand*{\DTLidxSeeSep}{, }
+\newcommand*{\DTLidxSeeLastSep}{ \& }
+\newcommand*{\DTLgidxDoSeeOrLocation}{%
+ \DTLifnull\See
+ {%
+ \ifdefempty\Location
+ {%
+ }%
+ {%
+ \DTLgidxPreLocation
+ \DTLgidxLocation
+ }%
+ }%
+ {%
+ \DTLgidxSee
+ }%
+}
+\newcommand*{\datagidx@sortchildren}{%
+ \def\datagidx@sortedlist{}%
+ \@for\Label:=\Children\do
+ {%
+ \edef\do@getrow{%
+ \noexpand\dtlgetrowforvalue
+ {\DTLgidxCurrentdb}%
+ {\dtlcolumnindex{\DTLgidxCurrentdb}{Label}}%
+ {\Label}%
+ }%
+ \do@getrow
+ \ifdefempty\datagidx@sortedlist
+ {%
+ \edef\datagidx@newsortedlist{{\number\dtlrownum}{\Label}}%
+ }%
+ {%
+ \def\datagidx@newsortedlist{}%
+ \@for\@datagidx@thisval:=\datagidx@sortedlist\do
+ {%
+ \edef\datagidx@thisidx{\expandafter\@firstoftwo\@datagidx@thisval}%
+ \ifnum\datagidx@thisidx>\dtlrownum\relax
+ \ifdefempty\datagidx@newsortedlist
+ {%
+ \eappto\datagidx@newsortedlist
+ {%
+ {\number\dtlrownum}{\Label},\@datagidx@thisval
+ }%
+ }%
+ {%
+ \eappto\datagidx@newsortedlist
+ {%
+ ,{\number\dtlrownum}{\Label},\@datagidx@thisval
+ }%
+ }%
+ \@endfortrue
+ \else
+ \ifdefempty\datagidx@newsortedlist
+ {%
+ \edef\datagidx@newsortedlist{%
+ \@datagidx@thisval
+ }%
+ }%
+ {%
+ \eappto\datagidx@newsortedlist
+ {%
+ ,\@datagidx@thisval
+ }%
+ }%
+ \fi
+ }%
+ \if@endfor
+ \ifdefempty\@forremainder
+ {%
+ }%
+ {%
+ \eappto\datagidx@newsortedlist{,\@forremainder}%
+ }%
+ \else
+ \ifdefempty\datagidx@newsortedlist
+ {%
+ \edef\datagidx@newsortedlist{{\number\dtlrownum}{\Label}}%
+ }%
+ {%
+ \eappto\datagidx@newsortedlist{,{\number\dtlrownum}{\Label}}%
+ }%
+ \fi
+ }%
+ \let\datagidx@sortedlist\datagidx@newsortedlist
+ \@endforfalse
+ }%
+}
+\newcommand{\datagidx@sort@foreachchild}[1]{%
+ \datagidx@sortchildren
+ \@for\@datagidx@thisval:=\datagidx@sortedlist\do
+ {%
+ \edef\Label{\expandafter\@secondoftwo\@datagidx@thisval}%
+ #1%
+ }%
+}
+\newcommand{\datagidx@unsort@foreachchild}[1]{%
+ \@for\Label:=\Children\do
+ {%
+ #1%
+ }%
+}
+\newcommand*{\DTLgidxChildren}{%
+ \bgroup
+ \DTLifnull\Children
+ {}%
+ {%
+ \advance\datagidx@level by 1\relax
+ \datagidxchildstart
+ \let\Parent\Label
+ \datagidx@foreachchild
+ {%
+ \edef\do@getrow{%
+ \noexpand\dtlgetrowforvalue
+ {\DTLgidxCurrentdb}%
+ {\dtlcolumnindex{\DTLgidxCurrentdb}{Label}}%
+ {\Label}%
+ }%
+ \do@getrow
+ \dtlgetentryfromcurrentrow
+ {\Location}%
+ {\dtlcolumnindex{\DTLgidxCurrentdb}{Location}}%
+ \dtlgetentryfromcurrentrow
+ {\See}%
+ {\dtlcolumnindex{\DTLgidxCurrentdb}{See}}%
+ \dtlgetentryfromcurrentrow
+ {\SeeAlso}%
+ {\dtlcolumnindex{\DTLgidxCurrentdb}{SeeAlso}}%
+ \DTLifnull\Location
+ {%
+ \DTLifnull\See
+ {%
+ \DTLifnull\SeeAlso
+ {}%
+ {%
+ \datagidx@displaychild
+ }%
+ }%
+ {%
+ \datagidx@displaychild
+ }%
+ }%
+ {%
+ \datagidx@displaychild
+ }%
+ }%
+ \datagidxchildend
+ }%
+ \egroup
+}
+\newcommand*{\datagidxgetchildfields}{%
+ \dtlgetentryfromcurrentrow
+ {\Name}%
+ {\dtlcolumnindex{\DTLgidxCurrentdb}{Name}}%
+ \dtlgetentryfromcurrentrow
+ {\Description}%
+ {\dtlcolumnindex{\DTLgidxCurrentdb}{Description}}%
+ \dtlgetentryfromcurrentrow
+ {\Symbol}%
+ {\dtlcolumnindex{\DTLgidxCurrentdb}{Symbol}}%
+ \dtlgetentryfromcurrentrow
+ {\Long}%
+ {\dtlcolumnindex{\DTLgidxCurrentdb}{Long}}%
+ \dtlgetentryfromcurrentrow
+ {\Short}%
+ {\dtlcolumnindex{\DTLgidxCurrentdb}{Short}}%
+ \dtlgetentryfromcurrentrow
+ {\Text}%
+ {\dtlcolumnindex{\DTLgidxCurrentdb}{Text}}%
+ \dtlgetentryfromcurrentrow
+ {\Plural}%
+ {\dtlcolumnindex{\DTLgidxCurrentdb}{Plural}}%
+ \dtlgetentryfromcurrentrow
+ {\Short}%
+ {\dtlcolumnindex{\DTLgidxCurrentdb}{Used}}%
+ \dtlgetentryfromcurrentrow
+ {\Children}%
+ {\dtlcolumnindex{\DTLgidxCurrentdb}{Child}}%
+}
+\newcommand*{\datagidx@displaychild}{%
+ \datagidxgetchildfields
+ \datagidxchilditem
+}
+\ifdef{\chapter}
+{%
+ \newcommand*{\datagidx@heading}{\chapter*}
+}%
+{%
+ \newcommand*{\datagidx@heading}{\section*}
+}
+\let\DTLgidxNoHeading\@gobble
+\newcommand*{\datagidx@postheading}{}
+\newcommand*{\datagidx@multicols}{multicols}
+\newcommand*{\datagidx@sort}{%
+ \dtlsort{Sort,FirstId}{\DTLgidxCurrentdb}{\dtlwordindexcompare}%
+}
+\newcommand*{\datagidxstart}%
+{%
+ \bgroup
+ \setlength{\parindent}{0pt}%
+ \setlength{\parskip}{0pt plus 0.3pt}%
+ \let\item\@idxitem
+}
+\newcommand*{\datagidxend}{\egroup}
+\newcommand*{\@datagidxtarget}[2]{%
+ \ifdef\hypertarget
+ {%
+ \bgroup
+ \let\glsadd\@gobble
+ \settoheight\dimen@{#2}%
+ \raisebox{\dimen@}{\hypertarget{#1}{}}%
+ \egroup
+ }%
+ {%
+ }%
+ #2%
+}
+\newcommand*{\datagidxtarget}{\@datagidxtarget}
+\newcommand*{\@datagidxlink}[2]{%
+ \ifdef\hyperlink
+ {%
+ \hyperlink{#1}{#2}%
+ }%
+ {%
+ #2%
+ }%
+}
+\newcommand*{\datagidxlink}{\@datagidxlink}
+\newcommand*{\DTLgidxEnableHyper}{%
+ \let\datagidxtarget\@datagidxtarget
+ \let\datagidxlink\@datagidxlink
+}
+\newcommand*{\DTLgidxDisableHyper}{%
+ \let\datagidxtarget\@secondoftwo
+ \let\datagidxlink\@secondoftwo
+}
+\newcommand*{\datagidxgroupsep}{}
+\newcommand*{\datagidxgroupheader}{}
+\newcommand*{\datagidxitem}{}%
+\newcommand*{\datagidxchildstart}{}
+\newcommand*{\datagidxchildend}{}
+\newcommand*{\datagidxchilditem}{}%
+\newcommand*{\datagidxseealsostart}{}
+\newcommand*{\datagidxseealsoend}{}
+\newcommand*{\datagidx@doifsymlocwidth}[3]{%
+ \setlength{\dtl@tmplength}{\linewidth}%
+ \addtolength{\dtl@tmplength}{-#1}%
+ \settowidth{\dimen@}{#2}%
+ \addtolength{\dtl@tmplength}{-\dimen@}%
+ \addtolength{\dtl@tmplength}{-\datagidxsymbolwidth}%
+ \addtolength{\dtl@tmplength}{-\datagidxlocationwidth}%
+ \settowidth{\dimen@}{\DTLgidxPreLocation}%
+ \addtolength{\dtl@tmplength}{-\dimen@}%
+ \settowidth{\dimen@}{\DTLgidxSymDescSep}%
+ \addtolength{\dtl@tmplength}{-\dimen@}%
+ \if@datagidxsymbolleft
+ \begin{minipage}[t]{\datagidxsymbolwidth}%
+ \datagidxsymalign
+ \let\DTLgidxSymDescSep\@empty
+ \DTLgidxSymbolDescLeft
+ \end{minipage}%
+ \DTLgidxSymDescSep
+ \begin{minipage}[t]{\dtl@tmplength}%
+ \let\DTLgidxSymDescSep\@empty
+ \DTLgidxSymbolDescRight
+ \end{minipage}%
+ \else
+ \begin{minipage}[t]{\dtl@tmplength}%
+ \let\DTLgidxSymDescSep\@empty
+ \DTLgidxSymbolDescRight
+ \end{minipage}%
+ \DTLgidxSymDescSep
+ \begin{minipage}[t]{\datagidxsymbolwidth}%
+ \datagidxsymalign
+ \let\DTLgidxSymDescSep\@empty
+ \DTLgidxSymbolDescLeft
+ \end{minipage}%
+ \fi
+ \DTLgidxPreLocation
+ \begin{minipage}[t]{\datagidxlocationwidth}%
+ \datagidxlocalign
+ \let\DTLgidxPreLocation\@empty
+ #3%
+ \end{minipage}%
+}
+\newcommand*{\datagidx@doiflocwidth}[3]{%
+ \setlength{\dtl@tmplength}{\linewidth}%
+ \addtolength{\dtl@tmplength}{-#1}%
+ \settowidth{\dimen@}{#2}%
+ \addtolength{\dtl@tmplength}{-\dimen@}%
+ \addtolength{\dtl@tmplength}{-\datagidxlocationwidth}%
+ \settowidth{\dimen@}{\DTLgidxPreLocation}%
+ \addtolength{\dtl@tmplength}{-\dimen@}%
+ \begin{minipage}[t]{\dtl@tmplength}%
+ \DTLgidxSymbolDescription
+ \end{minipage}%
+ \DTLgidxPreLocation
+ \begin{minipage}[t]{\datagidxlocationwidth}%
+ \datagidxlocalign
+ \let\DTLgidxPreLocation\@empty
+ #3%
+ \end{minipage}%
+}
+\newcommand*{\datagidx@doifsymwidth}[3]{%
+ \setlength{\dtl@tmplength}{\linewidth}%
+ \addtolength{\dtl@tmplength}{-#1}%
+ \settowidth{\dimen@}{#2}%
+ \addtolength{\dtl@tmplength}{-\dimen@}%
+ \addtolength{\dtl@tmplength}{-\datagidxsymbolwidth}%
+ \settowidth{\dimen@}{\DTLgidxSymDescSep}%
+ \addtolength{\dtl@tmplength}{-\dimen@}%
+ \if@datagidxsymbolleft
+ \begin{minipage}[t]{\datagidxsymbolwidth}%
+ \datagidxsymalign
+ \let\DTLgidxSymDescSep\@empty
+ \DTLgidxSymbolDescLeft
+ \end{minipage}%
+ \DTLgidxSymDescSep
+ \begin{minipage}[t]{\dtl@tmplength}%
+ \let\DTLgidxSymDescSep\@empty
+ \DTLgidxSymbolDescRight
+ #3%
+ \end{minipage}%
+ \else
+ \begin{minipage}[t]{\dtl@tmplength}%
+ \let\DTLgidxSymDescSep\@empty
+ \DTLgidxSymbolDescRight
+ \end{minipage}%
+ \DTLgidxSymDescSep
+ \begin{minipage}[t]{\datagidxsymbolwidth}%
+ \datagidxsymalign
+ \let\DTLgidxSymDescSep\@empty
+ \DTLgidxSymbolDescLeft
+ #3%
+ \end{minipage}%
+ \fi
+}
+\newcommand*{\datagidxlocalign}{\raggedleft}
+\newcommand*{\datagidxsymalign}{\centering}
+\newcommand*{\datagidxsetstyle}[1]{%
+ \ifcsdef{datagidx@style@#1}%
+ {%
+ \csuse{datagidx@style@#1}%
+ }%
+ {%
+ \PackageError{datagidx}{Unknown style `#1'}{}%
+ }%
+}
+\newcommand*{\datagidx@style@index}{%
+ \renewcommand*{\datagidxstart}%
+ {%
+ \bgroup
+ \setlength{\parindent}{0pt}%
+ \setlength{\parskip}{0pt plus 0.3pt}%
+ \raggedright
+ \let\item\@idxitem
+ \ifdim\datagidxsymbolwidth>0pt\relax
+ \ifdim\datagidxlocationwidth>0pt\relax
+ \def\datagidx@item@body{%
+ \datagidx@doifsymlocwidth{0pt}%
+ {\DTLgidxNameFont{\DTLgidxNameCase{\Name}}}%
+ {%
+ \DTLgidxDoSeeOrLocation
+ }%
+ }%
+ \else
+ \def\datagidx@item@body{%
+ \datagidx@doiflocwidth{0pt}%
+ {\DTLgidxNameFont{\DTLgidxNameCase{\Name}}}%
+ {%
+ \DTLgidxDoSeeOrLocation
+ }%
+ }%
+ \fi
+ \else
+ \ifdim\datagidxlocationwidth>0pt\relax
+ \def\datagidx@item@body{%
+ \datagidx@doiflocwidth{0pt}%
+ {\DTLgidxNameFont{\DTLgidxNameCase{\Name}}}%
+ {%
+ \DTLgidxDoSeeOrLocation
+ }%
+ }%
+ \else
+ \def\datagidx@item@body{%
+ \DTLgidxSymbolDescription
+ \DTLgidxDoSeeOrLocation
+ }%
+ \fi
+ \fi
+ }%
+ \renewcommand*{\datagidxend}{\egroup}%
+ \renewcommand*{\datagidxgroupsep}{\ifdatagidxshowgroups\indexspace\fi}%
+ \renewcommand{\datagidxgroupheader}{%
+ \ifdatagidxshowgroups
+ \item
+ \makebox[\linewidth]%
+ {%
+ \textbf{\DTLgidxGroupHeaderTitle{\datagidxcurrentgroup}}%
+ }%
+ \DTLpar\nobreak\@afterheading
+ \fi
+ }%
+ \renewcommand*{\datagidxitem}{%
+ \ifdefempty\datagidxprevgroup
+ {%
+ \datagidxgroupheader
+ }%
+ {%
+ \ifdefequal\datagidxcurrentgroup\datagidxprevgroup
+ {%
+ }%
+ {%
+ \datagidxgroupsep
+ \datagidxgroupheader
+ }%
+ }%
+ \item
+ \datagidxtarget{\Label}%
+ {%
+ \DTLgidxNameFont{\DTLgidxNameCase{\Name}}%
+ }%
+ \DTLgidxPostName
+ \datagidx@item@body
+ \DTLgidxChildrenSeeAlso
+ }%
+ \renewcommand*{\datagidxchildstart}%
+ {%
+ \bgroup
+ \setlength{\parindent}{0pt}%
+ \setlength{\parskip}{0pt plus 0.3pt}%
+ \let\item\@idxitem
+ }%
+ \renewcommand*{\datagidxchildend}{\egroup}%
+ \renewcommand*{\datagidxchilditem}{%
+ \setlength{\dimen@}{\datagidxindent}%
+ \multiply\dimen@ by \datagidx@level\relax
+ \@idxitem\hspace*{\dimen@}%
+ \refstepcounter{DTLgidxChildCount}%
+ \datagidxtarget{\Label}%
+ {%
+ \DTLgidxChildStyle
+ {%
+ \DTLgidxNameFont{\DTLgidxNameCase{\Name}}%
+ \DTLgidxPostChildName
+ }%
+ }%
+ \DTLgidxSymbolDescription
+ \DTLgidxDoSeeOrLocation
+ \DTLgidxChildrenSeeAlso
+ }%
+ \renewcommand*{\datagidxseealsostart}%
+ {%
+ \bgroup
+ \setlength{\parindent}{0pt}%
+ \setlength{\parskip}{0pt plus 0.3pt}%
+ \setlength{\dimen@}{\datagidxindent}%
+ \advance\datagidx@level by 1\relax
+ \multiply\dimen@ by \datagidx@level\relax
+ \@idxitem\hspace*{\dimen@}%
+ }%
+ \renewcommand{\datagidxseealsoend}{\egroup}%
+}
+\datagidx@style@index
+\newcommand*{\datagidx@style@indexalign}{%
+ \renewcommand*{\datagidxstart}%
+ {%
+ \bgroup
+ \setlength{\parindent}{0pt}%
+ \setlength{\parskip}{0pt plus 0.3pt}%
+ \setlength{\datagidxnamewidth}{0pt}%
+ \DTLforeach*{\DTLgidxCurrentdb}%
+ {\Name=Name,\Location=Location,\See=See,\SeeAlso=SeeAlso,%
+ \Parent=Parent}%
+ {%
+ \DTLifnull{\Parent}%
+ {%
+ \datagidx@doifdisplayed
+ {%
+ \settowidth{\dimen@}{\DTLgidxNameFont{\DTLgidxNameCase{\Name}}}%
+ \ifdim\dimen@>\datagidxnamewidth\relax
+ \datagidxnamewidth=\dimen@\relax
+ \fi
+ }%
+ }%
+ {}%
+ }%
+ \settowidth{\dimen@}{\DTLgidxPostName}%
+ \addtolength{\datagidxnamewidth}{\dimen@}%
+ \setlength{\datagidxdescwidth}{\linewidth}%
+ \addtolength{\datagidxdescwidth}{-\datagidxnamewidth}%
+ \ifdim\datagidxsymbolwidth>0pt\relax
+ \addtolength{\datagidxdescwidth}{-\datagidxsymbolwidth}%
+ \settowidth{\dimen@}{\DTLgidxSymDescSep}%
+ \addtolength{\datagidxdescwidth}{-\dimen@}%
+ \fi
+ \ifdim\datagidxlocationwidth>0pt\relax
+ \addtolength{\datagidxdescwidth}{-\datagidxlocationwidth}%
+ \settowidth{\dimen@}{\DTLgidxPreLocation}%
+ \addtolength{\datagidxdescwidth}{-\dimen@}%
+ \fi
+ \ifdim\datagidxsymbolwidth>0pt\relax
+ \ifdim\datagidxlocationwidth>0pt\relax
+ \if@datagidxsymbolleft
+ \def\datagidx@item@body{%
+ \begin{minipage}[t]{\datagidxsymbolwidth}%
+ \datagidxsymalign
+ \let\DTLgidxSymDescSep\@empty
+ \DTLgidxSymbolDescLeft
+ \end{minipage}%
+ \DTLgidxSymDescSep
+ \begin{minipage}[t]{\datagidxdescwidth}%
+ \let\DTLgidxSymDescSep\@empty
+ \setlength{\parskip}{0pt plus 0.3pt}%
+ \DTLgidxSymbolDescRight
+ \end{minipage}%
+ \DTLgidxPreLocation
+ \begin{minipage}[t]{\datagidxlocationwidth}%
+ \datagidxlocalign
+ \let\DTLgidxPreLocation\@empty
+ \DTLgidxDoSeeOrLocation
+ \end{minipage}%
+ }%
+ \else
+ \def\datagidx@item@body{%
+ \begin{minipage}[t]{\datagidxdescwidth}%
+ \let\DTLgidxSymDescSep\@empty
+ \DTLgidxSymbolDescLeft
+ \end{minipage}%
+ \DTLgidxSymDescSep
+ \begin{minipage}[t]{\datagidxsymbolwidth}%
+ \datagidxsymalign
+ \let\DTLgidxSymDescSep\@empty
+ \setlength{\parskip}{0pt plus 0.3pt}%
+ \DTLgidxSymbolDescRight
+ \end{minipage}%
+ \DTLgidxPreLocation
+ \begin{minipage}[t]{\datagidxlocationwidth}%
+ \datagidxlocalign
+ \let\DTLgidxPreLocation\@empty
+ \DTLgidxDoSeeOrLocation
+ \end{minipage}%
+ }%
+ \fi
+ \else
+ \if@datagidxsymbolleft
+ \def\datagidx@item@body{%
+ \begin{minipage}[t]{\datagidxsymbolwidth}%
+ \datagidxsymalign
+ \let\DTLgidxSymDescSep\@empty
+ \DTLgidxSymbolDescLeft
+ \end{minipage}%
+ \DTLgidxSymDescSep
+ \begin{minipage}[t]{\datagidxdescwidth}%
+ \let\DTLgidxSymDescSep\@empty
+ \setlength{\parskip}{0pt plus 0.3pt}%
+ \DTLgidxSymbolDescRight
+ \DTLgidxDoSeeOrLocation
+ \end{minipage}%
+ }%
+ \else
+ \def\datagidx@item@body{%
+ \begin{minipage}[t]{\datagidxdescwidth}%
+ \let\DTLgidxSymDescSep\@empty
+ \DTLgidxSymbolDescLeft
+ \end{minipage}%
+ \DTLgidxSymDescSep
+ \begin{minipage}[t]{\datagidxsymbolwidth}%
+ \datagidxsymalign
+ \let\DTLgidxSymDescSep\@empty
+ \setlength{\parskip}{0pt plus 0.3pt}%
+ \DTLgidxSymbolDescRight
+ \DTLgidxDoSeeOrLocation
+ \end{minipage}%
+ }%
+ \fi
+ \fi
+ \else
+ \ifdim\datagidxlocationwidth>0pt\relax
+ \def\datagidx@item@body{%
+ \begin{minipage}[t]{\datagidxdescwidth}%
+ \setlength{\parskip}{0pt plus 0.3pt}%
+ \DTLgidxSymbolDescription
+ \end{minipage}%
+ \DTLgidxPreLocation
+ \begin{minipage}[t]{\datagidxlocationwidth}%
+ \datagidxlocalign
+ \let\DTLgidxPreLocation\@empty
+ \DTLgidxDoSeeOrLocation
+ }%
+ \else
+ \def\datagidx@item@body{%
+ \begin{minipage}[t]{\datagidxdescwidth}%
+ \setlength{\parskip}{0pt plus 0.3pt}%
+ \DTLgidxSymbolDescription
+ \DTLgidxDoSeeOrLocation
+ \end{minipage}%
+ }%
+ \fi
+ \fi
+ }%
+ \renewcommand*{\datagidxend}{\egroup}%
+ \renewcommand*{\datagidxgroupsep}{}%
+ \renewcommand*{\datagidxgroupheader}{}%
+ \renewcommand*{\datagidxitem}{%
+ \ifdefempty\datagidxprevgroup
+ {%
+ \datagidxgroupheader
+ }%
+ {%
+ \ifdefequal\datagidxcurrentgroup\datagidxprevgroup
+ {%
+ }%
+ {%
+ \datagidxgroupsep
+ \datagidxgroupheader
+ }%
+ }%
+ \hangindent0pt\relax
+ \parindent0pt\relax
+ \makebox[\datagidxnamewidth][l]%
+ {%
+ \datagidxtarget{\Label}%
+ {%
+ \DTLgidxNameFont{\DTLgidxNameCase{\Name}}%
+ \DTLgidxPostName
+ }%
+ }%
+ \datagidx@item@body
+ \par
+ \DTLgidxChildrenSeeAlso
+ \par
+ }%
+ \renewcommand*{\datagidxchildstart}%
+ {%
+ \bgroup
+ \setlength{\dimen@}{\datagidxindent}%
+ \multiply\dimen@ by \datagidx@level\relax
+ \setlength{\dtl@tmplength}{\linewidth}%
+ \addtolength{\dtl@tmplength}{-\dimen@}%
+ \setlength{\parindent}{0pt}%
+ \setlength{\parskip}{0pt plus 0.3pt}%
+ \edef\item{\noexpand\parshape=1 \the\dimen@ \the\dtl@tmplength}%
+ \setlength{\datagidxnamewidth}{0pt}%
+ \DTLforeach*{\DTLgidxCurrentdb}%
+ {\Name=Name,\Location=Location,\See=See,\SeeAlso=SeeAlso,%
+ \Parent=Parent}%
+ {%
+ \DTLifnull{\Parent}%
+ {%
+ \datagidx@doifdisplayed
+ {%
+ \settowidth{\dimen@}%
+ {%
+ \DTLgidxChildStyle
+ {%
+ \DTLgidxNameFont{\DTLgidxNameCase{\Name}}%
+ }%
+ }%
+ \ifdim\dimen@>\datagidxnamewidth\relax
+ \datagidxnamewidth=\dimen@\relax
+ \fi
+ }%
+ }%
+ {}%
+ }%
+ \settowidth{\dimen@}{\DTLgidxChildStyle\DTLgidxPostChildName}%
+ \addtolength{\datagidxnamewidth}{\dimen@}%
+ \setlength{\datagidxdescwidth}{\dtl@tmplength}%
+ \addtolength{\datagidxdescwidth}{-\datagidxnamewidth}%
+ }%
+ \renewcommand{\datagidxchildend}{\egroup}%
+ \renewcommand*{\datagidxchilditem}{%
+ \item
+ \refstepcounter{DTLgidxChildCount}%
+ \makebox[\datagidxnamewidth][l]%
+ {%
+ \datagidxtarget{\Label}%
+ {%
+ \DTLgidxChildStyle
+ {%
+ \DTLgidxNameFont{\DTLgidxNameCase{\Name}}%
+ \DTLgidxPostChildName
+ }%
+ }%
+ }%
+ \begin{minipage}[t]{\datagidxdescwidth}%
+ \setlength{\parskip}{0pt plus 0.3pt}%
+ \DTLgidxSymbolDescription
+ \DTLgidxDoSeeOrLocation
+ \DTLgidxChildrenSeeAlso
+ \end{minipage}%
+ \par
+ }%
+}
+\newlength\datagidxindent
+\setlength\datagidxindent{10\p@}
+\newlength\datagidxnamewidth
+\newlength\datagidxdescwidth
+\newcommand*{\datagidx@style@align}{%
+ \renewcommand*{\datagidxstart}%
+ {%
+ \bgroup
+ \setlength{\parindent}{0pt}%
+ \setlength{\parskip}{0pt plus 0.3pt}%
+ \setlength{\datagidxnamewidth}{0pt}%
+ \DTLforeach*{\DTLgidxCurrentdb}%
+ {\Name=Name,\Location=Location,\See=See,\SeeAlso=SeeAlso,%
+ \Parent=Parent}%
+ {%
+ \DTLifnull{\Parent}%
+ {%
+ \datagidx@doifdisplayed
+ {%
+ \settowidth{\dimen@}{\DTLgidxNameFont{\DTLgidxNameCase{\Name}}}%
+ \ifdim\dimen@>\datagidxnamewidth\relax
+ \datagidxnamewidth=\dimen@\relax
+ \fi
+ }%
+ }%
+ {}%
+ }%
+ \settowidth{\dimen@}{\DTLgidxPostName}%
+ \addtolength{\datagidxnamewidth}{\dimen@}%
+ \setlength{\datagidxdescwidth}{\linewidth}%
+ \addtolength{\datagidxdescwidth}{-\datagidxnamewidth}%
+ \ifdim\datagidxsymbolwidth>0pt\relax
+ \addtolength{\datagidxdescwidth}{-\datagidxsymbolwidth}%
+ \settowidth{\dimen@}{\DTLgidxSymDescSep}%
+ \addtolength{\datagidxdescwidth}{-\dimen@}%
+ \fi
+ \ifdim\datagidxlocationwidth>0pt\relax
+ \addtolength{\datagidxdescwidth}{-\datagidxlocationwidth}%
+ \settowidth{\dimen@}{\DTLgidxPreLocation}%
+ \addtolength{\datagidxdescwidth}{-\dimen@}%
+ \fi
+ \ifdim\datagidxsymbolwidth>0pt\relax
+ \ifdim\datagidxlocationwidth>0pt\relax
+ \if@datagidxsymbolleft
+ \def\datagidx@item@body{%
+ \begin{minipage}[t]{\datagidxsymbolwidth}%
+ \datagidxsymalign
+ \let\DTLgidxSymDescSep\@empty
+ \DTLgidxSymbolDescLeft
+ \end{minipage}%
+ \DTLgidxSymDescSep
+ \begin{minipage}[t]{\datagidxdescwidth}%
+ \let\DTLgidxSymDescSep\@empty
+ \setlength{\parskip}{0pt plus 0.3pt}%
+ \DTLgidxSymbolDescRight
+ \end{minipage}%
+ \DTLgidxPreLocation
+ \begin{minipage}[t]{\datagidxlocationwidth}%
+ \datagidxlocalign
+ \let\DTLgidxPreLocation\@empty
+ \DTLgidxDoSeeOrLocation
+ \DTLgidxChildrenSeeAlso
+ \end{minipage}%
+ }%
+ \else
+ \def\datagidx@item@body{%
+ \begin{minipage}[t]{\datagidxdescwidth}%
+ \let\DTLgidxSymDescSep\@empty
+ \DTLgidxSymbolDescLeft
+ \end{minipage}%
+ \DTLgidxSymDescSep
+ \begin{minipage}[t]{\datagidxsymbolwidth}%
+ \datagidxsymalign
+ \let\DTLgidxSymDescSep\@empty
+ \setlength{\parskip}{0pt plus 0.3pt}%
+ \DTLgidxSymbolDescRight
+ \end{minipage}%
+ \DTLgidxPreLocation
+ \begin{minipage}[t]{\datagidxlocationwidth}%
+ \datagidxlocalign
+ \let\DTLgidxPreLocation\@empty
+ \DTLgidxDoSeeOrLocation
+ \DTLgidxChildrenSeeAlso
+ \end{minipage}%
+ }%
+ \fi
+ \else
+ \if@datagidxsymbolleft
+ \def\datagidx@item@body{%
+ \begin{minipage}[t]{\datagidxsymbolwidth}%
+ \datagidxsymalign
+ \let\DTLgidxSymDescSep\@empty
+ \DTLgidxSymbolDescLeft
+ \end{minipage}%
+ \DTLgidxSymDescSep
+ \begin{minipage}[t]{\datagidxdescwidth}%
+ \let\DTLgidxSymDescSep\@empty
+ \setlength{\parskip}{0pt plus 0.3pt}%
+ \DTLgidxSymbolDescRight
+ \DTLgidxDoSeeOrLocation
+ \DTLgidxChildrenSeeAlso
+ \end{minipage}%
+ }%
+ \else
+ \def\datagidx@item@body{%
+ \begin{minipage}[t]{\datagidxdescwidth}%
+ \let\DTLgidxSymDescSep\@empty
+ \DTLgidxSymbolDescLeft
+ \end{minipage}%
+ \DTLgidxSymDescSep
+ \begin{minipage}[t]{\datagidxsymbolwidth}%
+ \datagidxsymalign
+ \let\DTLgidxSymDescSep\@empty
+ \setlength{\parskip}{0pt plus 0.3pt}%
+ \DTLgidxSymbolDescRight
+ \DTLgidxDoSeeOrLocation
+ \DTLgidxChildrenSeeAlso
+ \end{minipage}%
+ }%
+ \fi
+ \fi
+ \else
+ \ifdim\datagidxlocationwidth>0pt\relax
+ \def\datagidx@item@body{%
+ \begin{minipage}[t]{\datagidxdescwidth}%
+ \setlength{\parskip}{0pt plus 0.3pt}%
+ \DTLgidxSymbolDescription
+ \end{minipage}%
+ \DTLgidxPreLocation
+ \begin{minipage}[t]{\datagidxlocationwidth}%
+ \datagidxlocalign
+ \let\DTLgidxPreLocation\@empty
+ \DTLgidxDoSeeOrLocation
+ \DTLgidxChildrenSeeAlso
+ \end{minipage}%
+ }%
+ \else
+ \def\datagidx@item@body{%
+ \begin{minipage}[t]{\datagidxdescwidth}%
+ \setlength{\parskip}{0pt plus 0.3pt}%
+ \DTLgidxSymbolDescription
+ \DTLgidxDoSeeOrLocation
+ \DTLgidxChildrenSeeAlso
+ \end{minipage}%
+ }%
+ \fi
+ \fi
+ }%
+ \renewcommand*{\datagidxend}{\egroup}%
+ \renewcommand*{\datagidxgroupsep}{\ifdatagidxshowgroups\indexspace\fi}%
+ \renewcommand{\datagidxgroupheader}{%
+ \ifdatagidxshowgroups
+ \item
+ \makebox[\linewidth]%
+ {%
+ \textbf{\DTLgidxGroupHeaderTitle{\datagidxcurrentgroup}}%
+ }%
+ \DTLpar\nobreak\@afterheading
+ \fi
+ }%
+ \renewcommand*{\datagidxitem}{%
+ \ifdefempty\datagidxprevgroup
+ {%
+ \datagidxgroupheader
+ }%
+ {%
+ \ifdefequal\datagidxcurrentgroup\datagidxprevgroup
+ {%
+ }%
+ {%
+ \datagidxgroupsep
+ \datagidxgroupheader
+ }%
+ }%
+ \hangindent0pt\relax
+ \parindent0pt\relax
+ \makebox[\datagidxnamewidth][l]%
+ {%
+ \datagidxtarget{\Label}%
+ {%
+ \DTLgidxNameFont{\DTLgidxNameCase{\Name}}%
+ \DTLgidxPostName
+ }%
+ }%
+ \datagidx@item@body
+ \par
+ }%
+ \renewcommand*{\datagidxchildstart}%
+ {%
+ \bgroup
+ \setlength{\parindent}{0pt}%
+ \setlength{\parskip}{0pt plus 0.3pt}%
+ \setlength{\datagidxnamewidth}{0pt}%
+ \DTLforeach*{\DTLgidxCurrentdb}%
+ {\Name=Name,\Location=Location,\See=See,\SeeAlso=SeeAlso,%
+ \Parent=Parent}%
+ {%
+ \DTLifnull{\Parent}%
+ {%
+ \datagidx@doifdisplayed
+ {%
+ \settowidth{\dimen@}%
+ {%
+ \DTLgidxChildStyle
+ {%
+ \DTLgidxNameFont{\DTLgidxNameCase{\Name}}%
+ }%
+ }%
+ \ifdim\dimen@>\datagidxnamewidth\relax
+ \datagidxnamewidth=\dimen@\relax
+ \fi
+ }%
+ }%
+ {}%
+ }%
+ \settowidth{\dimen@}{\DTLgidxChildStyle\DTLgidxPostChildName}%
+ \addtolength{\datagidxnamewidth}{\dimen@}%
+ \setlength{\datagidxdescwidth}{\linewidth}%
+ \addtolength{\datagidxdescwidth}{-\datagidxnamewidth}%
+ }%
+ \renewcommand{\datagidxchildend}{\egroup}%
+ \renewcommand*{\datagidxchilditem}{%
+ \hangindent0pt\relax
+ \parindent0pt\relax
+ \refstepcounter{DTLgidxChildCount}%
+ \makebox[\datagidxnamewidth][l]%
+ {%
+ \datagidxtarget{\Label}%
+ {%
+ \DTLgidxChildStyle
+ {%
+ \DTLgidxNameFont{\DTLgidxNameCase{\Name}}%
+ \DTLgidxPostChildName
+ }%
+ }%
+ }%
+ \begin{minipage}[t]{\datagidxdescwidth}%
+ \setlength{\parskip}{0pt plus 0.3pt}%
+ \DTLgidxSymbolDescription
+ \DTLgidxDoSeeOrLocation
+ \DTLgidxChildrenSeeAlso
+ \end{minipage}%
+ \par
+ }%
+}
+\newcommand*{\datagidx@style@gloss}{%
+ \renewcommand*{\datagidxstart}%
+ {%
+ \bgroup
+ \setlength{\parindent}{0pt}%
+ \setlength{\parskip}{0pt plus 0.3pt}%
+ \setlength{\datagidxnamewidth}{0pt}%
+ \DTLforeach*{\DTLgidxCurrentdb}%
+ {\Name=Name,\Location=Location,\See=See,\SeeAlso=SeeAlso,%
+ \Parent=Parent}%
+ {%
+ \DTLifnull{\Parent}%
+ {%
+ \datagidx@doifdisplayed
+ {%
+ \settowidth{\dimen@}{\DTLgidxNameFont{\DTLgidxNameCase{\Name}}}%
+ \ifdim\dimen@>\datagidxnamewidth\relax
+ \datagidxnamewidth=\dimen@\relax
+ \fi
+ }%
+ }%
+ {}%
+ }%
+ \settowidth{\dimen@}{\DTLgidxPostName}%
+ \addtolength{\datagidxnamewidth}{\dimen@}%
+ \setlength{\datagidxdescwidth}{\linewidth}%
+ \addtolength{\datagidxdescwidth}{-\datagidxnamewidth}%
+ }%
+ \renewcommand*{\datagidxend}{\egroup}%
+ \renewcommand*{\datagidxgroupsep}{\ifdatagidxshowgroups\indexspace\fi}%
+ \renewcommand{\datagidxgroupheader}{%
+ \ifdatagidxshowgroups
+ \item
+ \makebox[\linewidth]%
+ {%
+ \textbf{\DTLgidxGroupHeaderTitle{\datagidxcurrentgroup}}%
+ }%
+ \DTLpar\nobreak\@afterheading
+ \fi
+ }%
+ \renewcommand*{\datagidxitem}{%
+ \ifdefempty\datagidxprevgroup
+ {%
+ \datagidxgroupheader
+ }%
+ {%
+ \ifdefequal\datagidxcurrentgroup\datagidxprevgroup
+ {%
+ }%
+ {%
+ \datagidxgroupsep
+ \datagidxgroupheader
+ }%
+ }%
+ \hangindent0pt\relax
+ \parindent0pt\relax
+ \makebox[\datagidxnamewidth][l]%
+ {%
+ \datagidxtarget{\Label}%
+ {%
+ \DTLgidxNameFont{\DTLgidxNameCase{\Name}}%
+ \DTLgidxPostName
+ }%
+ }%
+ \begin{minipage}[t]{\datagidxdescwidth}%
+ \setlength{\parskip}{0pt plus 0.3pt}%
+ \@tempswatrue
+ \ifdefempty{\Description}%
+ {%
+ \ifdefempty{\Symbol}%
+ {%
+ \ifdefempty{\Location}{\@tempswafalse}{}%
+ }%
+ {}%
+ }%
+ {}%
+ \if@tempswa
+ \DTLgidxSymbolDescription
+ \DTLgidxDoSeeOrLocation
+ \DTLgidxSeeAlso
+ \else
+ \mbox{}%
+ \fi
+ \DTLgidxChildrenSeeAlso
+ \end{minipage}%
+ \par
+ }%
+ \renewcommand*{\datagidxchildstart}%
+ {%
+ \bgroup
+ \def\datagidx@childsep{}%
+ \setcounter{DTLgidxChildCount}{0}%
+ }%
+ \renewcommand{\datagidxchildend}{\DTLgidxPostChild\egroup}%
+ \renewcommand*{\datagidxchilditem}{%
+ \datagidx@childsep
+ \refstepcounter{DTLgidxChildCount}%
+ \datagidxtarget{\Label}%
+ {%
+ \DTLgidxChildStyle
+ {%
+ \DTLgidxNameFont{\DTLgidxNameCase{\Name}}%
+ \DTLgidxPostChildName
+ }%
+ }%
+ \DTLgidxSymbolDescription
+ \DTLgidxDoSeeOrLocation
+ \DTLgidxChildrenSeeAlso
+ \let\datagidx@childsep\DTLgidxChildSep
+ }%
+}
+\newcommand*{\DTLgidxChildSep}{ }
+\newcommand*{\DTLgidxPostChild}{}
+\ifdef\chapter
+{%
+ \newcommand\DTLgidxDictHead{%
+ \chapter{\DTLgidxGroupHeaderTitle{\datagidxcurrentgroup}}%
+ }%
+}%
+{%
+ \newcommand\DTLgidxDictHead{%
+ \section{\DTLgidxGroupHeaderTitle{\datagidxcurrentgroup}}%
+ }%
+}
+\newcommand*{\DTLgidxCategoryNameFont}[1]{#1}
+\newcommand*{\DTLgidxCategorySep}{\space}
+\newcommand*{\DTLgidxSubCategorySep}{\space}
+\newcommand*{\datagidxdictindent}{1em}
+\newcommand{\DTLgidxDictPostItem}{\par}
+\newcommand*{\datagidx@style@dict}{%
+ \renewcommand*{\datagidxstart}%
+ {%
+ \bgroup
+ \setlength{\parindent}{0pt}%
+ \setlength{\parskip}{0pt plus 0.3pt}%
+ \dimen@=\linewidth
+ \advance\dimen@ by -\datagidxdictindent\relax
+ \dtl@tmplength=\datagidxdictindent\relax
+ \xdef\datagidxdictparshape{%
+ \noexpand\parshape=2 0pt \the\linewidth\space
+ \the\dtl@tmplength\space \the\dimen@\relax
+ }%
+ \datagidx@level=1\relax
+ \raggedright
+ }%
+ \renewcommand*{\datagidxend}{\egroup}%
+ \renewcommand*{\datagidxgroupsep}{}%
+ \renewcommand{\datagidxgroupheader}{%
+ \ifdatagidxshowgroups
+ \datagidxend
+ \datagidx@postend
+ \DTLgidxDictHead
+ \datagidx@prestart
+ \datagidxstart
+ \fi
+ }%
+ \renewcommand*{\datagidxitem}{%
+ \ifdefempty\datagidxprevgroup
+ {%
+ \datagidxgroupheader
+ }%
+ {%
+ \ifdefequal\datagidxcurrentgroup\datagidxprevgroup
+ {%
+ }%
+ {%
+ \datagidxgroupsep
+ \datagidxgroupheader
+ }%
+ }%
+ \datagidxdictparshape
+ \datagidxtarget{\Label}%
+ {%
+ \DTLgidxNameFont{\DTLgidxNameCase{\Name}}%
+ }%
+ \DTLgidxPostName
+ \let\datagidx@catsep\@empty
+ \let\datagidx@subcatsep\@empty
+ \DTLgidxSymbolDescription
+ \DTLgidxChildrenSeeAlso
+ \DTLgidxDictPostItem
+ }%
+ \renewcommand*{\datagidxchildstart}%
+ {%
+ \bgroup
+ }%
+ \renewcommand*{\datagidxchildend}{\egroup}%
+ \renewcommand*{\datagidxchilditem}{%
+ \ifnum\datagidx@level=2\relax
+ \datagidx@catsep
+ \let\datagidx@catsep\DTLgidxCategorySep
+ \let\datagidx@subcapsep\@empty
+ \datagidxtarget{\Label}%
+ {%
+ \DTLgidxChildStyle
+ {%
+ \DTLgidxCategoryNameFont{\DTLgidxNameCase{\Name}}%
+ \DTLgidxPostChildName
+ }%
+ }%
+ \setcounter{DTLgidxChildCount}{0}%
+ \else
+ \datagidx@subcatsep
+ \let\datagidx@subcatsep\DTLgidxSubCategorySep
+ \refstepcounter{DTLgidxChildCount}%
+ \DTLgidxChildCountLabel
+ \DTLgidxPostChildName
+ \fi
+ \DTLgidxSymbolDescription
+ \DTLgidxDoSeeOrLocation
+ \DTLgidxChildrenSeeAlso
+ }%
+ \renewcommand*{\datagidxseealsostart}%
+ {%
+ \bgroup
+ \setlength{\parindent}{0pt}%
+ \setlength{\parskip}{0pt plus 0.3pt}%
+ \setlength{\dimen@}{\datagidxindent}%
+ \advance\datagidx@level by 1\relax
+ \multiply\dimen@ by \datagidx@level\relax
+ \@idxitem\hspace*{\dimen@}%
+ }%
+ \renewcommand{\datagidxseealsoend}{\egroup}%
+}
+\newcommand*{\dtldofirstlocation}{%
+ \@for\dtl@thisloc:=\Location\do{%
+ \ifdefempty\dtl@thisloc
+ {}%
+ {%
+ \expandafter\datagidx@getlocation\dtl@thisloc
+ \datagidxlink{\datagidx@current@target}%
+ {%
+ \datagidx@formatlocation
+ \datagidx@current@format\datagidx@current@locationstring
+ }%
+ \@endfortrue
+ }%
+ }%
+}
+\newcommand*{\datagidx@formatlocation}[2]{%
+ \ifdefempty{#1}%
+ {#2}%
+ {%
+ \ifcsdef{#1}%
+ {%
+ \csuse{#1}{#2}%
+ }%
+ {%
+ \PackageWarning{datagidx}{Unknown format `#1'}%
+ #2%
+ }%
+ }%
+}
+\newcommand*{\dtldolocationlist}{%
+ \DTLifnull{\Location}%
+ {}%
+ {%
+ \def\datagidx@prev@location{-1}%
+ \def\datagidx@prev@locationstring{}%
+ \def\datagidx@prev@format{}%
+ \def\datagidx@prev@locationformat{}%
+ \def\datagidx@prev@prefix{}%
+ \def\datagidx@prev@target{}%
+ \def\datagidx@location@sep{}%
+ \def\datagidx@location@start{-1}%
+ \expandafter\forcsvlist\expandafter\datagidx@parse@location
+ \expandafter{\Location}%
+ \do@prevlocation % tidy up loose ends
+ }%
+}
+\newif\if@dtl@sequential
+\newcommand*\datagidx@getlocdo[1]{%
+ \ifdefempty\datagidx@current@location
+ {}%
+ {%
+ \eappto\datagidx@current@prefix{%
+ \datagidx@current@location\datagidx@compositor
+ }%
+ }%
+ \def\datagidx@current@location{#1}%
+}
+\def\datagidx@getlocation[#1]#2#3{%
+ \def\datagidx@current@locationstring{#2}%
+ \bgroup
+ \datagidx@escapelocationformat
+ \xdef\datagidx@current@locationformat{#2}%
+ \datagidx@clearlocationformat
+ \xdef\datagidx@current@location{#2}%
+ \egroup
+ \let\datagidx@list\datagidx@current@location
+ \def\datagidx@current@prefix{}%
+ \def\datagidx@current@location{}%
+ \let\do\datagidx@getlocdo
+ \expandafter\datagidx@docomplist
+ \expandafter{\datagidx@list}%
+ \def\datagidx@current@format{#1}%
+ \def\datagidx@current@target{#3}%
+}
+\newcommand*{\datagidx@parse@location}[1]{%
+ \datagidx@getlocation#1\relax
+ \ifdefequal{\datagidx@prev@locationstring}{\datagidx@current@locationstring}%
+ {%
+ \ifstrequal{\datagidx@prev@format}{\datagidx@current@format}
+ {%
+ }%
+ {%
+ \ifdefempty{\datagidx@current@format}
+ {%
+ }%
+ {%
+ \ifdefempty{\datagidx@prev@format}
+ {%
+ \let\datagidx@prev@format\datagidx@current@format
+ }%
+ {%
+ \PackageWarning{datagidx}%
+ {%
+ Conflicting location formats `\datagidx@prev@format' and
+ `\datagidx@current@format' for location `\datagidx@current@location'%
+ }%
+ }%
+ }%
+ }%
+ }%
+ {%
+ \@datagidx@parse@location
+ }%
+}
+\newcommand*{\@datagidx@parse@location}{%
+ \@dtl@sequentialtrue
+ \ifdefequal{\datagidx@prev@format}{\datagidx@current@format}
+ {%
+ \ifdefequal{\datagidx@prev@locationformat}{\datagidx@current@locationformat}
+ {%
+ \ifdefequal{\datagidx@prev@prefix}{\datagidx@current@prefix}
+ {%
+ }%
+ {%
+ \@dtl@sequentialfalse
+ }%
+ }%
+ {%
+ \@dtl@sequentialfalse
+ }%
+ }%
+ {%
+ \@dtl@sequentialfalse
+ }%
+ \if@dtl@sequential
+ \ifnumequal{\datagidx@prev@location+1}{\datagidx@current@location}%
+ {%
+ \ifdefequal
+ \datagidx@current@locationformat
+ \datagidx@prev@locationformat
+ {%
+ \@dtl@sequentialtrue
+ }%
+ {%
+ \@dtl@sequentialfalse
+ }%
+ }%
+ {%
+ \@dtl@sequentialfalse
+ }%
+ \fi
+ \if@dtl@sequential
+ \ifnumequal{\datagidx@location@start}{-1}%
+ {%
+ \let\datagidx@location@start\datagidx@prev@location
+ \let\datagidx@location@startval\datagidx@prev@locationstring
+ \let\datagidx@location@format\datagidx@prev@format
+ \let\datagidx@location@target\datagidx@prev@target
+ }%
+ {%
+ }%
+ \else
+ \do@prevlocation
+ \fi
+ \let\datagidx@prev@location\datagidx@current@location
+ \let\datagidx@prev@format\datagidx@current@format
+ \let\datagidx@prev@prefix\datagidx@current@prefix
+ \let\datagidx@prev@locationformat\datagidx@current@locationformat
+ \let\datagidx@prev@locationstring\datagidx@current@locationstring
+ \let\datagidx@prev@target\datagidx@current@target
+}
+\newcommand*{\DTLgidxLocationSep}{, }
+\newcommand*{\DTLgidxLocationF}[2]{%
+ #1\DTLgidxLocationSep#2%
+}
+\newcommand*{\DTLgidxLocationFF}[2]{%
+ #1--#2%
+}
+\newcommand*{\do@prevlocation}{%
+ \ifnumequal{\datagidx@location@start}{-1}%
+ {%
+ \ifdefempty{\datagidx@prev@locationstring}%
+ {}%
+ {%
+ \datagidx@location@sep
+ \datagidxlink{\datagidx@prev@target}%
+ {%
+ \datagidx@formatlocation
+ \datagidx@prev@format\datagidx@prev@locationstring
+ }%
+ \def\datagidx@location@sep{\DTLgidxLocationSep}%
+ }%
+ }%
+ {%
+ \datagidx@location@sep
+ \do@locrange
+ \def\datagidx@location@sep{\DTLgidxLocationSep}%
+ \def\datagidx@location@start{-1}%
+ }%
+}
+\newcommand*{\do@locrange}{%
+ \ifnumgreater{\datagidx@prev@location}{\datagidx@location@start+1}%
+ {%
+ \DTLgidxLocationFF
+ {%
+ \datagidxlink{\datagidx@location@target}%
+ {%
+ \datagidx@formatlocation
+ \datagidx@location@format\datagidx@location@startval
+ }%
+ }%
+ {%
+ \datagidxlink{\datagidx@prev@target}%
+ {%
+ \datagidx@formatlocation
+ \datagidx@prev@format\datagidx@prev@locationstring
+ }%
+ }%
+ }%
+ {%
+ \DTLgidxLocationF
+ {
+ \datagidxlink{\datagidx@location@target}%
+ {%
+ \datagidx@formatlocation
+ \datagidx@location@format\datagidx@location@startval
+ }%
+ }%
+ {%
+ \datagidxlink{\datagidx@prev@target}%
+ {%
+ \datagidx@formatlocation
+ \datagidx@prev@format\datagidx@prev@locationstring
+ }%
+ }%
+ }%
+}
+\newcommand*{\datagidx@defaultdatabase}{}
+\newcommand*{\DTLgidxSetDefaultDB}[1]{%
+ \renewcommand*{\datagidx@defaultdatabase}{#1}%
+}
+\define@key{newgloss}{heading}{\renewcommand*{\datagidx@heading}{#1}}
+\define@key{newgloss}{postheading}{%
+ \renewcommand*{\datagidx@postheading}{#1}%
+}
+\define@choicekey{newgloss}{balance}[\val\nr]{true,false}[true]{%
+ \ifcase\nr\relax
+ \renewcommand*{\datagidx@multicols}{multicols}%
+ \or
+ \renewcommand*{\datagidx@multicols}{multicols*}%
+ \fi
+}
+\define@key{newgloss}{sort}{\renewcommand*{\datagidx@sort}{#1}}
+\newcommand*{\datagidx@style}{index}
+\define@key{newgloss}{style}{\renewcommand*{\datagidx@style}{#1}}
+\newif\ifdatagidxshowgroups
+\newcommand*{\datagidx@showgroups}{false}
+\define@choicekey{newgloss}{showgroups}{true,false}[true]%
+{%
+ \renewcommand{\datagidx@showgroups}{#1}%
+}%
+\ifundef\newgidx
+{%
+ \newcommand*{\newgidx}{\datagidx@newgidx}
+}%
+{}
+\@onlypreamble\newgidx
+\newcommand*{\datagidx@highopt@newgidx}[3][]{%
+ \edef\datagidx@indexfilename{\datagidxhighoptfilename{#2}}%
+ \IfFileExists{\datagidx@indexfilename}%
+ {%
+ \input{\datagidx@indexfilename}%
+ \bgroup
+ \setkeys{newgloss}{#1}%
+ \datagidx@newgidx@update{#2}{#3}%
+ \egroup
+ }%
+ {%
+ \datagidx@newgidx[#1]{#2}{#3}%
+ }%
+}
+\newcommand*{\datagidx@newgidx}[3][]{%
+\bgroup
+ \setkeys{newgloss}{#1}%
+ \ifdefempty{\datagidx@defaultdatabase}%
+ {\xdef\datagidx@defaultdatabase{#2}}%
+ {}%
+ \DTLgnewdb{#2}%
+ \DTLaddcolumn{#2}{Label}%
+ \DTLaddcolumn{#2}{Location}%
+ \DTLaddcolumn{#2}{CurrentLocation}%
+ \DTLaddcolumn{#2}{FirstId}%
+ \DTLaddcolumn{#2}{Name}%
+ \DTLaddcolumn{#2}{Text}%
+ \DTLaddcolumn{#2}{Parent}%
+ \DTLaddcolumn{#2}{Child}%
+ \DTLaddcolumn{#2}{Description}%
+ \DTLaddcolumn{#2}{Used}%
+ \DTLaddcolumn{#2}{Symbol}%
+ \DTLaddcolumn{#2}{Long}%
+ \DTLaddcolumn{#2}{Short}%
+ \DTLaddcolumn{#2}{See}%
+ \DTLaddcolumn{#2}{SeeAlso}%
+ \datagidx@newgidx@update{#2}{#3}%
+\egroup
+}
+\newcommand*{\datagidx@newgidx@update}[2]{%
+ \DTLnewrow{datagidx}%
+ \DTLnewdbentry{datagidx}{Glossary}{#1}%
+ \DTLnewdbentry{datagidx}{Title}{#2}%
+ {%
+ \dtlexpandnewvalue
+ \DTLnewdbentry{datagidx}{Heading}{\expandonce\datagidx@heading}%
+ \DTLnewdbentry{datagidx}{PostHeading}{\expandonce\datagidx@postheading}%
+ \DTLnewdbentry{datagidx}{MultiCols}{\expandonce\datagidx@multicols}%
+ \DTLnewdbentry{datagidx}{Sort}{\expandonce\datagidx@sort}%
+ \DTLnewdbentry{datagidx}{Style}{\expandonce\datagidx@style}%
+ \DTLnewdbentry{datagidx}{ShowGroups}{\expandonce\datagidx@showgroups}%
+ }%
+}
+\newcommand*{\newterm@label}{}
+\define@key{newterm}{label}{\renewcommand*{\newterm@label}{#1}}
+\newcommand*{\newterm@parent}{}
+\define@key{newterm}{parent}{\renewcommand*{\newterm@parent}{#1}}
+\newcommand*{\newterm@text}{}
+\define@key{newterm}{text}{\renewcommand*{\newterm@text}{#1}}
+\newcommand*{\newterm@description}{}
+\define@key{newterm}{description}{%
+ \renewcommand*{\newterm@description}{#1}%
+}
+\define@key{newterm}{plural}{\def\newterm@plural{#1}}
+\newcommand*{\newterm@sort}{}
+\define@key{newterm}{sort}{\renewcommand*{\newterm@sort}{#1}}
+\newcommand*{\newterm@symbol}{}
+\define@key{newterm}{symbol}{\renewcommand*{\newterm@symbol}{#1}}
+\newcommand*{\newterm@database}{}
+\define@key{newterm}{database}{\renewcommand*{\newterm@database}{#1}}
+\newcommand*{\newterm@long}{}
+\define@key{newterm}{long}{%
+ \renewcommand*{\newterm@long}{#1}%
+ \def\newterm@longplural{#1s}%
+}
+\newcommand*{\newterm@short}{}
+\define@key{newterm}{short}{%
+ \renewcommand*{\newterm@short}{#1}%
+ \def\newterm@shortplural{#1s}%
+}
+\define@key{newterm}{longplural}{%
+ \def\newterm@longplural{#1}%
+}
+\define@key{newterm}{shortplural}{%
+ \def\newterm@shortplural{#1}%
+}
+\newcommand*{\newterm@see}{}
+\define@key{newterm}{see}{%
+ \renewcommand*{\newterm@see}{#1}%
+}
+\newcommand*{\newterm@seealso}{}
+\define@key{newterm}{seealso}{%
+ \renewcommand*{\newterm@seealso}{#1}%
+}
+\newcommand*{\newterm@defaultshook}{}
+\newcommand*{\newterm@extrafields}{}
+\newcommand*{\DTLgidxAssignList}{%
+ \Name=Name,\Description=Description,\Used=Used,\Symbol=Symbol,%
+ \Long=Long,\Short=Short,\LongPlural=LongPlural,\ShortPlural=ShortPlural,%
+ \Location=Location,\See=See,\SeeAlso=SeeAlso,%
+ \Text=Text,\Plural=Plural,\CurrentLocation=CurrentLocation,%
+ \Label=Label,\Parent=Parent,\Children=Child,\FirstId=FirstId,\Sort=Sort%
+}
+\newcommand*{\datagidxtermkeys}{%
+ name,description,symbol,long,short,see,seealso,text,plural,%
+ label,parent,sort%
+}
+\newcommand*\@datagidx@fieldkey@Name{name}%
+\newcommand*\@datagidx@fieldkey@Description{description}%
+\newcommand*\@datagidx@fieldkey@Symbol{symbol}%
+\newcommand*\@datagidx@fieldkey@Long{long}%
+\newcommand*\@datagidx@fieldkey@Short{short}%
+\newcommand*\@datagidx@fieldkey@See{see}%
+\newcommand*\@datagidx@fieldkey@SeeAlso{seealso}%
+\newcommand*\@datagidx@fieldkey@Text{text}%
+\newcommand*\@datagidx@fieldkey@Plural{plural}%
+\newcommand*\@datagidx@fieldkey@Label{label}%
+\newcommand*\@datagidx@fieldkey@Parent{parent}%
+\newcommand*\@datagidx@fieldkey@Sort{sort}%
+\newcommand*{\newtermaddfield}[4][]{%
+ \ifstrempty{#1}%
+ {%
+ \dtlforcolumn{\datagidx@thisidx}{datagidx}{Glossary}%
+ {%
+ \DTLaddcolumn{\datagidx@thisidx}{#2}%
+ }%
+ }%
+ {%
+ \@for\datagidx@thisidx:=#1\do
+ {%
+ \DTLaddcolumn{\datagidx@thisidx}{#2}%
+ }%
+ }%
+ \expandafter\gdef\csname newterm@#3\endcsname{}%
+ \define@key{newterm}{#3}%
+ {%
+ \expandafter\def\csname newterm@#3\endcsname{##1}%
+ }%
+ \gappto\newterm@defaultshook
+ {%
+ \expandafter\protected@edef\csname newterm@#3\endcsname{#4}%
+ }%
+ \gappto\newterm@extrafields
+ {%
+ \protected@edef\datagidx@value{\csname newterm@#3\endcsname}%
+ \DTLnewdbentry{\newterm@database}{#2}{\expandonce\datagidx@value}%
+ }%
+ \xappto\DTLgidxAssignList
+ {%
+ ,\expandafter\noexpand\csname#2\endcsname=#2%
+ }%
+ \xappto\datagidxtermkeys{,#3}%
+ \expandafter\xdef\csname @datagidx@fieldkey@#2\endcsname{#3}%
+ \xappto\datagidxgetchildfields
+ {%
+ \noexpand\dtlgetentryfromcurrentrow
+ {\expandafter\noexpand\csname#2\endcsname}%
+ {\noexpand\dtlcolumnindex{\noexpand\DTLgidxCurrentdb}{#2}}%
+ }%
+}
+\newcommand*{\newtermlabelhook}{}
+\newcommand*{\DTLgidxNoFormat}[1]{#1}
+\newcommand*{\DTLgidxGobble}[1]{}
+\newcommand*{\DTLgidxStripBackslash}[1]{%
+ \expandafter\@gobble\string#1%
+}
+\newcommand*{\DTLgidxName}[2]{%
+ #1\space #2%
+}
+\newcommand*{\DTLgidxNameNum}[1]{\@Roman{#1}}
+\newcommand*{\datagidx@namenum}[1]{\two@digits{#1}}
+\newcommand*{\DTLgidxPlace}[2]{%
+ #2%
+}
+\newcommand*{\DTLgidxSubject}[2]{%
+ #2%
+}
+\newcommand*{\DTLgidxOffice}[2]{%
+ #2 (#1)%
+}
+\newcommand*{\DTLgidxIgnore}[1]{#1}
+\newcommand*{\DTLgidxMac}[1]{#1}
+\newcommand*{\datagidx@mac}[1]{Mac}
+\newcommand*{\DTLgidxSaint}[1]{#1}
+\newcommand*{\datagidx@saint}[1]{Saint}
+\newcommand*{\DTLgidxRank}[2]{#1~#2}
+\newcommand*{\datagidx@rank}[2]{#2.}
+\newcommand*{\DTLgidxParticle}[2]{#1~#2}
+\newcommand*{\datagidx@particle}[2]{#2.}
+\newcommand*{\datagidx@bothoftwo}[2]{#1#2}
+\newcommand*{\datagidx@person}[2]{#2\noexpand\datatoolpersoncomma #1}
+\newcommand*{\datagidx@place}[2]{#2\noexpand\datatoolplacecomma #1}
+\newcommand*{\datagidx@subject}[2]{#2\noexpand\datatoolsubjectcomma #1}
+\newcommand*{\datagidx@paren}[1]{\noexpand\datatoolparenstart #1}
+\newcommand*{\datagidx@invert}[2]{#2, #1}
+\newcommand*{\DTLgidxParen}[1]{\space(#1)}
+\newcommand*{\datagidxwordifygreek}{%
+ \def\alpha{alpha}%
+ \def\beta{beta}%
+ \def\gamma{gamma}%
+ \def\delta{delta}%
+ \def\epsilon{epsilon}%
+ \def\varepsilon{epsilon}%
+ \def\zeta{zeta}%
+ \def\eta{eta}%
+ \def\theta{theta}%
+ \def\vartheta{theta}%
+ \def\iota{iota}%
+ \def\kappa{kappa}%
+ \def\lambda{lambda}%
+ \def\mu{mu}%
+ \def\nu{nu}%
+ \def\xi{xi}%
+ \def\pi{pi}%
+ \def\varpi{pi}%
+ \def\rho{rho}%
+ \def\varrho{rho}%
+ \def\sigma{sigma}%
+ \def\varsigma{sigma}%
+ \def\tau{tau}%
+ \def\upsilon{upsilon}%
+ \def\phi{phi}%
+ \def\varphi{phi}%
+ \def\chi{chi}%
+ \def\psi{psi}%
+ \def\omega{omega}%
+ \def\Gamma{Gamma}%
+ \def\Delta{Delta}%
+ \def\Theta{Theta}%
+ \def\Lambda{Lambda}%
+ \def\Xi{Xi}%
+ \def\Pi{Pi}%
+ \def\Sigma{Sigma}%
+ \def\Upsilon{Upsilon}%
+ \def\Phi{Phi}%
+ \def\Psi{Psi}%
+ \def\Omega{Omega}%
+}
+\newcommand*{\datagidxstripaccents}{%
+ \expandafter\def\csname \encodingdefault-cmd\endcsname##1##2##3{##3}%
+ \expandafter\def\csname OT1-cmd\endcsname##1##2##3{##3}%
+ \expandafter\def\csname T1-cmd\endcsname##1##2##3{##3}%
+ \expandafter\def\csname PD1-cmd\endcsname##1##2##3{##3}%
+ \def\IeC##1{\@gobbletwo##1}%
+}
+\ifdef\newterm
+{%
+}%
+{%
+ \newcommand{\newterm}{\datagidx@newterm}
+}
+\@onlypreamble\newterm
+\newcommand{\datagidx@setfieldvalues}[2]{%
+ \def\newterm@name{#2}%
+ \renewcommand*\newterm@label{#2}%
+ \renewcommand*\newterm@text{#2}%
+ \undef\newterm@plural
+ \renewcommand*{\newterm@description}{}%
+ \renewcommand*{\newterm@sort}{#2}%
+ \renewcommand*{\newterm@symbol}{}%
+ \let\newterm@database\datagidx@defaultdatabase
+ \renewcommand*{\newterm@short}{#2}%
+ \undef\newterm@shortplural
+ \renewcommand*{\newterm@long}{#2}%
+ \undef\newterm@longplural
+ \renewcommand*{\newterm@see}{}%
+ \renewcommand*{\newterm@seealso}{}%
+ \renewcommand*{\newterm@parent}{}%
+ \let\datagidx@orgfield\field
+ \def\field##1{\expandafter\noexpand\csname newterm@##1\endcsname}%
+ \newterm@defaultshook
+ \let\field\datagidx@orgfield
+ \setkeys{newterm}{#1}%
+ \bgroup
+ \let\glsadd\@gobble
+ \let\MakeUppercase\DTLgidxNoFormat
+ \let\MakeTextUppercase\DTLgidxNoFormat
+ \let\MakeLowercase\DTLgidxNoFormat
+ \let\MakeTextLowercase\DTLgidxNoFormat
+ \let\acronymfont\DTLgidxNoFormat
+ \let\textrm\DTLgidxNoFormat
+ \let\texttt\DTLgidxNoFormat
+ \let\textsf\DTLgidxNoFormat
+ \let\textsc\DTLgidxNoFormat
+ \let\textbf\DTLgidxNoFormat
+ \let\textmd\DTLgidxNoFormat
+ \let\textit\DTLgidxNoFormat
+ \let\textsl\DTLgidxNoFormat
+ \let\emph\DTLgidxNoFormat
+ \let\textsuperscript\DTLgidxNoFormat
+ \let~\space
+ \ifdef\andname
+ {%
+ \let\&\andname
+ }%
+ {%
+ \def\&{and}%
+ }%
+ \let\ensuremath\DTLgidxNoFormat
+ \let\DTLgidxParen\@gobble
+ \let\DTLgidxName\@secondoftwo
+ \let\DTLgidxPlace\datagidx@invert
+ \let\DTLgidxSubject\datagidx@invert
+ \let\DTLgidxOffice\@secondoftwo
+ \let\DTLgidxParticle\datagidx@bothoftwo
+ \datagidxwordifygreek
+ \datagidxstripaccents
+ \newtermlabelhook
+ \protected@xdef\newterm@label{\newterm@label}%
+ \let\DTLgidxName\datagidx@person
+ \let\DTLgidxPlace\datagidx@place
+ \let\DTLgidxSubject\datagidx@subject
+ \let\DTLgidxOffice\datagidx@person
+ \let\DTLgidxParen\datagidx@paren
+ \let\DTLgidxMac\datagidx@mac
+ \let\DTLgidxSaint\datagidx@saint
+ \let\DTLgidxIgnore\@gobble
+ \let\DTLgidxRank\datagidx@rank
+ \let\DTLgidxParticle\datagidx@particle
+ \let\DTLgidxNameNum\datagidx@namenum
+ \protected@xdef\newterm@sort{\newterm@sort}%
+ \egroup
+}
+\newcommand*{\datagidx@add@term}[1]{%
+ \global\cslet{datagidxentry@\newterm@label}{\newterm@database}%
+ \DTLnewrow{\newterm@database}%
+ \DTLnewdbentry{\newterm@database}{Name}{#1}%
+ \DTLnewdbentry{\newterm@database}{Used}{0}%
+ {%
+ \dtlexpandnewvalue
+ \DTLnewdbentry{\newterm@database}{Text}{\expandonce\newterm@text}%
+ \DTLnewdbentry{\newterm@database}{Description}{\expandonce\newterm@description}%
+ \DTLnewdbentry{\newterm@database}{Label}{\expandonce\newterm@label}%
+ \DTLnewdbentry{\newterm@database}{Sort}{\expandonce\newterm@sort}%
+ \DTLnewdbentry{\newterm@database}{Symbol}{\expandonce\newterm@symbol}%
+ \DTLnewdbentry{\newterm@database}{Short}{\expandonce\newterm@short}%
+ \DTLnewdbentry{\newterm@database}{Long}{\expandonce\newterm@long}%
+ \ifundef\newterm@plural
+ {%
+ \DTLnewdbentry{\newterm@database}{Plural}{\expandonce\newterm@text s}%
+ }%
+ {%
+ \DTLnewdbentry{\newterm@database}{Plural}{\expandonce\newterm@plural}%
+ }%
+ \ifundef\newterm@shortplural
+ {%
+ \DTLnewdbentry{\newterm@database}{ShortPlural}{\expandonce\newterm@short s}%
+ }%
+ {%
+ \DTLnewdbentry{\newterm@database}{ShortPlural}{\expandonce\newterm@shortplural}%
+ }%
+ \ifundef\newterm@longplural
+ {%
+ \DTLnewdbentry{\newterm@database}{LongPlural}{\expandonce\newterm@long s}%
+ }%
+ {%
+ \DTLnewdbentry{\newterm@database}{LongPlural}{\expandonce\newterm@longplural}%
+ }%
+ \ifdefempty{\newterm@see}%
+ {}%
+ {\DTLnewdbentry{\newterm@database}{See}{\newterm@see}}%
+ \ifdefempty{\newterm@seealso}%
+ {}%
+ {\DTLnewdbentry{\newterm@database}{SeeAlso}{\newterm@seealso}}%
+ \newterm@extrafields
+ \ifdefempty{\newterm@parent}%
+ {}%
+ {%
+ \iftermexists{\newterm@parent}%
+ {%
+ \edef\newterm@parentdatabase{\csuse{datagidxentry@\newterm@parent}}%
+ \ifthenelse{\equal{\newterm@parentdatabase}{\newterm@database}}
+ {%
+ \DTLnewdbentry{\newterm@database}{Parent}{\newterm@parent}%
+ \datagidx@addchild{\newterm@database}{\newterm@parent}{\newterm@label}%
+ }%
+ {%
+ \PackageError{datagidx}%
+ {%
+ Parent entry `\newterm@parent' must belong to the
+ same database as child entry `\newterm@label'%
+ }%
+ {%
+ Parent entry is in database
+ `\newterm@parentdatabase' and child entry is in
+ database `\newterm@database'%
+ }%
+ }%
+ }%
+ {%
+ \PackageError{datagidx}%
+ {%
+ Can't assign parent to `\newterm@label':
+ `\newterm@parent' doesn't exist%
+ }%
+ {}%
+ }%
+ }%
+ }%
+ \global\let\datagidxlastlabel\newterm@label
+}%
+\newcommand{\datagidx@newterm}[2][]{%
+ \datagidx@setfieldvalues{#1}{#2}%
+ \DTLifdbexists{\newterm@database}%
+ {%
+ \iftermexists{\newterm@label}%
+ {%
+ \PackageError{datagidx}{Term `\newterm@label' already
+ exists in database `\newterm@database'}{}%
+ }%
+ {%
+ \datagidx@add@term{#2}%
+ }%
+ }%
+ {%
+ \PackageError{datagidx}%
+ {Glossary/index data base `\newterm@database' doesn't exist}%
+ {%
+ You must define the glossary/index data base before you can
+ add any terms to it.%
+ }%
+ }%
+}
+\newcommand{\datagidx@highopt@newterm}[2][]{%
+ \datagidx@setfieldvalues{#1}{#2}%
+ \DTLifdbexists{\newterm@database}%
+ {%
+ \edef\dtl@dogetrow{%
+ \noexpand\dtlgetrowindex
+ {\noexpand\dtl@rowidx}%
+ {\newterm@database}%
+ {%
+ \dtlcolumnindex{\newterm@database}{Label}%
+ }%
+ {\newterm@label}}%
+ \dtl@dogetrow
+ \ifx\dtl@rowidx\dtlnovalue
+ \datagidx@add@term{#2}%
+ \csdef{datagidx@do@highopt@sort@\newterm@database}{\datagidx@sort}%
+ \else
+ \global\cslet{datagidxentry@\newterm@label}{\newterm@database}%
+ \global\let\datagidxlastlabel\newterm@label
+ \fi
+ }%
+ {%
+ \PackageError{datagidx}%
+ {Glossary/index data base `\newterm@database' doesn't exist}%
+ {%
+ You must define the glossary/index data base before you can
+ add any terms to it.%
+ }%
+ }%
+}
+\newcommand*{\datagidx@addchild}[3]{%
+ \edef\dtl@dogetrow{%
+ \noexpand\dtlgetrowforvalue
+ {#1}%
+ {%
+ \dtlcolumnindex{\newterm@database}{Label}%
+ }%
+ {#2}}%
+ \dtl@dogetrow
+ \dtlgetentryfromcurrentrow
+ {\datagidx@child}%
+ {\dtlcolumnindex{#1}{Child}}%
+ \ifx\datagidx@child\dtlnovalue
+ \edef\datagidx@child{#3}%
+ \else
+ \edef\datagidx@child{\datagidx@child,#3}%
+ \fi
+ \edef\do@update{\noexpand\dtlupdateentryincurrentrow
+ {Child}{\datagidx@child}}%
+ \do@update
+ \dtlrecombine
+}
+\newcommand{\newacro}[3][]{%
+ \newterm
+ [%
+ description={\capitalisewords{#3}},%
+ short={\acronymfont{#2}},%
+ long={#3},%
+ text={\DTLgidxAcrStyle{#3}{\acronymfont{#2}}},%
+ plural={\DTLgidxAcrStyle{#3s}{\acronymfont{#2s}}},%
+ sort={#2},%
+ #1%
+ ]%
+ {\MakeTextUppercase{#2}}%
+}
+\newcommand*{\acronymfont}[1]{#1}
+\newcommand*{\DTLgidxAcrStyle}[2]{#1 (#2)}
+\newcommand{\iftermexists}[3]{%
+ \ifcsdef{datagidxentry@#1}{#2}{#3}%
+}
+\newcommand*{\ifentryused}[3]{%
+ \letcs{\newterm@database}{datagidxentry@#1}%
+ \edef\dtl@dogetrow{%
+ \noexpand\dtlgetrowforvalue
+ {\newterm@database}%
+ {%
+ \dtlcolumnindex{\newterm@database}{Label}%
+ }%
+ {#1}}%
+ \dtl@dogetrow
+ \dtlgetentryfromcurrentrow
+ {\datagidx@value}%
+ {\dtlcolumnindex{\newterm@database}{Used}}%
+ \ifnum\datagidx@value=1\relax
+ #2%
+ \else
+ #3%
+ \fi
+}
+\newcommand*{\glsreset}[1]{%
+ \letcs{\newterm@database}{datagidxentry@#1}%
+ \edef\do@getrow{%
+ \noexpand\dtlgetrowforvalue
+ {\newterm@database}%
+ {\dtlcolumnindex{\newterm@database}{Label}}%
+ {#1}%
+ }%
+ \do@getrow
+ \dtlreplaceentryincurrentrow
+ {0}{\dtlcolumnindex{\newterm@database}{Used}}%
+ \dtlrecombine
+}
+\newcommand*{\glsunset}[1]{%
+ \letcs{\newterm@database}{datagidxentry@#1}%
+ \edef\do@getrow{%
+ \noexpand\dtlgetrowforvalue
+ {\newterm@database}%
+ {\dtlcolumnindex{\newterm@database}{Label}}%
+ {#1}%
+ }%
+ \do@getrow
+ \dtlreplaceentryincurrentrow
+ {1}{\dtlcolumnindex{\newterm@database}{Used}}%
+ \dtlrecombine
+}
+\newcommand*{\glsresetall}[1]{%
+ \def\datagidx@list{}%
+ \dtlforcolumn{\datagidx@label}{#1}{Label}%
+ {%
+ \ifdefempty\datagidx@list
+ {%
+ \let\datagidx@list\datagidx@label
+ }%
+ {%
+ \eappto\datagidx@list{,\datagidx@label}%
+ }%
+ }%
+ \@for\datagidx@thislabel:=\datagidx@list\do
+ {%
+ \glsreset{\datagidx@thislabel}%
+ }%
+}
+\newcommand*{\glsunsetall}[1]{%
+ \def\datagidx@list{}%
+ \dtlforcolumn{\datagidx@label}{#1}{Label}%
+ {%
+ \ifdefempty\datagidx@list
+ {%
+ \let\datagidx@list\datagidx@label
+ }%
+ {%
+ \eappto\datagidx@list{,\datagidx@label}%
+ }%
+ }%
+ \@for\datagidx@thislabel:=\datagidx@list\do
+ {%
+ \glsunset{\datagidx@thislabel}%
+ }%
+}
+\newcount\datagidx@anchorcount
+\newcommand*{\datagidx@formatanchor}[1]{%
+ \ifnum#1<10000
+ 0%
+ \ifnum#1<1000
+ 0%
+ \ifnum#1<100
+ 0%
+ \ifnum#1<10
+ 0%
+ \fi
+ \fi
+ \fi
+ \fi
+ \number#1%
+}
+\newcommand*{\@datagidx@escloc}[2]{%
+ \expandafter\string\csname#1\endcsname{\noexpand\number#2}%
+}
+\newcommand*{\datagidx@escapelocation}{%
+ \def\@arabic{\@datagidx@escloc{@arabic}}%
+ \def\@roman{\@datagidx@escloc{@roman}}%
+ \def\@Roman{\@datagidx@escloc{@Roman}}%
+ \def\@alph{\@datagidx@escloc{@alph}}%
+ \def\@Alph{\@datagidx@escloc{@Alph}}%
+}
+\newcommand*{\datagidx@escapelocationformat}{%
+ \def\@arabic##1{arabic}%
+ \def\@roman##1{roman}%
+ \def\@Roman##1{Roman}%
+ \def\@alph##1{alph}%
+ \def\@Alph##1{Alph}%
+}
+\newcommand*{\datagidx@clearlocationformat}{%
+ \let\@arabic\@firstofone
+ \let\@roman\@firstofone
+ \let\@Roman\@firstofone
+ \let\@alph\@firstofone
+ \let\@Alph\@firstofone
+}
+\newcommand*{\DTLgidxAddLocationType}[1]{%
+ \gappto\datagidx@escapelocation{%
+ \expandafter\def\csname#1\endcsname{\@datagidx@escloc{#1}}%
+ }%
+ \gappto\datagidx@escapelocationformat{%
+ \expandafter\def\csname#1\endcsname##1{#1}%
+ }%
+ \gappto\datagidx@clearlocationformat{%
+ \expandafter\let\csname#1\endcsname\@firstofone
+ }%
+}
+\@onlypreamble\DTLgidxAddLocationType
+\newcommand*{\datagidx@target}[4]{%
+ \global\advance\datagidx@anchorcount by 1\relax
+ \edef\@datagidx@target{datagidx.\datagidx@formatanchor\datagidx@anchorcount}%
+ \ifstrempty{#3}
+ {%
+ \datagidx@write@usedentry{#1}{}%
+ }%
+ {%
+ \bgroup
+ \datagidx@escapelocation
+ \protected@edef\@datagidx@dowriteaux{%
+ \noexpand\datagidx@write@usedentry{#1}%
+ {[#2]{#3}{\@datagidx@target}}%
+ }%
+ \@datagidx@dowriteaux
+ \egroup
+ }%
+ \ifdef\hypertarget
+ {%
+ \datagidxshowifdraft
+ {%
+ [\@datagidx@target]%
+ \discretionary{}{}{}%
+ }%
+ \bgroup
+ \let\glsadd\@gobble
+ \settoheight\dimen@{#4}%
+ \raisebox{\dimen@}%
+ {%
+ \datagidxtarget{\@datagidx@target}{}%
+ }%
+ \egroup
+ }%
+ {%
+ }%
+ \datagidxshowifdraft{[#1]\discretionary{}{}{}}%
+ #4%
+}
+\DeclareRobustCommand*{\glsdispentry}[2]{%
+ \DTLgidxFetchEntry{\datagidx@dispentryval}{#1}{#2}%
+ \datagidx@dispentryval
+}
+\DeclareRobustCommand*{\Glsdispentry}[2]{%
+ \DTLgidxFetchEntry{\datagidx@dispentryval}{#1}{#2}%
+ \xmakefirstuc\datagidx@dispentryval
+}
+\newcommand*{\DTLgidxFetchEntry}[3]{%
+ \ifcsdef{datagidxentry@#2}%
+ {%
+ \letcs{\newterm@database}{datagidxentry@#2}%
+ \edef\do@getrow{%
+ \noexpand\dtlgetrowforvalue
+ {\newterm@database}%
+ {\dtlcolumnindex{\newterm@database}{Label}}%
+ {#2}%
+ }%
+ \do@getrow
+ \dtlgetentryfromcurrentrow
+ {#1}%
+ {\dtlcolumnindex{\newterm@database}{#3}}%
+ }%
+ {%
+ \PackageError{datagidx}{No term `#2' defined}{}%
+ }%
+}
+\newcommand*{\datagidx@parse@formatlabel}[1]{%
+ \datagidx@parse@format@label@#1\@endparse@formatlabel@
+}
+\newcommand*\datagidx@parse@format@label@{%
+ \@ifnextchar[{\datagidx@parse@formatlabel@}{\datagidx@parse@formatlabel@[]}%
+}
+\def\datagidx@parse@formatlabel@[#1]#2\@endparse@formatlabel@{%
+ \def\datagidx@format{#1}%
+ \def\datagidx@label{#2}%
+}
+\newcommand*{\datagidx@use@entry}[2]{%
+ \ifcsundef{datagidxentry@\datagidx@label}
+ {%
+ \PackageError{datagidx}{Entry `\datagidx@label' doesn't exist}{}%
+ }%
+ {%
+ \letcs{\newterm@database}{datagidxentry@\datagidx@label}%
+ \edef\do@getrow{%
+ \noexpand\dtlgetrowforvalue
+ {\newterm@database}%
+ {\dtlcolumnindex{\newterm@database}{Label}}%
+ {\datagidx@label}%
+ }%
+ \do@getrow
+ \dtlgetentryfromcurrentrow
+ {\datagidx@id}%
+ {\dtlcolumnindex{\newterm@database}{FirstId}}%
+ \DTLifnull\datagidx@id
+ {%
+ \count@=\datagidx@anchorcount\relax
+ \advance\count@ by 1\relax
+ \dtlappendentrytocurrentrow{FirstId}{\datagidx@formatanchor\count@}%
+ }%
+ {}%
+ \dtlgetentryfromcurrentrow
+ {\datagidx@value}%
+ {\dtlcolumnindex{\newterm@database}{#1}}%
+ \dtlreplaceentryincurrentrow
+ {1}{\dtlcolumnindex{\newterm@database}{Used}}%
+ \dtlgetentryfromcurrentrow
+ {\datagidx@parent}%
+ {\dtlcolumnindex{\newterm@database}{Parent}}%
+ \dtlrecombine
+ \datagidx@markparent{\newterm@database}{\datagidx@parent}%
+ \datagidx@target{\datagidx@label}{\datagidx@format}%
+ {\csuse{the\DTLgidxCounter}}{#2}%
+ }%
+}
+\newcommand*{\DTLgidxCounter}{page}
+\newcommand*{\datagidx@markparent}[2]{%
+ \ifx#2\dtlnovalue
+ \else
+ \datagidx@target{#2}{}{}{}%
+ \edef\do@getrow{%
+ \noexpand\dtlgetrowforvalue
+ {#1}%
+ {\dtlcolumnindex{#1}{Label}}%
+ {#2}}%
+ \do@getrow
+ \dtlgetentryfromcurrentrow
+ {\datagidx@id}%
+ {\dtlcolumnindex{\newterm@database}{FirstId}}%
+ \DTLifnull\datagidx@id
+ {%
+ \dtlappendentrytocurrentrow{FirstId}{\datagidx@formatanchor\datagidx@anchorcount}%
+ }%
+ {}%
+ \dtlgetentryfromcurrentrow
+ {\datagidx@parent}%
+ {\dtlcolumnindex{#1}{Parent}}%
+ \dtlrecombine
+ \datagidx@markparent{#1}{\datagidx@parent}%
+ \fi
+}
+\newcommand*{\datagidx@write@usedentry}[2]{%
+ \datagidx@do@highopt@update{#1}%
+ \protected@write{\@auxout}{}%
+ {%
+ \string\datagidx@usedentry{#1}{#2}%
+ }%
+ \protected@edef\datagidx@do@usedentry{%
+ \noexpand\datagidx@usedentry[CurrentLocation]{#1}{#2}%
+ }%
+ \datagidx@do@usedentry
+}
+\newcommand*{\datagidx@usedentry}[3][Location]{%
+ \ifcsundef{datagidxentry@#2}%
+ {%
+ \PackageWarning{datagidx}{No term `#2' defined. Ignoring}%
+ }%
+ {%
+ \letcs{\newterm@database}{datagidxentry@#2}%
+ \edef\do@getrow{%
+ \noexpand\dtlgetrowforvalue
+ {\newterm@database}%
+ {\dtlcolumnindex{\newterm@database}{Label}}%
+ {#2}%
+ }%
+ \do@getrow
+ \dtlgetentryfromcurrentrow
+ {\datagidx@loc}%
+ {\dtlcolumnindex{\newterm@database}{#1}}%
+ \ifx\datagidx@loc\dtlnovalue
+ \def\datagidx@loc{#3}%
+ \dtlappendentrytocurrentrow{#1}{\expandonce\datagidx@loc}%
+ \else
+ \ifdefempty{\datagidx@loc}%
+ {%
+ \def\datagidx@loc{#3}%
+ }%
+ {%
+ \ifstrempty{#3}%
+ {}%
+ {%
+ \appto\datagidx@loc{,#3}%
+ }%
+ }%
+ \expandafter\dtlreplaceentryincurrentrow\expandafter
+ {\datagidx@loc}%
+ {\dtlcolumnindex{\newterm@database}{#1}}%
+ \fi
+ \dtlrecombine
+ }%
+}
+\newcommand*{\datagidx@save@loc}[2]{%
+ \bgroup
+ \datagidx@escapelocation
+ \xdef\datagidx@tmp{#2}%
+ \egroup
+ \expandafter\xdef\csname datagidx@prev@loc@#1\endcsname{\datagidx@tmp}%
+}
+\newcommand*{\glsadd}[1]{%
+ \NoCaseChange{\@glsadd{#1}}%
+}
+\DeclareRobustCommand*{\@glsadd}[1]{%
+ \ifcsundef{datagidxentry@\datagidx@label}%
+ {%
+ \PackageError{datagidx}{Term `\datagidx@label' doesn't exist}{}%
+ }%
+ {%
+ \datagidx@parse@formatlabel{#1}%
+ \datagidx@target{\datagidx@label}{\datagidx@format}%
+ {\csuse{the\DTLgidxCounter}}{}%
+ \letcs{\newterm@database}{datagidxentry@\datagidx@label}%
+ \edef\do@getrow{%
+ \noexpand\dtlgetrowforvalue
+ {\newterm@database}%
+ {\dtlcolumnindex{\newterm@database}{Label}}%
+ {\datagidx@label}%
+ }%
+ \do@getrow
+ \dtlreplaceentryincurrentrow
+ {1}{\dtlcolumnindex{\newterm@database}{Used}}%
+ \dtlgetentryfromcurrentrow
+ {\datagidx@id}%
+ {\dtlcolumnindex{\newterm@database}{FirstId}}%
+ \DTLifnull\datagidx@id
+ {%
+ \dtlappendentrytocurrentrow{FirstId}{\datagidx@formatanchor\datagidx@anchorcount}%
+ }%
+ {}%
+ \dtlrecombine
+ }%
+}
+\newcount\datagidx@count
+\newcommand*{\glsaddall}[1]{%
+ \DTLifdbexists{#1}%
+ {%
+ \edef\datagidx@rowcount{\number\DTLrowcount{#1}}%
+ \datagidx@count=0\relax
+ \loop
+ \advance\datagidx@count by 1\relax
+ \dtlgetrow{#1}{\datagidx@count}%
+ \dtlgetentryfromcurrentrow
+ {\datagidx@label}%
+ {\dtlcolumnindex{\newterm@database}{Label}}%
+ \bgroup
+ \undef\hypertarget
+ \datagidx@target{\datagidx@label}{}{}{}%
+ \egroup
+ \dtlreplaceentryincurrentrow
+ {1}{\dtlcolumnindex{\newterm@database}{Used}}%
+ \dtlgetentryfromcurrentrow
+ {\datagidx@id}%
+ {\dtlcolumnindex{\newterm@database}{FirstId}}%
+ \DTLifnull\datagidx@id
+ {%
+ \dtlappendentrytocurrentrow{FirstId}{\datagidx@formatanchor\datagidx@anchorcount}%
+ }%
+ {}%
+ \dtlrecombine
+ \ifnum\datagidx@count<\datagidx@rowcount
+ \repeat
+ }%
+ {%
+ \PackageError{datagidx}{Database `#1' doesn't exist}{}%
+ }%
+}
+\DeclareRobustCommand*{\useentry}[2]{%
+ \datagidx@parse@formatlabel{#1}%
+ \DTLgidxFetchEntry{\datagidx@value}{\datagidx@label}{#2}%
+ \datagidxlink{\datagidx@label}%
+ {%
+ \datagidx@use@entry{#2}{\datagidx@value}%
+ }%
+}
+\DeclareRobustCommand*{\Useentry}[2]{%
+ \datagidx@parse@formatlabel{#1}%
+ \DTLgidxFetchEntry{\datagidx@value}{\datagidx@label}{#2}%
+ \datagidxlink{\datagidx@label}%
+ {%
+ \datagidx@use@entry{#2}{\xmakefirstuc{\datagidx@value}}%
+ }%
+}
+\DeclareRobustCommand*{\USEentry}[2]{%
+ \datagidx@parse@formatlabel{#1}%
+ \DTLgidxFetchEntry{\datagidx@value}{\datagidx@label}{#2}%
+ \datagidxlink{\datagidx@label}%
+ {%
+ \datagidx@use@entry{#2}{\MakeTextUppercase{\datagidx@value}}%
+ }%
+}
+\DeclareRobustCommand*{\useentrynl}[2]{%
+ \datagidx@parse@formatlabel{#1}%
+ \DTLgidxFetchEntry{\datagidx@value}{\datagidx@label}{#2}%
+ \datagidx@use@entry{#2}{\datagidx@value}%
+}
+\DeclareRobustCommand*{\Useentrynl}[2]{%
+ \datagidx@parse@formatlabel{#1}%
+ \DTLgidxFetchEntry{\datagidx@value}{\datagidx@label}{#2}%
+ \datagidx@use@entry{#2}{\xmakefirstuc{\datagidx@value}}%
+}
+\DeclareRobustCommand*{\USEentrynl}[2]{%
+ \datagidx@parse@formatlabel{#1}%
+ \DTLgidxFetchEntry{\datagidx@value}{\datagidx@label}{#2}%
+ \datagidx@use@entry{#2}{\MakeTextUppercase{\datagidx@value}}%
+}
+\DeclareRobustCommand*{\gls}[1]{\useentry{#1}{Text}}
+\DeclareRobustCommand*{\glspl}[1]{\useentry{#1}{Plural}}
+\DeclareRobustCommand*{\Gls}[1]{\Useentry{#1}{Text}}
+\DeclareRobustCommand*{\Glspl}[1]{\Useentry{#1}{Plural}}
+\DeclareRobustCommand*{\glsnl}[1]{\useentrynl{#1}{Text}}
+\DeclareRobustCommand*{\glsplnl}[1]{\useentrynl{#1}{Plural}}
+\DeclareRobustCommand*{\Glsnl}[1]{\Useentrynl{#1}{Text}}
+\DeclareRobustCommand*{\Glsplnl}[1]{\Useentrynl{#1}{Plural}}
+\DeclareRobustCommand*{\glssym}[1]{\useentry{#1}{Symbol}}
+\DeclareRobustCommand*{\Glssym}[1]{\Useentry{#1}{Symbol}}
+\newcommand*{\DTLgidxFormatAcr}[3]{%
+ \DTLgidxAcrStyle{\glsdispentry{#1}{#2}}{\useentry{#1}{#3}}%
+}
+\newcommand*{\DTLgidxFormatAcrUC}[3]{%
+ \DTLgidxAcrStyle{\Glsdispentry{#1}{#2}}{\useentry{#1}{#3}}%
+}
+\DeclareRobustCommand*{\acr}[1]{%
+ \ifentryused{#1}%
+ {\useentry{#1}{Short}}%
+ {\DTLgidxFormatAcr{#1}{Long}{Short}}%
+}
+\DeclareRobustCommand*{\acrpl}[1]{%
+ \ifentryused{#1}%
+ {\useentry{#1}{ShortPlural}}%
+ {\DTLgidxFormatAcr{#1}{LongPlural}{ShortPlural}}%
+}
+\DeclareRobustCommand*{\Acr}[1]{%
+ \ifentryused{#1}%
+ {\Useentry{#1}{Short}}%
+ {\DTLgidxFormatAcrUC{#1}{Long}{Short}}%
+}
+\DeclareRobustCommand*{\Acrpl}[1]{%
+ \ifentryused{#1}%
+ {\Useentry{#1}{ShortPlural}}%
+ {\DTLgidxFormatAcrUC{#1}{LongPlural}{ShortPlural}}%
+}
+\define@key{printterms}{database}{\renewcommand*{\newterm@database}{#1}}
+\define@choicekey{printterms}{postdesc}[\val\nr]%
+ {none,dot}%
+ {%
+ \datagidx@setpostdesc\nr
+ }
+\define@choicekey{printterms}{prelocation}[\val\nr]%
+ {none,enspace,space,dotfill,hfill}%
+ {%
+ \datagidx@setprelocation\nr
+ }
+\define@choicekey{printterms}{location}[\val\nr]%
+ {hide,list,first}%
+ {\datagidx@setlocation\nr}
+\define@choicekey{printterms}{symboldesc}[\val\nr]%
+ {symbol,desc,(symbol) desc,desc (symbol),symbol desc,desc symbol}%
+ {\datagidx@formatsymdesc\nr}
+\define@key{printterms}{columns}%
+{%
+ \DTLgidxSetColumns{#1}%
+}
+\define@choicekey{printterms}{namecase}[\val\nr]%
+ {nochange,uc,lc,firstuc,capitalise}%
+ {%
+ \datagidx@setnamecase\nr
+ }
+\define@key{printterms}{namefont}%
+{%
+ \renewcommand*{\DTLgidxNameFont}[1]{{#1{##1}}}%
+}
+\define@key{printterms}{postname}
+{%
+ \renewcommand*{\DTLgidxPostName}{#1}%
+}
+\define@choicekey{printterms}{see}[\val\nr]%
+ {comma,brackets,dot,space,nosep,semicolon,location}%
+ {\datagidx@setsee\nr}
+\define@choicekey{printterms}{child}[\val\nr]%
+ {named,noname}%
+ {%
+ \datagidx@setchildstyle\nr
+ }
+\define@key{printterms}{symbolwidth}%
+{%
+ \setlength{\datagidxsymbolwidth}{#1}%
+}
+\define@key{printterms}{locationwidth}%
+{%
+ \setlength{\datagidxlocationwidth}{#1}%
+}
+\define@choicekey{printterms}{childsort}[\val\nr]%
+ {true,false}[true]%
+ {%
+ \datagidx@setchildsort\nr
+ }
+\define@choicekey{printterms}{showgroups}{true,false}[true]{%
+ \appto\newterm@styles{showgroups={#1},}%
+}
+\define@key{printterms}{style}{\appto\newterm@styles{style={#1},}}
+\define@key{printterms}{heading}{\appto\newterm@styles{heading={#1},}}
+\define@key{printterms}{postheading}{%
+ \appto\newterm@styles{postheading={#1},}%
+}
+\define@key{printterms}{sort}{\appto\newterm@styles{sort={#1},}}
+\define@choicekey{printterms}{balance}[\val\nr]{true,false}[true]{%
+ \ifcase\nr\relax
+ \appto\newterm@styles{balance=true,}%
+ \or
+ \appto\newterm@styles{balance=false,}%
+ \fi
+}
+\newcommand{\printterms}[1][]{%
+\bgroup
+ \let\newterm@database\datagidx@defaultdatabase
+ \let\newterm@styles\@empty
+ \setkeys{printterms}{#1}%
+ \DTLifdbexists{\newterm@database}%
+ {%
+ \edef\DTLgidxCurrentdb{\newterm@database}%
+ \edef\do@getrow{\noexpand\dtlgetrowforvalue
+ {datagidx}%
+ {\dtlcolumnindex{datagidx}{Glossary}}%
+ {\newterm@database}%
+ }%
+ \do@getrow
+ \dtlgetentryfromcurrentrow
+ {\datagidx@title}%
+ {\dtlcolumnindex{datagidx}{Title}}%
+ \dtlgetentryfromcurrentrow
+ {\datagidx@heading}%
+ {\dtlcolumnindex{datagidx}{Heading}}%
+ \dtlgetentryfromcurrentrow
+ {\datagidx@postheading}%
+ {\dtlcolumnindex{datagidx}{PostHeading}}%
+ \dtlgetentryfromcurrentrow
+ {\datagidx@multicols}%
+ {\dtlcolumnindex{datagidx}{MultiCols}}%
+ \dtlgetentryfromcurrentrow
+ {\datagidx@sort}%
+ {\dtlcolumnindex{datagidx}{Sort}}%
+ \dtlgetentryfromcurrentrow
+ {\datagidx@style}%
+ {\dtlcolumnindex{datagidx}{Style}}%
+ \dtlgetentryfromcurrentrow
+ {\datagidx@showgroups}%
+ {\dtlcolumnindex{datagidx}{ShowGroups}}%
+ \edef\dtl@do@setkeys{\noexpand\setkeys{newgloss}{\expandonce\newterm@styles}}%
+ \dtl@do@setkeys
+ \ifnum\datagidx@columns>1\relax
+ \edef\datagidx@prestart{%
+ \noexpand\begin{\datagidx@multicols}{\datagidx@columns}%
+ }%
+ \edef\datagidx@postend{%
+ \noexpand\end{\datagidx@multicols}%
+ }%
+ \else
+ \def\datagidx@prestart{}%
+ \def\datagidx@postend{}%
+ \fi
+ \let\@dtl@dbname\DTLgidxCurrentdb
+ \csuse{datagidxshowgroups\datagidx@showgroups}%
+ \datagidxsetstyle{\datagidx@style}%
+ \def\datagidx@labellist{}%
+ \datagidx@heading{\datagidx@title}%
+ \datagidx@postheading
+ \datagidx@do@sort
+ \datagidx@prestart
+ \datagidxstart
+ \let\DTLgidxName\datagidx@invert
+ \let\DTLgidxPlace\datagidx@invert
+ \let\DTLgidxSubject\datagidx@invert
+ \let\DTLgidxOffice\datagidx@invert
+ \DTLgidxForeachEntry
+ {%
+ \datagidxitem
+ }%
+ \datagidxend
+ \datagidx@postend
+ }%
+ {%
+ \PackageError{datagidx}%
+ {Glossary/index data base `\newterm@database' doesn't exist}%
+ {%
+ You must define the glossary/index data base before you can
+ use it.%
+ }%
+ }%
+\egroup
+}
+\def\datagidx@getgroup#1#2\datagidx@endgetgroup{%
+ \dtl@setcharcode{#1}{\count@}%
+ \dtlifintclosedbetween{\count@}{48}{57}%
+ {%
+ \gdef\datagidxcurrentgroup{Numbers}%
+ }%
+ {%
+ \dtlifintclosedbetween{\count@}{97}{122}%
+ {%
+ \advance\count@ by -96\relax
+ \xdef\datagidxcurrentgroup{\@Alph\count@}%
+ }%
+ {%
+ \dtlifintclosedbetween{\count@}{65}{90}%
+ {%
+ \gdef\datagidxcurrentgroup{#1}%
+ }%
+ {%
+ \gdef\datagidxcurrentgroup{Symbols}%
+ }%
+ }%
+ }%
+}
+\newcommand*{\DTLgidxGroupHeaderTitle}[1]{%
+ \ifcsdef{datagidx#1name}
+ {%
+ \csuse{datagidx#1name}%
+ }%
+ {%
+ #1%
+ }%
+}
+\newcommand{\DTLgidxForeachEntry}[1]{%
+ \def\datagidxprevgroup{}%
+ \edef\datagidx@doforeachentry{%
+ \noexpand\DTLforeach*{\DTLgidxCurrentdb}%
+ {\expandonce\DTLgidxAssignList}
+ }%
+ \datagidx@doforeachentry
+ {%
+ \DTLifnull{\Parent}%
+ {%
+ \DTLifnull\Location
+ {%
+ \DTLifnull\CurrentLocation
+ {%
+ }%
+ {%
+ \global\let\@datagidx@dorerun@warn\@data@rerun@warn
+ }%
+ }%
+ {%
+ \ifcsdef{datagidx@prev@loc@\Label}%
+ {%
+ \ifcsequal{datagidx@prev@loc@\Label}{CurrentLocation}%
+ {}%
+ {%
+ \global\let\@datagidx@dorerun@warn\@data@rerun@warn
+ }%
+ }%
+ {%
+ \global\let\@datagidx@dorerun@warn\@data@rerun@warn
+ }%
+ }%
+ \datagidx@doifdisplayed
+ {%
+ \edef\datagidx@dowrite{%
+ \noexpand\protected@write\noexpand\@auxout{}%
+ {%
+ \string\datagidx@save@loc{\Label}{\CurrentLocation}%
+ }%
+ }%
+ \datagidx@dowrite
+ \datagidx@level=1\relax
+ \expandafter\datagidx@getgroup\Sort{}\datagidx@endgetgroup
+ #1%
+ \global\let\datagidxprevgroup\datagidxcurrentgroup
+ }%
+ }%
+ {}%
+ }%
+}
+\newcommand{\datagidx@doifdisplayed}[1]{%
+ \DTLifnull{\Location}%
+ {%
+ \DTLifnull{\See}
+ {%
+ \DTLifnull{\SeeAlso}{}%
+ {%
+ #1%
+ }%
+ }%
+ {%
+ \@for\dtl@thislabel:=\See\do
+ {%
+ \iftermexists{\dtl@thislabel}%
+ {%
+ \ifentryused{\dtl@thislabel}%
+ {%
+ #1%
+ \@endfortrue
+ }%
+ {}%
+ }%
+ {%
+ }%
+ }%
+ }%
+ }%
+ {%
+ #1%
+ }%
+}%
+\newcount\datagidx@level
+\endinput
+%%
+%% End of file `datagidx.sty'.
diff --git a/Master/texmf-dist/tex/latex/datatool/datapie.sty b/Master/texmf-dist/tex/latex/datatool/datapie.sty
index 21da0dc72a1..b585b5456c3 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 2012 Nicola Talbot
+%% Copyright 2013 Nicola Talbot
%%
%% This work may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either version 1.3
@@ -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-base.sty, datatool-fp.sty, datatool-pgfmath.sty, datatool.sty, databib.sty, databar.sty, datapie.sty, dataplot.sty, person.sty, databib.bst.
+%% This work consists of the files datatool.dtx and datatool.ins and the derived files datatool-base.sty, datatool-fp.sty, datatool-pgfmath.sty, datatool.sty, datagidx.sty, databib.sty, databar.sty, datapie.sty, dataplot.sty, person.sty, databib.bst.
%%
%% \CharacterTable
%% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
@@ -39,7 +39,7 @@
%% Grave accent \` Left brace \{ Vertical bar \|
%% Right brace \} Tilde \~}
\NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{datapie}[2012/09/25 v2.11 (NLCT)]
+\ProvidesPackage{datapie}[2013/01/15 v2.13 (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 2131f0a62d5..8da1b86d9d6 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 2012 Nicola Talbot
+%% Copyright 2013 Nicola Talbot
%%
%% This work may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either version 1.3
@@ -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-base.sty, datatool-fp.sty, datatool-pgfmath.sty, datatool.sty, databib.sty, databar.sty, datapie.sty, dataplot.sty, person.sty, databib.bst.
+%% This work consists of the files datatool.dtx and datatool.ins and the derived files datatool-base.sty, datatool-fp.sty, datatool-pgfmath.sty, datatool.sty, datagidx.sty, databib.sty, databar.sty, datapie.sty, dataplot.sty, person.sty, databib.bst.
%%
%% \CharacterTable
%% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
@@ -39,7 +39,7 @@
%% Grave accent \` Left brace \{ Vertical bar \|
%% Right brace \} Tilde \~}
\NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{dataplot}[2012/09/25 v2.11 (NLCT)]
+\ProvidesPackage{dataplot}[2013/01/15 v2.13 (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
index 097ed15e5f1..8f617ec0e77 100644
--- a/Master/texmf-dist/tex/latex/datatool/datatool-base.sty
+++ b/Master/texmf-dist/tex/latex/datatool/datatool-base.sty
@@ -7,7 +7,7 @@
%% datatool.dtx (with options: `datatool-base.sty,package')
%%
%% datatool.dtx
-%% Copyright 2012 Nicola Talbot
+%% Copyright 2013 Nicola Talbot
%%
%% This work may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either version 1.3
@@ -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-base.sty, datatool-fp.sty, datatool-pgfmath.sty, datatool.sty, databib.sty, databar.sty, datapie.sty, dataplot.sty, person.sty, databib.bst.
+%% This work consists of the files datatool.dtx and datatool.ins and the derived files datatool-base.sty, datatool-fp.sty, datatool-pgfmath.sty, datatool.sty, datagidx.sty, databib.sty, databar.sty, datapie.sty, dataplot.sty, person.sty, databib.bst.
%%
%% \CharacterTable
%% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
@@ -39,7 +39,7 @@
%% Grave accent \` Left brace \{ Vertical bar \|
%% Right brace \} Tilde \~}
\NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{datatool-base}[2012/10/06 v2.12 (NLCT)]
+\ProvidesPackage{datatool-base}[2013/01/15 v2.13 (NLCT)]
\RequirePackage{etoolbox}
\RequirePackage{amsmath}
\RequirePackage{xkeyval}
@@ -83,6 +83,31 @@
#4%
}%
}
+\newcommand{\dtlifintopenbetween}[5]{%
+ \ifnum#1>#2\relax
+ \ifnum#1<#3\relax
+ #4%
+ \else
+ #5%
+ \fi
+ \else
+ #5%
+ \fi
+}
+\newcommand{\dtlifintclosedbetween}[5]{%
+ \dtlifintopenbetween{#1}{#2}{#3}{#4}%
+ {%
+ \ifnum#1=#2\relax
+ #4%
+ \else
+ \ifnum#1=#3\relax
+ #4%
+ \else
+ #5%
+ \fi
+ \fi
+ }%
+}
\long\def\long@collect@body#1{%
\@envbody{\@xp#1\@xp{\the\@envbody}}%
\edef\process@envbody{\the\@envbody\@nx\end{\@currenvir}}%
@@ -1547,17 +1572,13 @@
#2=-1\relax
}%
{%
- \ifx#1\space\relax
+ \ifx#1\@dtl@wordbreak\relax
#2=`\ \relax
\else
- \ifx#1~\relax
- #2=`\ \relax
+ \ifcat\noexpand#1\relax
+ #2=0\relax
\else
- \ifcat\noexpand#1\relax
- #2=-1\relax
- \else
- #2=`#1\relax
- \fi
+ #2=`#1\relax
\fi
\fi
}%
@@ -1568,16 +1589,15 @@
#2=-1\relax
}%
{%
- \ifx#1\space\relax
+ \ifx#1\@dtl@wordbreak\relax
#2=`\ \relax
\else
- \ifx#1~\relax
- #2=`\ \relax
+ \ifcat\noexpand#1\relax%
+ #2=0\relax
\else
- \ifcat\noexpand#1\relax%
- #2=-1\relax
- \else
- #2=\lccode`#1\relax
+ #2=\lccode`#1\relax
+ \ifnum#2=0\relax
+ #2=`#1\relax
\fi
\fi
\fi
@@ -1602,82 +1622,413 @@
#1=1\relax
}%
{%
- \DTLsubstituteall{\@dtl@argA}{ }{\space }%
- \DTLsubstituteall{\@dtl@argB}{ }{\space }%
+ \dtl@setwordbreaksnohyphens{\@dtl@argA}{\@dtl@wordbreak}%
+ \let\@dtl@argA\dtl@string
+ \dtl@setwordbreaksnohyphens{\@dtl@argB}{\@dtl@wordbreak}%
+ \let\@dtl@argB\dtl@string
\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
+ \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*{\dtlwordindexcompare}[3]{%
+ \@dtldictcompare{#1}{#2}{#3}{\@dtl@wordbreak}%
+}
+\newcommand*{\dtlletterindexcompare}[3]{%
+ \@dtldictcompare{#1}{#2}{#3}{}%
+}
+\newcommand*{\@dtldictcompare}[4]{%
+ \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
+ }%
+ {%
+ \expandafter\DTLsplitstring\expandafter
+ {\@dtl@argA}{\datatoolpersoncomma}{\@dtl@beforepart}{\@dtl@afterpart}%
+ \ifdefempty{\@dtl@replaced}%
+ {%
+ \expandafter\DTLsplitstring\expandafter
+ {\@dtl@argA}{\datatoolplacecomma}{\@dtl@beforepart}{\@dtl@afterpart}%
+ \ifdefempty{\@dtl@replaced}%
+ {%
+ \expandafter\DTLsplitstring\expandafter
+ {\@dtl@argA}{\datatoolsubjectcomma}{\@dtl@beforepart}{\@dtl@afterpart}%
+ \ifdefempty{\@dtl@replaced}%
+ {%
+ \expandafter\DTLsplitstring\expandafter
+ {\@dtl@argA}{\datatoolparenstart}{\@dtl@beforepart}{\@dtl@afterpart}%
+ \ifdefempty{\@dtl@replaced}%
+ {%
+ \def\@dtl@A@comma{0}%
+ \let\@dtl@A@before\@dtl@argA
+ \def\@dtl@A@after{}%
+ }%
+ {%
+ \let\@dtl@A@comma\@dtl@replaced
+ \let\@dtl@A@before\@dtl@beforepart
+ \let\@dtl@A@after\@dtl@afterpart
+ }%
+ }%
+ {%
+ \let\@dtl@A@comma\@dtl@replaced
+ \let\@dtl@A@before\@dtl@beforepart
+ \let\@dtl@A@after\@dtl@afterpart
+ }%
+ }%
+ {%
+ \let\@dtl@A@comma\@dtl@replaced
+ \let\@dtl@A@before\@dtl@beforepart
+ \let\@dtl@A@after\@dtl@afterpart
+ }%
+ }%
+ {%
+ \let\@dtl@A@comma\@dtl@replaced
+ \let\@dtl@A@before\@dtl@beforepart
+ \let\@dtl@A@after\@dtl@afterpart
+ }%
+ \expandafter\DTLsplitstring\expandafter
+ {\@dtl@argB}{\datatoolpersoncomma}{\@dtl@beforepart}{\@dtl@afterpart}%
+ \ifdefempty{\@dtl@replaced}%
+ {%
+ \expandafter\DTLsplitstring\expandafter
+ {\@dtl@argB}{\datatoolplacecomma}{\@dtl@beforepart}{\@dtl@afterpart}%
+ \ifdefempty{\@dtl@replaced}%
+ {%
+ \expandafter\DTLsplitstring\expandafter
+ {\@dtl@argB}{\datatoolsubjectcomma}{\@dtl@beforepart}{\@dtl@afterpart}%
+ \ifdefempty{\@dtl@replaced}%
+ {%
+ \expandafter\DTLsplitstring\expandafter
+ {\@dtl@argB}{\datatoolparenstart}{\@dtl@beforepart}{\@dtl@afterpart}%
+ \ifdefempty{\@dtl@replaced}%
+ {%
+ \def\@dtl@B@comma{0}%
+ \let\@dtl@B@before\@dtl@argB
+ \def\@dtl@B@after{}%
+ }%
+ {%
+ \let\@dtl@B@comma\@dtl@replaced
+ \let\@dtl@B@before\@dtl@beforepart
+ \let\@dtl@B@after\@dtl@afterpart
+ }%
+ }%
+ {%
+ \let\@dtl@B@comma\@dtl@replaced
+ \let\@dtl@B@before\@dtl@beforepart
+ \let\@dtl@B@after\@dtl@afterpart
+ }%
+ }%
+ {%
+ \let\@dtl@B@comma\@dtl@replaced
+ \let\@dtl@B@before\@dtl@beforepart
+ \let\@dtl@B@after\@dtl@afterpart
+ }%
+ }%
+ {%
+ \let\@dtl@B@comma\@dtl@replaced
+ \let\@dtl@B@before\@dtl@beforepart
+ \let\@dtl@B@after\@dtl@afterpart
+ }%
+ \expandafter\dtl@ifcasechargroup\@dtl@A@before\dtl@end@ifcasechargroup
+ {\def\@dtl@A@chargroup{2}}%
+ {\def\@dtl@A@chargroup{1}}%
+ {\def\@dtl@A@chargroup{0}}%
+ \expandafter\dtl@ifcasechargroup\@dtl@B@before\dtl@end@ifcasechargroup
+ {\def\@dtl@B@chargroup{2}}%
+ {\def\@dtl@B@chargroup{1}}%
+ {\def\@dtl@B@chargroup{0}}%
+ \ifnum\@dtl@A@chargroup<\@dtl@B@chargroup
+ #1=-1\relax
\else
- \ifnum\dtl@codeB=-1\relax
- \protected@edef\dtl@donext{%
- \noexpand\dtlicompare
- {\noexpand#1}{\dtl@firstA\dtl@restA}{\dtl@restB}}%
- \dtl@donext
+ \ifnum\@dtl@A@chargroup>\@dtl@B@chargroup
+ #1=1\relax
\else
- \ifnum\dtl@codeA<\dtl@codeB
- #1=-1\relax
- \else
- \ifnum\dtl@codeA>\dtl@codeB
- #1=1\relax
+ \ifcase\@dtl@A@chargroup
+ \protected@edef\dtl@donext{%
+ \noexpand\dtlcompare
+ {\noexpand#1}{\@dtl@A@before}{\@dtl@B@before}}%
+ \dtl@donext
+ \or
+ \ifnum\@dtl@A@before<\@dtl@B@before\relax
+ #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
- }%
- }%
+ \ifnum\@dtl@A@before>\@dtl@B@before\relax
+ #1=1\relax
+ \else
+ #1=0\relax
+ \fi
+ \fi
+ \or
+ \@dtlwordindexcompare{#1}{\@dtl@A@before}{\@dtl@B@before}
+ {\dtlicomparewords}{#4}%
+ \ifnum#1=0\relax
+ \let\@org@dtl@person@comma\datatoolpersoncomma
+ \let\@org@dtl@place@comma\datatoolplacecomma
+ \let\@org@dtl@subject@comma\datatoolsubjectcomma
+ \let\@org@dtl@paren@start\datatoolparenstart
+ \def\datatoolpersoncomma{3}%
+ \def\datatoolplacecomma{2}%
+ \def\datatoolsubjectcomma{1}%
+ \def\datatoolparenstart{-1}%
+ \ifnum\@dtl@A@comma>\@dtl@B@comma\relax
+ #1=-1\relax
+ \else
+ \ifnum\@dtl@A@comma<\@dtl@B@comma\relax
+ #1=1\relax
+ \else
+ \@dtlwordindexcompare{#1}{\@dtl@B@before}{\@dtl@A@before}
+ {\dtlcomparewords}{#4}%
+ \ifnum#1=0\relax
+ \@dtlwordindexcompare{#1}{\@dtl@A@after}{\@dtl@B@after}
+ {\dtlicomparewords}{#4}%
+ \fi
+ \fi
+ \fi
+ \let\datatoolpersoncomma\@org@dtl@person@comma
+ \let\datatoolplacecomma\@org@dtl@place@comma
+ \let\datatoolsubjectcomma\@org@dtl@subject@comma
+ \let\datatoolparenstart\@org@dtl@paren@start
\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*{\datatoolpersoncomma}{,\space}
+\newcommand*{\datatoolplacecomma}{,\space}
+\newcommand*{\datatoolsubjectcomma}{,\space}
+\newcommand*{\datatoolparenstart}{\space}
+\newcommand*{\@dtlwordindexcompare}[5]{%
+ \dtl@setwordbreaks{#2}{#5}%
+ \let#2\dtl@string
+ \dtl@setwordbreaks{#3}{}%
+ \let#3\dtl@string
+ \edef\@dtl@do@compare{%
+ \noexpand#4{\noexpand#1}%
+ {\expandonce#2}{\expandonce#3}%
+ }%
+ \@dtl@do@compare
+}
+\newcommand*{\@dtl@dict@compare}[4]{%
+ \ifdefempty{#2}%
+ {%
+ \ifdefempty{#3}%
+ {%
+ #1=0\relax
+ }%
+ {%
+ #1=-1\relax
+ }%
+ }%
+ {%
+ \ifdefempty{#3}%
+ {%
+ #1=1\relax
+ }%
+ {%
+ \expandafter\dtl@grabword#2\@dtl@endgrabword\dtl@A@first\dtl@A@remain
+ \expandafter\dtl@grabword#3\@dtl@endgrabword\dtl@B@first\dtl@B@remain
+ \edef\@dtl@do@compare{%
+ \noexpand#4{\noexpand#1}%
+ {\expandonce\dtl@A@first}{\expandonce\dtl@B@first}%
}%
+ \@dtl@do@compare
+ \ifnum#1=0\relax
+ \@dtl@dict@compare{#1}{\dtl@A@remain}{\dtl@B@remain}{#4}%
+ \fi
}%
}%
}
+\def\dtl@grabword#1\@dtl@wordbreak#2\@dtl@endgrabword#3#4{%
+ \def#3{#1}%
+ \def#4{#2}%
+}
+\newcommand{\dtlicomparewords}[3]{%
+ \dtlicompare{#1}{#2}{#3}%
+}
+\newcommand{\dtlcomparewords}[3]{%
+ \dtlcompare{#1}{#2}{#3}%
+}
+\newcommand*{\dtl@setwordbreaks}[2]{%
+ \expandafter\dtl@subnobrsp\expandafter{#1}{\dtl@string}%
+ \DTLsubstituteall{\dtl@string}{~}{#2}%
+ \DTLsubstituteall{\dtl@string}{\ }{#2}%
+ \DTLsubstituteall{\dtl@string}{\space}{#2}%
+ \DTLsubstituteall{\dtl@string}{-}{#2}%
+ \toks@{#2}%
+ \edef\dtl@do@setwordbreaks{%
+ \noexpand\@dtl@setwordbreaks{\the\toks@}\expandonce\dtl@string\space\noexpand\@nil}%
+ \def\dtl@string{}%
+ \dtl@do@setwordbreaks
+}
+\def\@dtl@setwordbreaks#1#2 #3{%
+ \def\dtl@tmp{#3}%
+ \ifx\@nnil\dtl@tmp
+ \let\@dtl@setwordbreaks@next\@gobbletwo
+ \appto\dtl@string{#2}%
+ \else
+ \let\@dtl@setwordbreaks@next\@dtl@setwordbreaks
+ \appto\dtl@string{#2#1}%
+ \fi
+ \@dtl@setwordbreaks@next{#1}#3%
+}
+\newcommand*{\dtl@setwordbreaksnohyphens}[2]{%
+ \expandafter\dtl@subnobrsp\expandafter{#1}{\dtl@string}%
+ \DTLsubstituteall{\dtl@string}{~}{#2}%
+ \DTLsubstituteall{\dtl@string}{\ }{#2}%
+ \DTLsubstituteall{\dtl@string}{\space}{#2}%
+ \toks@{#2}%
+ \edef\dtl@do@setwordbreaks{%
+ \noexpand\@dtl@setwordbreaks{\the\toks@}\expandonce\dtl@string\space\noexpand\@nil}%
+ \def\dtl@string{}%
+ \dtl@do@setwordbreaks
+}
+\newcommand*{\@dtl@wordbreak}{ }
+\def\dtl@ifcasechargroup#1#2\dtl@end@ifcasechargroup#3#4#5{%
+ \dtlifcasechargroup{#1}%
+ {#3}%
+ {%
+ \DTLifint{#1#2}
+ {%
+ #4%
+ }%
+ {%
+ #3%
+ }%
+ }%
+ {#5}%
+}
+\newcommand*{\dtlifcasechargroup}[4]{%
+ \count@=`#1\relax
+ \dtlifintclosedbetween{\number\count@}{48}{57}%
+ {%
+ #3%
+ }%
+ {%
+ \dtlifintclosedbetween{\number\count@}{97}{122}%
+ {%
+ #2%
+ }%
+ {%
+ \dtlifintclosedbetween{\number\count@}{65}{90}%
+ {%
+ #2%
+ }%
+ {%
+ #4%
+ }%
+ }%
+ }%
+}
+\newcommand*{\dtlparsewords}[2]{%
+ \dtl@subnobrsp{#1}{\dtl@string}%
+ \DTLsubstituteall{\dtl@string}{~}{ }%
+ \DTLsubstituteall{\dtl@string}{\ }{ }%
+ \DTLsubstituteall{\dtl@string}{\space}{ }%
+ \DTLsubstituteall{\dtl@string}{-}{ }%
+ \let\dtl@parsewordshandler#2\relax
+ \edef\dtl@donext{%
+ \noexpand\@dtl@parse@words\expandonce\dtl@string\space\noexpand\@nil}%
+ \dtl@donext
+}
+\def\@dtl@parse@words#1 #2{%
+ \def\dtl@tmp{#2}%
+ \ifx\@nnil\dtl@tmp
+ \let\parse@wordsnext=\@gobble
+ \else
+ \let\parse@wordsnext=\@dtl@parse@words
+ \fi
+ \dlt@parsewordshandler{#1}%
+ \parse@wordsnext#2%
+}
\newcommand*{\DTLifstringlt}{\@ifstar\@sDTLifstringlt\@DTLifstringlt}
\newcommand*{\@DTLifstringlt}[4]{%
\protected@edef\@dtl@tmpcmp{%
@@ -1815,9 +2166,9 @@
\fi
}
\newcommand*{\DTLifSubString}[4]{%
- \protected@edef\@dtl@tmp{\noexpand\dtl@testifsubstring
+ \protected@edef\@dtl@dotestifsubstring{\noexpand\dtl@testifsubstring
{#1}{#2}}%
- \@dtl@tmp
+ \@dtl@dotestifsubstring
\if@dtl@condition
#3%
\else
@@ -1827,6 +2178,17 @@
\newcommand*{\dtl@testifsubstring}[2]{%
\dtl@subnobrsp{#1}{\@dtl@argA}%
\dtl@subnobrsp{#2}{\@dtl@argB}%
+ \dtl@setwordbreaksnohyphens{\@dtl@argA}{\@dtl@wordbreak}%
+ \let\@dtl@argA\dtl@string
+ \dtl@setwordbreaksnohyphens{\@dtl@argB}{\@dtl@wordbreak}%
+ \let\@dtl@argB\dtl@string
+ \edef\dtl@donext{%
+ \noexpand\@dtl@testifsubstring{\expandonce\@dtl@argA}{\expandonce\@dtl@argB}}%
+ \dtl@donext
+}
+\newcommand*{\@dtl@testifsubstring}[2]{%
+ \def\@dtl@argA{#1}%
+ \def\@dtl@argB{#2}%
\ifdefempty{\@dtl@argB}%
{%
\@dtl@conditiontrue
@@ -1837,16 +2199,15 @@
\@dtl@conditionfalse
}%
{%
- \dtl@teststartswith{#1}{#2}%
+ \@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}%
+ \expandafter\@dtl@testifsubstring\expandafter{\dtl@rest}{#2}%
}{%
- \protected@edef\@dtl@donext{\noexpand\dtl@testifsubstring
- {\dtl@first\dtl@rest}{\@dtl@argB}}%
+ \protected@edef\@dtl@donext{\noexpand\@dtl@testifsubstring
+ {\expandonce\dtl@first\expandonce\dtl@rest}{\expandonce\@dtl@argB}}%
\@dtl@donext
}%
\fi
@@ -1866,6 +2227,18 @@
\newcommand*{\dtl@teststartswith}[2]{%
\dtl@subnobrsp{#1}{\@dtl@argA}%
\dtl@subnobrsp{#2}{\@dtl@argB}%
+ \dtl@setwordbreaksnohyphens{\@dtl@argA}{\@dtl@wordbreak}%
+ \let\@dtl@argA\dtl@string
+ \dtl@setwordbreaksnohyphens{\@dtl@argB}{\@dtl@wordbreak}%
+ \let\@dtl@argB\dtl@string
+ \edef\dtl@donext{%
+ \noexpand\@dtl@teststartswith{\expandonce\@dtl@argA}{\expandonce\@dtl@argB}}%
+ \dtl@donext
+}
+
+\newcommand*{\@dtl@teststartswith}[2]{%
+ \def\@dtl@argA{#1}%
+ \def\@dtl@argB{#2}%
\ifdefempty{\@dtl@argA}%
{%
\ifdefempty{\@dtl@argB}%
@@ -1882,54 +2255,59 @@
\@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
+ \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{\expandonce\dtl@restA}{\expandonce\dtl@restB}}%
+ \dtl@donext
+ \else
+ \protected@edef\dtl@donext{%
+ \noexpand\@dtl@teststartswith
+ {\expandonce\dtl@restA}{\expandonce\dtl@firstB\expandonce\dtl@restB}}%
+ \dtl@donext
+ \fi
\else
- \@dtl@conditionfalse
+ \ifnum\dtl@codeB=-1\relax
+ \protected@edef\dtl@donext{%
+ \noexpand\@dtl@teststartswith
+ {\expandonce\dtl@firstA\expandonce\dtl@restA}{\expandonce\dtl@restB}}%
+ \dtl@donext
+ \else
+ \ifnum\dtl@codeA=\dtl@codeB
+ \protected@edef\dtl@donext{%
+ \noexpand\@dtl@teststartswith{\expandonce\dtl@restA}{\expandonce\dtl@restB}}%
+ \dtl@donext
+ \else
+ \@dtl@conditionfalse
+ \fi
+ \fi
\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}}%
+ }%
+ {%
+ \protected@edef\dtl@donext{%
+ \noexpand\@dtl@teststartswith
+ {\expandonce\dtl@firstA\expandonce\dtl@restA}%
+ {\expandonce\dtl@firstB\expandonce\dtl@restB}}%
+ \dtl@donext
+ }%
+ }%
+ {%
+ \protected@edef\dtl@donext{%
+ \noexpand\@dtl@teststartswith
+ {\expandonce\dtl@firstA\expandonce\dtl@restA}%
+ {\expandonce\dtl@firstB\expandonce\dtl@restB}}%
}%
}%
}%
diff --git a/Master/texmf-dist/tex/latex/datatool/datatool-fp.sty b/Master/texmf-dist/tex/latex/datatool/datatool-fp.sty
index de6bf14aa2c..aac031ce169 100644
--- a/Master/texmf-dist/tex/latex/datatool/datatool-fp.sty
+++ b/Master/texmf-dist/tex/latex/datatool/datatool-fp.sty
@@ -7,7 +7,7 @@
%% datatool.dtx (with options: `datatool-fp.sty,package')
%%
%% datatool.dtx
-%% Copyright 2012 Nicola Talbot
+%% Copyright 2013 Nicola Talbot
%%
%% This work may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either version 1.3
@@ -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-base.sty, datatool-fp.sty, datatool-pgfmath.sty, datatool.sty, databib.sty, databar.sty, datapie.sty, dataplot.sty, person.sty, databib.bst.
+%% This work consists of the files datatool.dtx and datatool.ins and the derived files datatool-base.sty, datatool-fp.sty, datatool-pgfmath.sty, datatool.sty, datagidx.sty, databib.sty, databar.sty, datapie.sty, dataplot.sty, person.sty, databib.bst.
%%
%% \CharacterTable
%% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
@@ -39,7 +39,7 @@
%% Grave accent \` Left brace \{ Vertical bar \|
%% Right brace \} Tilde \~}
\NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{datatool-fp}[2012/09/25 v2.11 (NLCT)]
+\ProvidesPackage{datatool-fp}[2013/01/15 v2.13 (NLCT)]
\RequirePackage{xkeyval}
\RequirePackage{fp}
\RequirePackage{datatool-base}
diff --git a/Master/texmf-dist/tex/latex/datatool/datatool-pgfmath.sty b/Master/texmf-dist/tex/latex/datatool/datatool-pgfmath.sty
index 39e8597e71a..3ce27652288 100644
--- a/Master/texmf-dist/tex/latex/datatool/datatool-pgfmath.sty
+++ b/Master/texmf-dist/tex/latex/datatool/datatool-pgfmath.sty
@@ -7,7 +7,7 @@
%% datatool.dtx (with options: `datatool-pgfmath.sty,package')
%%
%% datatool.dtx
-%% Copyright 2012 Nicola Talbot
+%% Copyright 2013 Nicola Talbot
%%
%% This work may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either version 1.3
@@ -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-base.sty, datatool-fp.sty, datatool-pgfmath.sty, datatool.sty, databib.sty, databar.sty, datapie.sty, dataplot.sty, person.sty, databib.bst.
+%% This work consists of the files datatool.dtx and datatool.ins and the derived files datatool-base.sty, datatool-fp.sty, datatool-pgfmath.sty, datatool.sty, datagidx.sty, databib.sty, databar.sty, datapie.sty, dataplot.sty, person.sty, databib.bst.
%%
%% \CharacterTable
%% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
@@ -39,7 +39,7 @@
%% Grave accent \` Left brace \{ Vertical bar \|
%% Right brace \} Tilde \~}
\NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{datatool-pgfmath}[2012/10/06 v2.12 (NLCT)]
+\ProvidesPackage{datatool-pgfmath}[2013/01/15 v2.13 (NLCT)]
\RequirePackage{xkeyval}
\RequirePackage{pgfrcs,pgfkeys,pgfmath}
\ProcessOptionsX
diff --git a/Master/texmf-dist/tex/latex/datatool/datatool.sty b/Master/texmf-dist/tex/latex/datatool/datatool.sty
index b8d1237baf7..5101274b157 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 2012 Nicola Talbot
+%% Copyright 2013 Nicola Talbot
%%
%% This work may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either version 1.3
@@ -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-base.sty, datatool-fp.sty, datatool-pgfmath.sty, datatool.sty, databib.sty, databar.sty, datapie.sty, dataplot.sty, person.sty, databib.bst.
+%% This work consists of the files datatool.dtx and datatool.ins and the derived files datatool-base.sty, datatool-fp.sty, datatool-pgfmath.sty, datatool.sty, datagidx.sty, databib.sty, databar.sty, datapie.sty, dataplot.sty, person.sty, databib.bst.
%%
%% \CharacterTable
%% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
@@ -39,7 +39,7 @@
%% Grave accent \` Left brace \{ Vertical bar \|
%% Right brace \} Tilde \~}
\NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{datatool}[2012/09/25 v2.11 (NLCT)]
+\ProvidesPackage{datatool}[2013/01/15 v2.13 (NLCT)]
\RequirePackage{xkeyval}
\RequirePackage{ifthen}
\RequirePackage{xfor}
@@ -112,7 +112,7 @@
\define@choicekey{datatool.sty}{math}[\val\nr]{fp,pgfmath}{%
\renewcommand*\@dtl@mathprocessor{#1}%
}
-\newcommand*{\@dtl@mathprocessor}{fp}
+\providecommand*{\@dtl@mathprocessor}{fp}
\ProcessOptionsX
\@dtl@construct@lopoffs
\RequirePackage{datatool-base}
@@ -164,6 +164,53 @@
database doesn't exist}{}{}%
}%
}
+\newcommand*{\DTLgnewdb}[1]{%
+ \DTLifdbexists{#1}%
+ {%
+ \PackageError{datatool}{Database `#1' already exists}{}%
+ }%
+ {%
+ \dtl@message{Creating database `#1'}%
+ \expandafter\global\expandafter\newtoks\csname dtldb@#1\endcsname
+ \expandafter\global\expandafter\newtoks\csname dtlkeys@#1\endcsname{}%
+ \expandafter\global\expandafter\newcount\csname dtlrows@#1\endcsname
+ \expandafter\global\expandafter\newcount\csname dtlcols@#1\endcsname
+ }%
+}
+\newcommand*{\DTLgdeletedb}[1]{%
+ \DTLifdbexists{#1}%
+ {%
+ \dtlforeachkey(\@dtl@key,\@dtl@col,\@dtl@type,\@dtl@head)\in{#1}\do
+ {%
+ \expandafter\global\expandafter\let\csname dtl@ci@#1@\@dtl@key\endcsname\undefined
+ }%
+ \expandafter\global\expandafter\let\csname dtldb@#1\endcsname\undefined
+ \expandafter\global\expandafter\let\csname dtlkeys@#1\endcsname\undefined
+ \expandafter\global\expandafter\let\csname dtlrows@#1\endcsname\undefined
+ \expandafter\global\expandafter\let\csname dtlcols@#1\endcsname\undefined
+ }%
+ {%
+ \PackageError{Can't delete database `#1':
+ database doesn't exist}{}{}%
+ }%
+}
+\newcommand*{\DTLgcleardb}[1]{%
+ \DTLifdbexists{#1}%
+ {%
+ \dtlforeachkey(\@dtl@key,\@dtl@col,\@dtl@type,\@dtl@head)\in{#1}\do
+ {%
+ \expandafter\global\expandafter\let\csname dtl@ci@#1@\@dtl@key\endcsname\undefined
+ }%
+ \expandafter\global\csname dtldb@#1\endcsname{}%
+ \expandafter\global\csname dtlkeys@#1\endcsname{}%
+ \expandafter\global\csname dtlrows@#1\endcsname=0\relax
+ \expandafter\global\csname dtlcols@#1\endcsname=0\relax
+ }%
+ {%
+ \PackageError{Can't clear database `#1':
+ database doesn't exist}{}{}%
+ }%
+}
\newcommand*{\DTLrowcount}[1]{%
\expandafter\number\csname dtlrows@#1\endcsname
}
@@ -189,7 +236,7 @@
\newcommand*{\@DTLnewrow}[1]{%
\DTLifdbexists{#1}%
{\@sDTLnewrow{#1}}%
- {\PackageErrors{datatool}{Can't add new row to database `#1':
+ {\PackageError{datatool}{Can't add new row to database `#1':
database doesn't exist}{}}%
}
\newcommand*{\@sDTLnewrow}[1]{%
@@ -487,7 +534,7 @@
{\noexpand\@dtl@key}{\noexpand\@dtl@type}%
{\noexpand\@dtl@colhead}{\noexpand\@dtl@before}%
{\noexpand\@dtl@after}{\the\csname dtlkeys@#1\endcsname}%
- {\number#2}}
+ {\number#2}}%
\@dtl@dogetprops
\@dtl@colhead={#3}%
\edef\@dtl@colnum{\number#2}\relax
@@ -537,7 +584,7 @@
}%
\dtl@dogetentry
\ifx\dtl@entry\dtlnovalue
- \@dtl@setnewvalue{#3}%
+ \@dtl@setnewvalue{#3}%
\toks@gconcat@middle@cx{dtldb@#1}%
{\dtlbeforerow}%
{%
@@ -617,16 +664,22 @@
\global\let#1=\DTLnumbernull
\fi
}
-\newcommand*{\DTLstringnull}{NULL}
-\newcommand*{\DTLnumbernull}{0}
+\newcommand*{\DTLstringnull}{\@dtlstringnull}
+\newcommand*{\@dtlstringnull}{NULL}
+\newcommand*{\DTLnumbernull}{\@dtlnumbernull}
+\newcommand*{\@dtlnumbernull}{0}
\newcommand*{\DTLifnull}[3]{%
- \ifx\DTLstringnull#1\relax
+ \ifx#1\dtlnovalue
#2%
\else
- \ifx\DTLnumbernull#1\relax
+ \ifx#1\DTLstringnull
#2%
\else
- #3%
+ \ifx#1\DTLnumbernull
+ #2%
+ \else
+ #3%
+ \fi
\fi
\fi
}
@@ -1202,7 +1255,7 @@
\gdef\DTLiflastrow##1##2{%
\expandafter\ifnum
\csname c@DTLrow\romannumeral\dtlforeachlevel\endcsname
- =\csname dtlcols@#2\endcsname\relax
+ =\csname dtlrows@#2\endcsname\relax
##1%
\else
##2%
@@ -1355,7 +1408,7 @@
\gdef\DTLiflastrow##1##2{%
\expandafter\ifnum
\csname c@DTLrow\romannumeral\dtlforeachlevel\endcsname
- =\csname dtlcols@#2\endcsname\relax
+ =\csname dtlrows@#2\endcsname\relax
##1%
\else
##2%
@@ -1608,7 +1661,7 @@
}
\newcommand{\DTLaddentryforrow}[5]{%
\DTLifdbexists{#1}%
- {
+ {%
\def\@dtl@notdone{\PackageError{datatool}{Unable to add entry
given by key `#4': condition not met for any row in database
`#1'}{}}%
@@ -1641,9 +1694,9 @@
\dtl@dogetentry
\ifx#1\dtlnovalue
\ifnum0\dtltype=0\relax
- \let#1=\DTLstringnull
+ \let#1=\@dtlstringnull
\else
- \let#1=\DTLnumbernull
+ \let#1=\@dtlnumbernull
\fi
\fi
\global\let#1#1%
@@ -1711,8 +1764,8 @@
\newcommand*{\dtldisplaystartrow}{}
\newcommand*{\DTLdisplaydb}[2][]{%
- \def\@dtl@doamp{\gdef\@dtl@doamp{&}}
- \def\@dtl@resetdoamp{\gdef\@dtl@doamp{\gdef\@dtl@doamp{&}}}
+ \def\@dtl@doamp{\gdef\@dtl@doamp{&}}%
+ \def\@dtl@resetdoamp{\gdef\@dtl@doamp{\gdef\@dtl@doamp{&}}}%
\edef\@dtl@maxcols{\expandafter\number
\csname dtlcols@#2\endcsname}%
\DTLnumitemsinlist{#1}{\@dtl@tmp}%
@@ -1726,7 +1779,7 @@
{}%
{%
\dtladdalign\@dtl@tabargs\@dtl@type\@dtl@idx\@dtl@maxcols
- }
+ }%
}%
\edef\@dtl@dobegintab{\noexpand\begin{tabular}[\dtldisplayvalign]{\@dtl@tabargs}}%
\@dtl@dobegintab
@@ -1793,8 +1846,8 @@
\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{&}}}
+ \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}%
@@ -2104,6 +2157,7 @@
}%
}%
\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}%
@@ -2383,23 +2437,20 @@
\newtoks\@dtl@list
\newcommand*{\DTLsort}{\@ifstar\@sDTLsort\@DTLsort}
\newcommand{\@DTLsort}[3][]{%
- \DTLifdbexists{#3}%
- {%
- \edef\@dtl@replacementkeys{#1}%
- \edef\@dtl@sortorder{#2}%
- \let\@dtl@comparecs=\dtlcompare
- \dtl@sortdata{#3}%
- }%
- {%
- \PackageError{datatool}{Database `#3' doesn't exist}{}%
- }%
+ \dtlsort[#1]{#2}{#3}{\dtlicompare}%
}
-\newcommand{\@sDTLsort}[3][]{%
+\newcommand*{\@sDTLsort}[3][]{%
+ \dtlsort[#1]{#2}{#3}{\dtlicompare}%
+}
+\newcommand{\dtlsort}[4][]{%
\DTLifdbexists{#3}%
{%
+ \ifnum\DTLrowcount{#3}>100\relax
+ \typeout{Sorting `#3' - this may take a while.}%
+ \fi
\edef\@dtl@replacementkeys{#1}%
\edef\@dtl@sortorder{#2}%
- \let\@dtl@comparecs=\dtlicompare
+ \let\@dtl@comparecs=#4%
\dtl@sortdata{#3}%
}%
{%
@@ -2411,7 +2462,7 @@
\newcommand*{\dtl@sortdata}[1]{%
\def\@dtl@sortedlist{}%
\edef\@dtl@dbname{#1}%
- \@dtlforeachrow(\@dtl@rowAnum,\@dtl@rowAcontents)\in{#1}\do{%
+ \@dtlforeachrow(\@dtl@rowAnum,\@dtl@rowAcontents)\in\@dtl@dbname\do{%
\@dtl@rowa=\expandafter{\@dtl@rowAcontents}%
\def\@dtl@newlist{}%
\@dtl@insertdonefalse
@@ -2421,7 +2472,8 @@
\db@row@id@w \@nil\db@row@id@end@%
\db@row@id@w \@nil\db@row@id@end@%
\db@row@elt@end@%
- \@@{\@dtl@rowBnum}{\@dtl@rowBcontents}{%
+ \@@{\@dtl@rowBnum}{\@dtl@rowBcontents}%
+ {%
\@dtl@rowb=\expandafter{\@dtl@rowBcontents}%
\dtlrownum=\@dtl@rowBnum
\if@dtl@insertdone
@@ -2475,7 +2527,8 @@
{\@dtl@sortedlist}%
}
\newcommand{\@dtl@sortcriteria}[2]{%
- \@for\@dtl@level:=\@dtl@sortorder\do{%
+ \@for\@dtl@level:=\@dtl@sortorder\do
+ {%
\expandafter\@dtl@getsortdirection\@dtl@level=\relax
\let\@dtl@keya=\@dtl@key
\let\@dtl@keyb=\@dtl@key
@@ -2554,7 +2607,7 @@
\PackageError{datatool}{Invalid sort direction
`\@dtl@sortdirection'}{The sort direction can only be
one of `ascending' or `descending'}%
- \def\@dtl@sortdirection{-1}
+ \def\@dtl@sortdirection{-1}%
\fi
\fi
}%
@@ -2714,6 +2767,97 @@
database}{}%
}%
}
+\newcommand*{\dtl@saverawdbhook}{}
+\newcommand*{\DTLsaverawdb}[2]{%
+ \DTLifdbexists{#1}%
+ {%
+ \openout\@dtl@write=#2\relax
+ \protected@write{\@dtl@write}{}{%
+ \string\DTLifdbexists{#1}\expandafter\@gobble\string\%^^J%
+ {%
+ \string\PackageError{datatool}{Database `#1' ^^Jalready exists}{}%
+ \expandafter\@gobble\string\%^^J%
+ \string\aftergroup\string\endinput
+ }%
+ {%
+ }\expandafter\@gobble\string\%
+ }%
+ {%
+ \def\db@row@elt@w{\expandafter\@gobble\string\%^^J\string\db@row@elt@w\space}%
+ \def\db@row@elt@end@{\expandafter\@gobble\string\%^^J\string\db@row@elt@end@\space}%
+ \def\db@row@id@w{\expandafter\@gobble\string\%^^J\string\db@row@id@w\space}%
+ \def\db@row@id@end@{\expandafter\@gobble\string\%^^J\string\db@row@id@end@\space}%
+ \def\db@col@elt@w{\expandafter\@gobble\string\%^^J\string\db@col@elt@w\space}%
+ \def\db@col@elt@end@{\expandafter\@gobble\string\%^^J\string\db@col@elt@end@\space}%
+ \def\db@col@id@w{\expandafter\@gobble\string\%^^J\string\db@col@id@w\space}%
+ \def\db@col@id@end@{\expandafter\@gobble\string\%^^J\string\db@col@id@end@\space}%
+ \def\db@plist@elt@w{\expandafter\@gobble\string\%^^J\string\db@plist@elt@w\space}%
+ \def\db@plist@elt@end@{\expandafter\@gobble\string\%^^J\string\db@plist@elt@end@\space}%
+ \def\db@key@id@w{\expandafter\@gobble\string\%^^J\string\db@key@id@w\space}%
+ \def\db@key@id@end@{\expandafter\@gobble\string\%^^J\string\db@key@id@end@\space}%
+ \def\db@type@id@w{\expandafter\@gobble\string\%^^J\string\db@type@id@w\space}%
+ \def\db@type@id@end@{\expandafter\@gobble\string\%^^J\string\db@type@id@end@\space}%
+ \def\db@header@id@w{\expandafter\@gobble\string\%^^J\string\db@header@id@w\space}%
+ \def\db@header@id@end@{\expandafter\@gobble\string\%^^J\string\db@header@id@end@\space}%
+ \protected@write{\@dtl@write}{}{\string\bgroup\string\makeatletter}%
+ \protected@write{\@dtl@write}{}{\string\dtl@message{Reconstructing database
+ ^^J`#1'}\expandafter\@gobble\string\%}%
+ \protected@write{\@dtl@write}{}{%
+ \string\expandafter
+ \string\global\string\expandafter^^J\string\newtoks
+ \string\csname\space dtlkeys@#1\string\endcsname}%
+ \protected@write{\@dtl@write}{}{%
+ \string\expandafter
+ \string\global^^J
+ \string\csname\space dtlkeys@#1\string\endcsname
+ =\expandafter\@gobble\string\{\expandafter\@gobble\string\%}%
+ \expandafter\protected@xdef\csname dtl@rawwritedbkeys@#1\endcsname{%
+ \the\csname dtlkeys@#1\endcsname}%
+ \protected@write{\@dtl@write}{}{\csname dtl@rawwritedbkeys@#1\endcsname}%
+ \protected@write{\@dtl@write}{}{\expandafter\@gobble\string\}\expandafter\@gobble\string\%}%
+ \dtl@saverawdbhook
+ \protected@write{\@dtl@write}{}{%
+ \string\expandafter\string\global
+ \string\expandafter^^J\string\newtoks
+ \string\csname\space dtldb@#1\string\endcsname}%
+ \protected@write{\@dtl@write}{}{%
+ \string\expandafter
+ \string\global^^J\string\csname\space dtldb@#1\string\endcsname
+ =\expandafter\@gobble\string\{\expandafter\@gobble\string\%}%
+ \expandafter\protected@xdef\csname dtl@rawwritedb@#1\endcsname{\the\csname dtldb@#1\endcsname}%
+ \protected@write{\@dtl@write}{}{\csname dtl@rawwritedb@#1\endcsname}%
+ \protected@write{\@dtl@write}{}{\expandafter\@gobble\string\}\expandafter\@gobble\string\%}%
+ \protected@write{\@dtl@write}{}{\string\expandafter\string\global^^J
+ \string\expandafter\string\newcount
+ \string\csname\space dtlrows@#1\string\endcsname}%
+ \protected@write{\@dtl@write}{}{\string\expandafter\string\global^^J
+ \string\csname\space dtlrows@#1\string\endcsname
+ =\expandafter\number\csname dtlrows@#1\endcsname\string\relax}%
+ \protected@write{\@dtl@write}{}{\string\expandafter\string\global^^J
+ \string\expandafter\string\newcount
+ \string\csname\space dtlcols@#1\string\endcsname}%
+ \protected@write{\@dtl@write}{}{\string\expandafter\string\global^^J
+ \string\csname\space dtlcols@#1\string\endcsname
+ =\expandafter\number\csname dtlcols@#1\endcsname\string\relax}%
+ \dtlforeachkey(\@dtl@key,\@dtl@col,\@dtl@type,\@dtl@head)\in{#1}\do
+ {%
+ \edef\dtl@tmp{%
+ \string\expandafter^^J
+ \string\gdef
+ \string\csname\space dtl@ci@#1@\@dtl@key\string\endcsname
+ {\csname dtl@ci@#1@\@dtl@key\endcsname}\expandafter\@gobble\string\%
+ }%
+ \expandafter\write\expandafter\@dtl@write\expandafter{\dtl@tmp}%
+ }%
+ \protected@write{\@dtl@write}{}{\string\egroup}%
+ }%
+ \closeout\@dtl@write
+ }%
+ {%
+ \PackageError{datatool}{Can't save database `#1': no such
+ database}{}%
+ }%
+}
\newread\@dtl@read
\newcount\dtl@entrycr
\define@boolkey{loaddb}[dtl]{noheader}[true]{}
@@ -2748,13 +2892,15 @@
}%
{%
\dtl@trim#2%
- }
+ }%
}
\newcommand*{\@dtl@readrawline}[2]{%
\@dtl@rawread#1 to #2%
\dtl@trim#2%
\dtl@domappings\@dtl@line
}
+\newif\ifDTLnewdbonload
+\DTLnewdbonloadtrue
\newcommand*{\DTLloaddb}{%
\let\@dtl@doreadline\@dtl@readline
\@dtlloaddb
@@ -2772,7 +2918,9 @@
\advance\dtl@omitlines by \m@ne
\read\@dtl@read to \@dtl@line
\repeat
- \DTLnewdb{#2}%
+ \ifDTLnewdbonload
+ \DTLnewdb{#2}%
+ \fi
\ifeof\@dtl@read
\PackageWarning{datatool}{File `#3' has no data}%
\else
@@ -2983,8 +3131,8 @@
\def\@dtl@rawmappings{{#1}{#2}}%
}%
{%
- \def\@dtl@tmp{{#1}{#2}}
- \protected@edef\@dtl@rawmappings{\the\@dtl@toks,\@dtl@tmp}
+ \def\@dtl@tmp{{#1}{#2}}%
+ \protected@edef\@dtl@rawmappings{\the\@dtl@toks,\@dtl@tmp}%
}%
}
\newcommand*{\@dtl@rawmappings}{}
diff --git a/Master/texmf-dist/tex/latex/datatool/person.sty b/Master/texmf-dist/tex/latex/datatool/person.sty
index 84d18ad96da..6dcc72366b5 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 2012 Nicola Talbot
+%% Copyright 2013 Nicola Talbot
%%
%% This work may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either version 1.3
@@ -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-base.sty, datatool-fp.sty, datatool-pgfmath.sty, datatool.sty, databib.sty, databar.sty, datapie.sty, dataplot.sty, person.sty, databib.bst.
+%% This work consists of the files datatool.dtx and datatool.ins and the derived files datatool-base.sty, datatool-fp.sty, datatool-pgfmath.sty, datatool.sty, datagidx.sty, databib.sty, databar.sty, datapie.sty, dataplot.sty, person.sty, databib.bst.
%%
%% \CharacterTable
%% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
@@ -39,7 +39,7 @@
%% Grave accent \` Left brace \{ Vertical bar \|
%% Right brace \} Tilde \~}
\NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{person}[2012/09/25 v2.11 (NLCT)]
+\ProvidesPackage{person}[2013/01/15 v2.13 (NLCT)]
\RequirePackage{ifthen}
\RequirePackage{datatool}
\newcounter{people}