diff options
Diffstat (limited to 'Master/texmf-dist/tex/latex/datatool/databib.sty')
-rw-r--r-- | Master/texmf-dist/tex/latex/datatool/databib.sty | 149 |
1 files changed, 126 insertions, 23 deletions
diff --git a/Master/texmf-dist/tex/latex/datatool/databib.sty b/Master/texmf-dist/tex/latex/datatool/databib.sty index 2b168d64dd4..44160a138d9 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 2007 Nicola Talbot +%% Copyright 2009 Nicola Talbot %% %% This work may be distributed and/or modified under the %% conditions of the LaTeX Project Public License, either version 1.3 @@ -39,7 +39,7 @@ %% Grave accent \` Left brace \{ Vertical bar \| %% Right brace \} Tilde \~} \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{databib}[2007/08/17 v1.0 (NLCT)] +\ProvidesPackage{databib}[2009/02/27 v2.0 (NLCT)] \RequirePackage{datatool} \newcommand*{\dtlbib@style}{plain} \define@choicekey{databib.sty}{style}{plain,abbrv,alpha}{% @@ -53,9 +53,9 @@ \DTLnewdb{#2}% \edef\DTLBIBdbname{#2}% \@input@{#1}} -\newcommand*{\DTLnewbibrow}{\DTLnewrow{\DTLBIBdbname}} +\newcommand*{\DTLnewbibrow}{\@DTLnewrow{\DTLBIBdbname}} \newcommand*{\DTLnewbibitem}[2]{% -\DTLnewdbentry{\DTLBIBdbname}{#1}{#2}} + \@DTLnewdbentry{\DTLBIBdbname}{#1}{#2}} \providecommand*{\andname}{and} \providecommand*{\ofname}{of} \providecommand*{\inname}{in} @@ -71,19 +71,23 @@ \providecommand*{\mscthesisname}{Master's thesis} \providecommand*{\phdthesisname}{PhD thesis} \newcommand*{\DTLbibliography}[2][\boolean{true}]{% -\begin{DTLthebibliography}[#1]{#2}% -\DTLforeachbibentry[#1]{#2}{% -\DTLbibitem \DTLformatbibentry \DTLendbibitem -}% -\end{DTLthebibliography}% + \begin{DTLthebibliography}[#1]{#2}% + \DTLforeachbibentry[#1]{#2}{% + \DTLbibitem \DTLformatbibentry \DTLendbibitem + }% + \end{DTLthebibliography}% } \newcommand*{\DTLformatbibentry}{% -\@ifundefined{DTLformat\DBIBentrytype}{% -\PackageError{databib}{Don't know how to format bibliography entries -of type `\DBIBentrytype'}{}}{% -\dtl@message{[\DBIBcitekey]}% -\DTLstartsentencefalse\DTLmidsentencefalse\DTLperiodfalse -\csname DTLformat\DBIBentrytype\endcsname}% + \@ifundefined{DTLformat\DBIBentrytype}% + {% + \PackageError{databib}{Don't know how to format bibliography + entries of type `\DBIBentrytype'}{}% + }% + {% + \dtl@message{[\DBIBcitekey]}% + \DTLstartsentencefalse\DTLmidsentencefalse\DTLperiodfalse + \csname DTLformat\DBIBentrytype\endcsname + }% } \newcommand*{\DTLendbibitem}{} \newlength\dtl@widest @@ -101,15 +105,23 @@ of type `\DBIBentrytype'}{}}{% \newcommand*{\DTLforeachbibentry}{% \@ifstar\@DTLforeachbibentry\@DTLforeachbibentry} \newcommand*{\@DTLforeachbibentry}[3][\boolean{true}]{% -\edef\DBIBname{#2}\setcounter{DTLbibrow}{0}% -\@DTLforeach{#2}{\DBIBcitekey=CiteKey,\DBIBentrytype -=EntryType}{\dtl@gathervalues{#2}{\@dtl@currentrow}% -\ifthenelse{#1}{\refstepcounter{DTLbibrow}#3}{}}} + \edef\DBIBname{#2}% + \setcounter{DTLbibrow}{0}% + \@DTLforeach{#2}{\DBIBcitekey=CiteKey,\DBIBentrytype=EntryType}% + {% + \dtl@gathervalues{#2}{\dtlcurrentrow}% + \ifthenelse{#1}{\refstepcounter{DTLbibrow}#3}{}% + }% +} \newcommand*{\@sDTLforeachbibentry}[3][\boolean{true}]{% -\edef\DBIBname{#2}\setcounter{DTLbibrow}{0}% -\@sDTLforeach{#2}{\DBIBcitekey=CiteKey,\DBIBentrytype -=EntryType}{\dtl@gathervalues{#2}{\@dtl@currentrow}% -\ifthenelse{#1}{\refstepcounter{DTLbibrow}#3}{}}} + \edef\DBIBname{#2}% + \setcounter{DTLbibrow}{0}% + \@sDTLforeach{#2}{\DBIBcitekey=CiteKey,\DBIBentrytype=EntryType}% + {% + \dtl@gathervalues{#2}{\dtlcurrentrow}% + \ifthenelse{#1}{\refstepcounter{DTLbibrow}#3}{}% + }% +} \newcounter{DTLbibrow} \def\theHDTLbibrow{\theHDTLrow.bib.\arabic{DTLbibrow}}% \newcommand*{\DTLbibfield}[1]{\csname @dtl@key@#1\endcsname} @@ -667,6 +679,7 @@ of type `\DBIBentrytype'}{}}{% \or Dec.% \fi} \newcommand*{\DTLbibitem}{\bibitem{\DBIBcitekey}} +\newcommand*{\DTLmbibitem}[1]{\bibitem{#1@\DBIBcitekey}} \newcommand*{\DTLformatauthor}[4]{% \DTLformatforenames{#4} \DTLformatvon{#1}% @@ -721,6 +734,7 @@ and Systems} \begin{thebibliography}{\number\@dtl@tmpcount}% }{\end{thebibliography}}% \renewcommand*{\DTLbibitem}{\bibitem{\DBIBcitekey}}% +\renewcommand*{\DTLmbibitem}[1]{\bibitem{##1@\DBIBcitekey}}% \renewcommand*{\DTLformatauthor}[4]{% \DTLformatforenames{##4} \DTLformatvon{##1}% @@ -1366,6 +1380,9 @@ Integrated Circuits} \renewcommand*{\DTLbibitem}{% \expandafter\bibitem\expandafter [\csname dtl@biblabel@\DBIBcitekey\endcsname]{\DBIBcitekey}}% +\renewcommand*{\DTLmbibitem}[1]{% +\expandafter\bibitem\expandafter + [\csname dtl@biblabel@\DBIBcitekey\endcsname]{##1@\DBIBcitekey}}% } \newcommand*{\dtl@createalphabiblabels}[2]{% \dtl@message{Creating bib labels}% @@ -1524,6 +1541,92 @@ Integrated Circuits} \@ifundefined{dtlbst@#1}{\PackageError{databib}{Unknown bibliography style `#1'}{}}{\csname dtlbst@#1\endcsname}} \DTLbibliographystyle{\dtlbib@style} +\newcommand*{\DTLmultibibs}[1]{% +\@for\@dtl@af:=#1\do{% +\@ifundefined{dtl@aux@\@dtl@af}{% +\expandafter\newwrite\csname dtl@aux@\@dtl@af\endcsname +\expandafter\immediate +\expandafter\openout\csname dtl@aux@\@dtl@af\endcsname=\@dtl@af.aux +\expandafter\def\csname b@\@dtl@af @*\endcsname{}% +}{% +\PackageError{databib}{Can't create auxiliary file `\@dtl@af.aux', +\expandafter\string\csname dtl@aux@\@dtl@af\endcsname\space +already exists}{}}}} +\@onlypreamble{\DTLmultibibs} +\newcommand*{\DTLcite}{\@ifnextchar[{\@tempswatrue \dtl@citex +}{\@tempswafalse \dtl@citex[]}} +\def\dtl@citex[#1]#2#3{% +\leavevmode\let\@citea\@empty +\@cite{\@for\@citeb:=#3\do{\@citea + \def\@citea{,\penalty \@m \ }% + \edef\@citeb{\expandafter\@firstofone\@citeb\@empty}% + \if@filesw + \@ifundefined{dtl@aux@#2}{% + \PackageError{databib}{multibib `#2' not defined}{% + You need to define `#2' in \string\DTLmutlibibs}% + }{% + \expandafter\immediate + \expandafter\write\csname dtl@aux@#2\endcsname{% + \string\citation{\@citeb}}% + }% + \fi + \@ifundefined{b@#2@\@citeb}{% + \hbox{\reset@font\bfseries ?}% + \G@refundefinedtrue + \@latex@warning{Citation `\@citeb ' on page \thepage \space + undefined}% + }{% + \@cite@ofmt{\csname b@#2@\@citeb \endcsname }% + }% +}}{#1}% +} +\newcommand*{\DTLnocite}[2]{% +\@ifundefined{dtl@aux@#1}{% + \PackageError{databib}{multibib `#1' not defined}{% + You need to define `#1' in \string\DTLmutlibibs}% +}{% + \@bsphack + \ifx\@onlypreamble\document + \@for\@citeb:=#2\do{% + \edef\@citeb{\expandafter\@firstofone\@citeb}% + \if@filesw + \expandafter\immediate + \expandafter\write\csname dtl@aux@#1\endcsname{% + \string\citation{\@citeb}}% + \fi + \@ifundefined{b@#1@\@citeb}{% + \G@refundefinedtrue + \@latex@warning{Citation `\@citeb ' undefined}}{}% + }% + \else + \@latex@error{Cannot be used in preamble}\@eha + \fi + \@esphack +}% +} +\newcommand*{\DTLloadmbbl}[3]{% +\@ifundefined{dtl@aux@#1}{% + \PackageError{databib}{multibib `#1' not defined}{% + You need to define `#1' in \string\DTLmutlibibs}% +}{% + \if@filesw + \expandafter\immediate\expandafter + \write\csname dtl@aux@#1\endcsname{\string\bibstyle{databib}}% + \expandafter\immediate\expandafter + \write\csname dtl@aux@#1\endcsname{\string\bibdata{#3}}% + \fi + \DTLnewdb{#2}% + \edef\DTLBIBdbname{#2}% + \@input@{#1.bbl}% +}% +} +\newcommand*{\DTLmbibliography}[3][\boolean{true}]{% +\begin{DTLthebibliography}[#1]{#3}% +\DTLforeachbibentry[#1]{#3}{% +\DTLmbibitem{#2} \DTLformatbibentry \DTLendbibitem +}% +\end{DTLthebibliography}% +} \endinput %% %% End of file `databib.sty'. |