From ced128389da6e12bc2da23bc40adfa2ee6eb7eec Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Thu, 11 Jul 2013 23:29:36 +0000 Subject: datatool (10jul13) git-svn-id: svn://tug.org/texlive/trunk@31174 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/tex/latex/datatool/datagidx.sty | 73 +++++++++++--- Master/texmf-dist/tex/latex/datatool/dataplot.sty | 21 +++- Master/texmf-dist/tex/latex/datatool/datatool.sty | 112 ++++++++++++++++------ 3 files changed, 164 insertions(+), 42 deletions(-) (limited to 'Master/texmf-dist/tex/latex/datatool') diff --git a/Master/texmf-dist/tex/latex/datatool/datagidx.sty b/Master/texmf-dist/tex/latex/datatool/datagidx.sty index b9cd631badb..53c6e35e0dd 100644 --- a/Master/texmf-dist/tex/latex/datatool/datagidx.sty +++ b/Master/texmf-dist/tex/latex/datatool/datagidx.sty @@ -39,7 +39,7 @@ %% Grave accent \` Left brace \{ Vertical bar \| %% Right brace \} Tilde \~} \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{datagidx}[2013/06/28 v2.14 (NLCT)] +\ProvidesPackage{datagidx}[2013/07/10 v2.15 (NLCT)] \RequirePackage{datatool} \RequirePackage{etoolbox} \RequirePackage{xkeyval} @@ -47,6 +47,7 @@ \RequirePackage{xfor} \RequirePackage{multicol} \RequirePackage{textcase} +\RequirePackage{afterpage} \newcommand*{\datagidx@columns}{2} \newcommand*{\DTLgidxSetColumns}[1]{% \DTLifint{#1}% @@ -312,10 +313,12 @@ \global\let\@datagidx@dorerun@warn@sort\@data@rerun@warn@sort }% } +\newif\if@datagidx@warn +\@datagidx@warntrue \newcommand*\@datagidx@dorerun@warn{} -\AtEndDocument{\@datagidx@dorerun@warn} +\AtEndDocument{\if@datagidx@warn\@datagidx@dorerun@warn\fi} \newcommand*\@datagidx@dorerun@warn@sort{} -\AtEndDocument{\@datagidx@dorerun@warn@sort} +\AtEndDocument{\if@datagidx@warn\@datagidx@dorerun@warn@sort\fi} \newcommand*\@data@rerun@warn@sort{% \PackageWarningNoLine{datagidx}{Rerun required to sort the index/glossary databases}% @@ -395,6 +398,14 @@ \datagidx@do@highopt@optimize \fi } +\define@choicekey{datagidx.sty}{nowarn}[\val\nr]{true,false}[true]% +{% + \ifcase\nr\relax + \@datagidx@warnfalse + \or + \@datagidx@warntrue + \fi +} \define@key{datagidx.sty}{columns}% {% \DTLgidxSetColumns{#1}% @@ -1737,15 +1748,15 @@ \datagidx@getlocation#1\relax \ifdefequal{\datagidx@prev@locationstring}{\datagidx@current@locationstring}% {% - \ifstrequal{\datagidx@prev@format}{\datagidx@current@format} + \ifstrequal{\datagidx@prev@format}{\datagidx@current@format}% {% }% {% - \ifdefempty{\datagidx@current@format} + \ifdefempty{\datagidx@current@format}% {% }% {% - \ifdefempty{\datagidx@prev@format} + \ifdefempty{\datagidx@prev@format}% {% \let\datagidx@prev@format\datagidx@current@format }% @@ -1765,11 +1776,11 @@ } \newcommand*{\@datagidx@parse@location}{% \@dtl@sequentialtrue - \ifdefequal{\datagidx@prev@format}{\datagidx@current@format} + \ifdefequal{\datagidx@prev@format}{\datagidx@current@format}% {% - \ifdefequal{\datagidx@prev@locationformat}{\datagidx@current@locationformat} + \ifdefequal{\datagidx@prev@locationformat}{\datagidx@current@locationformat}% {% - \ifdefequal{\datagidx@prev@prefix}{\datagidx@current@prefix} + \ifdefequal{\datagidx@prev@prefix}{\datagidx@current@prefix}% {% }% {% @@ -1870,7 +1881,7 @@ }% {% \DTLgidxLocationF - { + {% \datagidxlink{\datagidx@location@target}% {% \datagidx@formatlocation @@ -1930,6 +1941,20 @@ \datagidx@newgidx[#1]{#2}{#3}% }% } +\newcommand*{\loadgidx}[3][]{% + \input{#2}% + \bgroup + \setkeys{newgloss}{sort={},#1}% + \expandafter\datagidx@newgidx@update\expandafter + {\dtllastloadeddb}{#3}% + \egroup + \edef\datagidx@defaultdatabase{\dtllastloadeddb}% + \dtlforcolumn{\Label}{\dtllastloadeddb}{Label}% + {% + \csxdef{datagidxentry@\Label}{\dtllastloadeddb}% + }% +} +\@onlypreamble\loadgidx \newcommand*{\datagidx@newgidx}[3][]{% \bgroup \setkeys{newgloss}{#1}% @@ -2565,6 +2590,11 @@ {% \bgroup \datagidx@escapelocation + \def\@arabic{\noexpand\@arabic}% + \def\@roman{\noexpand\@roman}% + \def\@Roman{\noexpand\@Roman}% + \def\@alph{\noexpand\@alph}% + \def\@Alph{\noexpand\@Alph}% \protected@edef\@datagidx@dowriteaux{% \noexpand\datagidx@write@usedentry{#1}% {[#2]{#3}{\@datagidx@target}}% @@ -2701,9 +2731,21 @@ \string\datagidx@usedentry{#1}{#2}% }% \protected@edef\datagidx@do@usedentry{% - \noexpand\datagidx@usedentry[CurrentLocation]{#1}{#2}% + \noexpand\datagidx@xusedentry{CurrentLocation}{#1}{#2}% + }% + \expandafter\ifstrequal\expandafter{\DTLgidxCounter}{page}% + {% + \expandafter\afterpage\expandafter{\datagidx@do@usedentry}% + }% + { + \datagidx@do@usedentry + }% +} +\newcommand*{\datagidx@xusedentry}[3]{% + \protected@edef\@datagidx@do@xusedentry{% + \noexpand\datagidx@usedentry[#1]{#2}{#3}% }% - \datagidx@do@usedentry + \@datagidx@do@xusedentry } \newcommand*{\datagidx@usedentry}[3][Location]{% \ifcsundef{datagidxentry@#2}% @@ -3098,7 +3140,12 @@ {% \ifcsdef{datagidx@prev@loc@\Label}% {% - \ifcsequal{datagidx@prev@loc@\Label}{CurrentLocation}% + \protected@edef\@prev@location{% + \csname datagidx@prev@loc@\Label\endcsname}% + \@onelevel@sanitize\@prev@location + \protected@edef\@cur@location{\CurrentLocation}% + \@onelevel@sanitize\@cur@location + \ifdefequal{\@prev@location}{\@cur@location}% {}% {% \global\let\@datagidx@dorerun@warn\@data@rerun@warn diff --git a/Master/texmf-dist/tex/latex/datatool/dataplot.sty b/Master/texmf-dist/tex/latex/datatool/dataplot.sty index 564cc58d12b..36209d39185 100644 --- a/Master/texmf-dist/tex/latex/datatool/dataplot.sty +++ b/Master/texmf-dist/tex/latex/datatool/dataplot.sty @@ -137,6 +137,21 @@ \newif\ifDTLshowlines \DTLshowlinesfalse \newcommand*{\DTLplotatbegintikz}{} +\newcommand*{\@dtlplothandlermark}[1]{% + \pgfplothandlermark + {% + \pgfmathparse{1/\dtl@scale@x}% + \pgftransformxscale{\pgfmathresult}% + \pgfmathparse{1/\dtl@scale@y}% + \pgftransformyscale{\pgfmathresult}% + #1% + }% +} +\newcommand*{\dtlplothandlermark}[1]{% + \PackageWarning{dataplot}{\string\dtlplothandlermark\space + found outside \string\DTLplot}% + \pgfplothandlermark{#1}% +} \newcommand*{\DTLplotatendtikz}{} \define@key{dataplot}{x}{% \def\dtl@xkey{#1}} @@ -418,6 +433,7 @@ east,southeast,south,southwest,west,northwest}[northeast]{% \begin{scope} \pgftransformcm{\dtl@scale@x}{0}{0}{\dtl@scale@y}% {\pgfpoint{\dtl@offset@x pt}{\dtl@offset@y pt}}% + \let\dtlplothandlermark\@dtlplothandlermark \DTLplotatbegintikz \ifDTLbox \draw (\DTLminX,\DTLminY) -- (\DTLmaxX,\DTLminY) -- @@ -789,6 +805,7 @@ east,southeast,south,southwest,west,northwest}[northeast]{% \fi \pgftransformcm{\dtl@scale@x}{0}{0}{\dtl@scale@y}% {\pgfpoint{\dtl@offset@x pt}{\dtl@offset@y pt}}% + \let\dtlplothandlermark\@dtlplothandlermark \DTLplotatendtikz \end{tikzpicture} \fi @@ -948,10 +965,10 @@ east,southeast,south,southwest,west,northwest}[northeast]{% \fi \expandafter\toks@\expandafter{\dtl@legendline}% \ifx\dtl@legend\@empty - \edef\dtl@legend{\noexpand\tikz\the\toks@; \noexpand& #3}% + \xdef\dtl@legend{\noexpand\tikz\the\toks@; \noexpand& #3}% \else \expandafter\@dtl@toks\expandafter{\dtl@legend}% - \edef\dtl@legend{\the\@dtl@toks\noexpand\\% + \xdef\dtl@legend{\the\@dtl@toks\noexpand\\% \noexpand\tikz\the\toks@; \noexpand& #3}% \fi } diff --git a/Master/texmf-dist/tex/latex/datatool/datatool.sty b/Master/texmf-dist/tex/latex/datatool/datatool.sty index 35300a8d2c1..4764e53d48d 100644 --- a/Master/texmf-dist/tex/latex/datatool/datatool.sty +++ b/Master/texmf-dist/tex/latex/datatool/datatool.sty @@ -39,7 +39,7 @@ %% Grave accent \` Left brace \{ Vertical bar \| %% Right brace \} Tilde \~} \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{datatool}[2013/06/28 v2.14 (NLCT)] +\ProvidesPackage{datatool}[2013/07/10 v2.15 (NLCT)] \RequirePackage{xkeyval} \RequirePackage{ifthen} \RequirePackage{xfor} @@ -2291,7 +2291,7 @@ \dtlgetentryfromrow{\DTLthisval}{\@dtl@col}{\dtlcurrentrow}% \expandafter\ifthenelse\expandafter{\@dtl@cond}% {% - \ifstrempty{#4}% + \ifdefempty{#4}% {% \let#4\DTLthisval }% @@ -2761,6 +2761,7 @@ \protected@write\@dtl@write{}{% \string\DTLsetheader*{#1}{\@dtl@k}{\@dtl@h}}% }% + \protected@write{\@dtl@write}{}{\string\def\string\dtllastloadeddb{#1}}% \closeout\@dtl@write }% {% @@ -2801,8 +2802,9 @@ \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\dtl@message{Reconstructing database^^J`#1'}% + \expandafter\@gobble\string\%}% \protected@write{\@dtl@write}{}{% \string\expandafter \string\global\string\expandafter^^J\string\newtoks @@ -2815,7 +2817,8 @@ \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\%}% + \protected@write{\@dtl@write}{}% + {\expandafter\@gobble\string\}\expandafter\@gobble\string\%}% \dtl@saverawdbhook \protected@write{\@dtl@write}{}{% \string\expandafter\string\global @@ -2825,12 +2828,9 @@ \string\expandafter \string\global^^J\string\csname\space dtldb@#1\string\endcsname =\expandafter\@gobble\string\{\expandafter\@gobble\string\%}% - \@dtl@fmt@bodytok{\csname dtldb@#1\endcsname}% - \expandafter\protected@xdef\csname dtl@rawwritedb@#1\endcsname{% - \@dtl@contents}% + \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}{}{\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}% @@ -2855,6 +2855,7 @@ }% \protected@write{\@dtl@write}{}{\string\egroup}% }% + \protected@write{\@dtl@write}{}{\string\def\string\dtllastloadeddb{#1}}% \closeout\@dtl@write }% {% @@ -2862,23 +2863,80 @@ database}{}% }% } -\newcommand*{\@dtl@fmt@bodytok}[1]{% - \edef\@dtl@contents{\the#1}% - \@onelevel@sanitize\@dtl@contents - \@dtl@replace@elt{\@dtl@contents}{db@row@elt@w}% - \@dtl@replace@elt{\@dtl@contents}{db@row@elt@end@}% - \@dtl@replace@elt{\@dtl@contents}{db@row@id@w}% - \@dtl@replace@elt{\@dtl@contents}{db@row@id@end@}% - \@dtl@replace@elt{\@dtl@contents}{db@col@id@w}% - \@dtl@replace@elt{\@dtl@contents}{db@col@id@end@}% - \@dtl@replace@elt{\@dtl@contents}{db@col@elt@w}% - \@dtl@replace@elt{\@dtl@contents}{db@col@elt@end@}% -} -\newcommand*{\@dtl@replace@elt}[2]{% - \expandafter\def\expandafter\dtl@tmp\expandafter{\csname#2\endcsname }% - \@onelevel@sanitize\dtl@tmp - \expandafter\DTLsubstituteall\expandafter#1\expandafter{\dtl@tmp}% - {\csname#2\endcsname}% +\newcommand*{\DTLprotectedsaverawdb}[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\% + }% + {% + \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\%}% + \edef\dtl@rawwrite@keys{\the\csname dtlkeys@#1\endcsname}% + \@onelevel@sanitize\dtl@rawwrite@keys + \expandafter\write\expandafter\@dtl@write\expandafter + {\dtl@rawwrite@keys\expandafter\@gobble\string\}}% + \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\%}% + \edef\dtl@rawwrite@db{\the\csname dtldb@#1\endcsname}% + \@onelevel@sanitize\dtl@rawwrite@db + \expandafter\write\expandafter\@dtl@write\expandafter + {\dtl@rawwrite@db\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}% + }% + \protected@write{\@dtl@write}{}{\string\def\string\dtllastloadeddb{#1}}% + \closeout\@dtl@write + }% + {% + \PackageError{datatool}{Can't save database `#1': no such + database}{}% + }% } \newread\@dtl@read \newcount\dtl@entrycr -- cgit v1.2.3