From 20149d661e5c2763abbd1999e6c76bba077bdb12 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Wed, 18 Jun 2014 23:15:16 +0000 Subject: datatool (10jun14) git-svn-id: svn://tug.org/texlive/trunk@34305 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/tex/latex/datatool/databib.sty | 305 ++++++++++++--------- .../tex/latex/datatool/datatool-base.sty | 32 ++- Master/texmf-dist/tex/latex/datatool/datatool.sty | 19 +- 3 files changed, 219 insertions(+), 137 deletions(-) (limited to 'Master/texmf-dist/tex/latex/datatool') diff --git a/Master/texmf-dist/tex/latex/datatool/databib.sty b/Master/texmf-dist/tex/latex/datatool/databib.sty index 8a158804268..d0c658f9926 100644 --- a/Master/texmf-dist/tex/latex/datatool/databib.sty +++ b/Master/texmf-dist/tex/latex/datatool/databib.sty @@ -39,7 +39,7 @@ %% Grave accent \` Left brace \{ Vertical bar \| %% Right brace \} Tilde \~} \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{databib}[2014/03/08 v2.21 (NLCT)] +\ProvidesPackage{databib}[2014/06/10 v2.22 (NLCT)] \RequirePackage{datatool} \newcommand*{\dtlbib@style}{plain} \define@choicekey{databib.sty}{style}{plain,abbrv,alpha}{% @@ -103,6 +103,14 @@ \csname DTLformat\DBIBentrytype\endcsname }% } +\newcommand*{\DTLformatthisbibentry}[2]{% + \edef\DBIBname{#1}% + \edef\DBIBcitekey{#2}% + \edtlgetrowforvalue{#1}{\dtlcolumnindex{#1}{CiteKey}}{\DBIBcitekey}% + \dtl@gathervalues{#1}{\dtlcurrentrow}% + \letcs{\DBIBentrytype}{@dtl@key@EntryType}% + \DTLformatbibentry +} \newcommand*{\DTLendbibitem}{} \newlength\dtl@widest \newcommand*{\DTLcomputewidestbibentry}[4]{% @@ -171,6 +179,9 @@ \newcounter{DTLbibrow} \def\theHDTLbibrow{\theHDTLrow.bib.\arabic{DTLbibrow}}% \newcommand*{\DTLbibfield}[1]{\csname @dtl@key@#1\endcsname} +\newcommand*{\DTLbibfieldlet}[2]{% + \letcs{#1}{@dtl@key@#2}% +} \newcommand*{\DTLifbibfieldexists}[3]{% \@ifundefined{@dtl@key@#1}{#3}{% \expandafter\DTLifnull\csname @dtl@key@#1\endcsname @@ -484,8 +495,7 @@ {\em\DTLbibfield{Series}}}{}% }% }% -\edef\@dtl@tmp{\DTLbibfield{CrossRef}}% -~\cite{\@dtl@tmp}% +~\DTLpcite{\DTLbibfield{CrossRef}}% } \newcommand*{\DTLformatincollproccrossref}{% \DTLifbibfieldexists{Editor}{% @@ -511,10 +521,9 @@ \else \DTLstartsentencespace \expandafter\MakeUppercase\inname -\fi\ {\em\DTLbibfield{BookTitle}}}{}% +\fi\ \DTLformatbooktitle{\DTLbibfield{BookTitle}}}{}% }}% -\edef\@dtl@tmp{\DTLbibfield{CrossRef}}% -~\cite{\@dtl@tmp}% +~\DTLpcite{\DTLbibfield{CrossRef}}% } \newcommand*{\DTLformatinedbooktitle}{% \DTLifbibfieldexists{BookTitle}{% @@ -525,9 +534,9 @@ \expandafter\MakeUppercase\inname \fi\ \DTLifbibfieldexists{Editor}{% -\DTLformateditorlist\DTLaddcomma {\em\DTLbibfield{BookTitle}}% +\DTLformateditorlist\DTLaddcomma \DTLformatbooktitle{\DTLbibfield{BookTitle}}% \DTLcheckbibfieldendsperiod{BookTitle}% -}{{\em\DTLbibfield{BookTitle}}% +}{\DTLformatbooktitle{\DTLbibfield{BookTitle}}% \DTLcheckbibfieldendsperiod{BookTitle}% }}{}} \newcommand*{\DTLformatdate}{% @@ -570,8 +579,11 @@ \expandafter\MakeUppercase\inname \fi \ {\em\DTLbibfield{Journal}}}{}}% -\edef\@dtl@tmp{\DTLbibfield{CrossRef}}% -~\cite{\@dtl@tmp}% +~\DTLpcite{\DTLbibfield{CrossRef}}% +} +\newrobustcmd*{\DTLpcite}[1]{% + \protected@edef\@dtl@tmp{#1}% + \cite{\@dtl@tmp}% } \newcommand*{\DTLbibfieldexists}[1]{% \TE@throw\noexpand\dtl@testbibfieldexists{#1}% @@ -726,6 +738,13 @@ \fi} \newcommand*{\DTLbibitem}{\bibitem{\DBIBcitekey}} \newcommand*{\DTLmbibitem}[1]{\bibitem{#1@\DBIBcitekey}} +\newcommand*{\DTLcustombibitem}[3]{% + #1% + \if@filesw + \immediate\write\@auxout{\string\bibcite{#3}{#2}}% + \fi + \ignorespaces +} \newcommand*{\DTLformatauthor}[4]{% \DTLformatforenames{#4} \DTLformatvon{#1}% @@ -774,125 +793,160 @@ Systems} and Systems} \newcommand*{\DTLtcs}{Theoretical Computer Science} \newcommand{\dtlbst@plain}{% -\renewenvironment{DTLthebibliography}[2][\boolean{true}]{% -\@dtl@tmpcount=0\relax -\@sDTLforeach[##1]{##2}{}{\advance\@dtl@tmpcount by 1\relax}% -\begin{thebibliography}{\number\@dtl@tmpcount}% -}{\end{thebibliography}}% -\renewcommand*{\DTLbibitem}{\bibitem{\DBIBcitekey}}% -\renewcommand*{\DTLmbibitem}[1]{\bibitem{##1@\DBIBcitekey}}% -\renewcommand*{\DTLformatauthor}[4]{% -\DTLformatforenames{##4} -\DTLformatvon{##1}% -\DTLformatsurname{##2}% -\DTLformatjr{##3}} -\renewcommand*{\DTLformateditor}[4]{% -\DTLformatforenames{##4} -\DTLformatvon{##1}% -\DTLformatsurname{##2}% -\DTLformatjr{##3}} -\renewcommand*{\DTLformatedition}[1]{##1 \editionname}% -\let\DTLmonthname\dtl@monthname -\renewcommand*{\DTLacmcs}{ACM Computing Surveys} -\renewcommand*{\DTLacta}{Acta Informatica} -\renewcommand*{\DTLcacm}{Communications of the ACM} -\renewcommand*{\DTLibmjrd}{IBM Journal of Research and Development} -\renewcommand*{\DTLibmsj}{IBM Systems Journal} -\renewcommand*{\DTLieeese}{IEEE Transactions on Software Engineering} -\renewcommand*{\DTLieeetc}{IEEE Transactions on Computers} -\renewcommand*{\DTLieeetcad}{IEEE Transactions on Computer-Aided Design + \renewenvironment{DTLthebibliography}[2][\boolean{true}]{% + \@dtl@tmpcount=0\relax + \@sDTLforeach[##1]{##2}{}{\advance\@dtl@tmpcount by 1\relax}% + \begin{thebibliography}{\number\@dtl@tmpcount}% + }{\end{thebibliography}}% + \renewcommand*{\DTLbibitem}{\bibitem{\DBIBcitekey}}% + \renewcommand*{\DTLmbibitem}[1]{\bibitem{##1@\DBIBcitekey}}% + \renewcommand*{\DTLformatauthor}[4]{% + \DTLformatforenames{##4} + \DTLformatvon{##1}% + \DTLformatsurname{##2}% + \DTLformatjr{##3}} + \renewcommand*{\DTLformateditor}[4]{% + \DTLformatforenames{##4} + \DTLformatvon{##1}% + \DTLformatsurname{##2}% + \DTLformatjr{##3}} + \renewcommand*{\DTLformatedition}[1]{##1 \editionname}% + \let\DTLmonthname\dtl@monthname + \renewcommand*{\DTLacmcs}{ACM Computing Surveys} + \renewcommand*{\DTLacta}{Acta Informatica} + \renewcommand*{\DTLcacm}{Communications of the ACM} + \renewcommand*{\DTLibmjrd}{IBM Journal of Research and Development} + \renewcommand*{\DTLibmsj}{IBM Systems Journal} + \renewcommand*{\DTLieeese}{IEEE Transactions on Software Engineering} + \renewcommand*{\DTLieeetc}{IEEE Transactions on Computers} + \renewcommand*{\DTLieeetcad}{IEEE Transactions on Computer-Aided Design of Integrated Circuits} -\renewcommand*{\DTLipl}{Information Processing Letters} -\renewcommand*{\DTLjacm}{Journal of the ACM} -\renewcommand*{\DTLjcss}{Journal of Computer and System Sciences} -\renewcommand*{\DTLscp}{Science of Computer Programming} -\renewcommand*{\DTLsicomp}{SIAM Journal on Computing} -\renewcommand*{\DTLtocs}{ACM Transactions on Computer Systems} -\renewcommand*{\DTLtods}{ACM Transactions on Database Systems} -\renewcommand*{\DTLtog}{ACM Transactions on Graphics} -\renewcommand*{\DTLtoms}{ACM Transactions on Mathematical Software} -\renewcommand*{\DTLtoois}{ACM Transactions on Office Information + \renewcommand*{\DTLipl}{Information Processing Letters} + \renewcommand*{\DTLjacm}{Journal of the ACM} + \renewcommand*{\DTLjcss}{Journal of Computer and System Sciences} + \renewcommand*{\DTLscp}{Science of Computer Programming} + \renewcommand*{\DTLsicomp}{SIAM Journal on Computing} + \renewcommand*{\DTLtocs}{ACM Transactions on Computer Systems} + \renewcommand*{\DTLtods}{ACM Transactions on Database Systems} + \renewcommand*{\DTLtog}{ACM Transactions on Graphics} + \renewcommand*{\DTLtoms}{ACM Transactions on Mathematical Software} + \renewcommand*{\DTLtoois}{ACM Transactions on Office Information Systems} -\renewcommand*{\DTLtoplas}{ACM Transactions on Programming Languages + \renewcommand*{\DTLtoplas}{ACM Transactions on Programming Languages and Systems} -\renewcommand*{\DTLtcs}{Theoretical Computer Science} -\renewcommand*{\DTLformatarticle}{% -\DTLformatauthorlist -\DTLifbibfieldexists{Author}{\DTLaddperiod}{}% -\DTLifbibfieldexists{Title}{% -\DTLstartsentencespace\DTLbibfield{Title}% -\DTLcheckbibfieldendsperiod{Title}% -\DTLaddperiod}{}% -\DTLifbibfieldexists{CrossRef}{% -\DTLformatarticlecrossref -\DTLifbibfieldexists{Pages}{\DTLaddcomma}{}% -\DTLformatpages -\DTLaddperiod -}{% no cross ref field -\DTLifbibfieldexists{Journal}{\DTLstartsentencespace -{\em\DTLbibfield{Journal}}% -\DTLcheckbibfieldendsperiod{Journal}% -\DTLifanybibfieldexists{Number,Volume,Pages,Month,Year}{% -\DTLaddcomma}{\DTLaddperiod}}{}% -\DTLformatvolnumpages -\DTLifanybibfieldexists{Volume,Number,Pages}{% -\DTLifanybibfieldexists{Year,Month}{\DTLaddcomma}{% -\DTLaddperiod}% -\DTLmidsentencefalse}{}% -\DTLformatdate -\DTLifanybibfieldexists{Year,Month}{\DTLaddperiod}{}% -}% -\DTLifbibfieldexists{Note}{\DTLstartsentencespace\DTLbibfield{Note}% -\DTLcheckbibfieldendsperiod{Note}% -\DTLaddperiod}{}% -} + \renewcommand*{\DTLtcs}{Theoretical Computer Science} + \renewcommand*{\DTLformatarticle}{% + \DTLformatauthorlist + \DTLifbibfieldexists{Author}{\DTLaddperiod}{}% + \DTLifbibfieldexists{Title}{% + \DTLstartsentencespace\DTLbibfield{Title}% + \DTLcheckbibfieldendsperiod{Title}% + \DTLaddperiod}{}% + \DTLifbibfieldexists{CrossRef}{% + \DTLformatarticlecrossref + \DTLifbibfieldexists{Pages}{\DTLaddcomma}{}% + \DTLformatpages + \DTLaddperiod + }{% no cross ref field + \DTLifbibfieldexists{Journal}{\DTLstartsentencespace + {\em\DTLbibfield{Journal}}% + \DTLcheckbibfieldendsperiod{Journal}% + \DTLifanybibfieldexists{Number,Volume,Pages,Month,Year}{% + \DTLaddcomma}{\DTLaddperiod}}{}% + \DTLformatvolnumpages + \DTLifanybibfieldexists{Volume,Number,Pages}{% + \DTLifanybibfieldexists{Year,Month}{\DTLaddcomma}{% + \DTLaddperiod}% + \DTLmidsentencefalse}{}% + \DTLformatdate + \DTLifanybibfieldexists{Year,Month}{\DTLaddperiod}{}% + }% + \DTLifbibfieldexists{Note}{\DTLstartsentencespace\DTLbibfield{Note}% + \DTLcheckbibfieldendsperiod{Note}% + \DTLaddperiod}{}% + } \renewcommand*{\DTLformatbook}{% -\DTLifbibfieldexists{Author}{% -\DTLformatauthorlist\DTLaddperiod -}{\DTLformateditorlist\DTLifbibfieldexists{Editor}{% -\DTLaddperiod}{}}% -\DTLifbibfieldexists{Title}{\DTLstartsentencespace -{\em\DTLbibfield{Title}}% -\DTLcheckbibfieldendsperiod{Title}}{}% -\DTLifbibfieldexists{CrossRef}{% -\DTLifbibfieldexists{Title}{\DTLaddperiod}{}% -\DTLformatbookcrossref -\DTLifanybibfieldexists{Edition,Month,Year}{\DTLaddcomma -}{\DTLaddperiod}% -}{% no cross ref field -\DTLifbibfieldexists{Title}{% -\DTLifbibfieldexists{Volume}{\DTLaddcomma}{\DTLaddperiod}}{}% -\DTLformatbvolume -\DTLformatnumberseries -\DTLifanybibfieldexists{Number,Series,Volume}{\DTLaddperiod}{}% -\DTLifbibfieldexists{Publisher}{\DTLstartsentencespace -\DTLbibfield{Publisher}% -\DTLcheckbibfieldendsperiod{Publisher}% -\DTLifbibfieldexists{Address}{\DTLaddcomma}{% -\DTLifanybibfieldexists{Month,Year}{\DTLaddcomma -}{\DTLaddperiod}% -}}{}% -\DTLifbibfieldexists{Address}{\DTLstartsentencespace -\DTLbibfield{Address}% -\DTLcheckbibfieldendsperiod{Address}% -\DTLifanybibfieldexists{Month,Year}{\DTLaddcomma}{\DTLaddperiod}}{}% -}% -\DTLifbibfieldexists{Edition}{% -\protected@edef\@dtl@tmp{\DTLformatedition{\DTLbibfield{Edition}}}% -\ifDTLmidsentence - \@dtl@tmp -\else - \DTLstartsentencespace\expandafter\MakeUppercase\@dtl@tmp -\fi -\expandafter\DTLcheckendsperiod\expandafter{\@dtl@tmp}% -\DTLifanybibfieldexists{Month,Year}{\DTLaddcomma}{\DTLaddperiod}% -}{}% -\DTLformatdate -\DTLifanybibfieldexists{Year,Month}{\DTLaddperiod}{}% -\DTLifbibfieldexists{Note}{\DTLstartsentencespace -\DTLbibfield{Note}% -\DTLcheckbibfieldendsperiod{Note}% -\DTLaddperiod}{}% + \DTLifbibfieldexists{Author}% + {% + \DTLformatauthorlist\DTLaddperiod + }% + {% + \DTLformateditorlist + \DTLifbibfieldexists{Editor}% + {% + \DTLaddperiod + }% + {}% + }% + \DTLifbibfieldexists{Title}% + {% + \DTLstartsentencespace + \DTLformatbooktitle{\DTLbibfield{Title}}% + \DTLcheckbibfieldendsperiod{Title}% + }% + {}% + \DTLifbibfieldexists{CrossRef}% + {% + \DTLifbibfieldexists{Title}{\DTLaddperiod}{}% + \DTLformatbookcrossref + \DTLifanybibfieldexists{Edition,Month,Year}% + {\DTLaddcomma}% + {\DTLaddperiod}% + }% + {% + \DTLifbibfieldexists{Title}% + {% + \DTLifbibfieldexists{Volume}{\DTLaddcomma}{\DTLaddperiod}% + }% + {}% + \DTLformatbvolume + \DTLformatnumberseries + \DTLifanybibfieldexists{Number,Series,Volume}{\DTLaddperiod}{}% + \DTLifbibfieldexists{Publisher}% + {% + \DTLstartsentencespace + \DTLbibfield{Publisher}% + \DTLcheckbibfieldendsperiod{Publisher}% + \DTLifbibfieldexists{Address}% + {\DTLaddcomma}% + {% + \DTLifanybibfieldexists{Month,Year}% + {\DTLaddcomma}% + {\DTLaddperiod}% + }% + }% + {}% + \DTLifbibfieldexists{Address}% + {% + \DTLstartsentencespace + \DTLbibfield{Address}% + \DTLcheckbibfieldendsperiod{Address}% + \DTLifanybibfieldexists{Month,Year}{\DTLaddcomma}{\DTLaddperiod}% + }% + {}% + }% + \DTLifbibfieldexists{Edition}% + {% + \protected@edef\@dtl@tmp{\DTLformatedition{\DTLbibfield{Edition}}}% + \ifDTLmidsentence + \@dtl@tmp + \else + \DTLstartsentencespace\expandafter\MakeUppercase\@dtl@tmp + \fi + \expandafter\DTLcheckendsperiod\expandafter{\@dtl@tmp}% + \DTLifanybibfieldexists{Month,Year}{\DTLaddcomma}{\DTLaddperiod}% + }% + {}% + \DTLformatdate + \DTLifanybibfieldexists{Year,Month}{\DTLaddperiod}{}% + \DTLifbibfieldexists{Note}% + {% + \DTLstartsentencespace + \DTLbibfield{Note}% + \DTLcheckbibfieldendsperiod{Note}% + \DTLaddperiod + }% + {}% }% \renewcommand*{\DTLformatbooklet}{% \DTLifbibfieldexists{Author}{% @@ -1382,6 +1436,7 @@ Month,Year}{\DTLaddcomma}{\DTLaddperiod}}{}% \DTLifanybibfieldexists{Month,Year}{\DTLaddperiod}{}% }% } +\newcommand*{\DTLformatbooktitle}[1]{\emph{#1}} \newcommand{\dtlbst@abbrv}{% \dtlbst@plain \renewcommand*{\DTLformatauthor}[4]{% diff --git a/Master/texmf-dist/tex/latex/datatool/datatool-base.sty b/Master/texmf-dist/tex/latex/datatool/datatool-base.sty index e0e288a574e..14eb1f27055 100644 --- a/Master/texmf-dist/tex/latex/datatool/datatool-base.sty +++ b/Master/texmf-dist/tex/latex/datatool/datatool-base.sty @@ -39,7 +39,7 @@ %% Grave accent \` Left brace \{ Vertical bar \| %% Right brace \} Tilde \~} \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{datatool-base}[2013/09/06 v2.18 (NLCT)] +\ProvidesPackage{datatool-base}[2014/06/10 v2.22 (NLCT)] \RequirePackage{etoolbox} \RequirePackage{amsmath} \RequirePackage{xkeyval} @@ -424,11 +424,13 @@ \def\@dtl@decimaltolocale#1.#2\relax{% \@dtl@decimaltolocaleint{#1}% \def\@dtl@fracpart{#2}% - \ifx\@dtl@fracpart\@empty + \ifdefempty\@dtl@fracpart + {% \def\@dtl@fracpart{0}% - \else + }% + {% \@dtl@decimaltolocalefrac#2\relax - \fi + }% } \def\@dtl@decimaltolocaleint#1{% \@dtl@tmpcount=0\relax @@ -472,8 +474,26 @@ \@dtl@localeintnext#2\relax } \def\@dtl@decimaltolocalefrac#1.\relax{% - \def\@dtl@fracpart{#1}% - \@dtl@choptrailingzeroes{\@dtl@fracpart}% + \count@=0\relax + \@dtl@digitcount#1\relax + \ifnum\count@>9\relax + \@dtl@chopexcessfrac#1000000000\@nil + \else + \def\@dtl@fracpart{#1}% + \fi +} +\newcommand*{\@dtl@chopexcessfrac}[9]{% + \def\@dtl@fracpart{#1#2#3#4#5#6#7#8#9}% + \@dtl@gobbletonil +} +\newcommand*{\@dtl@digitcount}[1]{% + \ifx\relax#1\relax + \let\@dtl@digitcountnext\relax + \else + \advance\count@ by \@ne + \let\@dtl@digitcountnext\@dtl@digitcount + \fi + \@dtl@digitcountnext } \newcommand*{\DTLdecimaltocurrency}[2]{% \edef\@dtl@tmpdtl{#1}% diff --git a/Master/texmf-dist/tex/latex/datatool/datatool.sty b/Master/texmf-dist/tex/latex/datatool/datatool.sty index 645feeed87e..79299f2620f 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}[2014/03/08 v2.21 (NLCT)] +\ProvidesPackage{datatool}[2014/06/10 v2.22 (NLCT)] \RequirePackage{xkeyval} \RequirePackage{ifthen} \RequirePackage{xfor} @@ -3047,6 +3047,8 @@ \newread\@dtl@read \newcount\dtl@entrycr \define@boolkey{loaddb}[dtl]{noheader}[true]{} +\define@boolkey{loaddb}[dtl]{autokeys}[true]{} +\dtlautokeysfalse \define@key{loaddb}{keys}{% \dtl@entrycr=0\relax \@for\@dtl@key:=#1\do @@ -3132,11 +3134,16 @@ \loop \expandafter\@dtl@lopoff\@dtl@lin@\to\@dtl@lin@\@dtl@key \advance\dtl@entrycr by 1\relax - \ifdefempty{\@dtl@key}% - {% - \edef\@dtl@key{\dtldefaultkey\number\dtl@entrycr}% - }% - {}% + \ifdtlautokeys + \csedef{@dtl@inky@\romannumeral\dtl@entrycr}% + {\dtldefaultkey\number\dtl@entrycr}% + \else + \ifdefempty{\@dtl@key}% + {% + \edef\@dtl@key{\dtldefaultkey\number\dtl@entrycr}% + }% + {}% + \fi \expandafter\@dtl@toks\expandafter{\@dtl@key}% \@ifundefined{@dtl@inky@\romannumeral\dtl@entrycr}% {% -- cgit v1.2.3