diff options
Diffstat (limited to 'Master/texmf-dist/source/latex/multibib/multibib.dtx')
-rw-r--r-- | Master/texmf-dist/source/latex/multibib/multibib.dtx | 267 |
1 files changed, 208 insertions, 59 deletions
diff --git a/Master/texmf-dist/source/latex/multibib/multibib.dtx b/Master/texmf-dist/source/latex/multibib/multibib.dtx index a4a387ce815..8c6c0ecbe19 100644 --- a/Master/texmf-dist/source/latex/multibib/multibib.dtx +++ b/Master/texmf-dist/source/latex/multibib/multibib.dtx @@ -1,9 +1,23 @@ -% \CheckSum{394} +% \CheckSum{538} % % \iffalse %% Package `multibib' to use with LaTeX2e. -%% Copyright (C) 2003 by Thorsten Hansen. All rights reserved. %% +%% Copyright (C) 2008 by Thorsten Hansen +%% +% +% This work may be distributed and/or modified under the conditions of +% the LaTeX Project Public License, either version 1.3 of this license +% or 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 2003/12/01 or +% later. +% +% This work has the LPPL maintenance status "maintained". The Current +% Maintainer of this work is Thorsten Hansen. +% +% This is a contributed file to the LaTeX2e system. +% % %<*dtx> \ProvidesFile{multibib.dtx} @@ -13,7 +27,7 @@ %<driver>\ProvidesFile{multibib.drv} % \fi % \ProvidesFile{multibib.dtx} - [2004/01/28 v1.3 Multiple bibliographies for one document.] + [2008/12/10 v1.4 Multiple bibliographies for one document.] % % \iffalse %<*driver> @@ -85,7 +99,7 @@ % \GetFileInfo{multibib.dtx} % \title{The \textsf{multibib} Package} % \author{Thorsten Hansen\\ -% \normalsize thorsten.hansen@psychol.uni-giessen.de} +% \normalsize Thorsten.Hansen@psychol.uni-giessen.de} % \date{\fileversion\quad \filedate} % \maketitle % @@ -117,8 +131,16 @@ % \changes{v1.2b}{2003/09/22}{General compatibility mechanism for packages % which define their own cite commands, motivated by % compatibility to \package{jurabib}.} -% \changes{v1.2c}{2004/01/23}{Streamline code.} +% \changes{v1.2c}{2004/01/23}{Code streamlined.} % \changes{v1.3}{2004/01/24}{Documentation.} +% \changes{v1.3a}{2004/02/09}{Continuous numerical labels with natbib.} +% \changes{v1.3b}{2004/02/10}{\macrott{isnumber} changed to accept +% arguments with \macrott{fi}, e.g., +% {\macrott{iffalse}{bjko}\macrott{fi}}.} +% \changes{v1.3c}{2004/02/10}{Allow \macrott{bibliographystyle<s>} to +% be used in the preamble.} +% \changes{v1.3d}{2005/10/25}{New option \option{labeled}.} +% \changes{v1.4}{2008/12/10}{Documentation.} % % % @@ -150,7 +172,7 @@ % Suppose, you have to separate your citations into two bibliographies, % one for primary literature and one for secondary literature. The % \package{multibib} package defines the |\newcite| command which -% introduces a new new family of cite and bibliography commands. +% introduces a new family of cite and bibliography commands. % \begin{verbatim} % \newcites{sec}{Secondary Literature} % \end{verbatim} @@ -243,6 +265,24 @@ % % \subsection{Package Options} % \begin{description} +% \item[labeled] Add the internal suffixes for each +% bibliography as prefixes to the labels to the bibliography. For +% example, if you define +% \begin{verbatim}\newcites{A,B,C}% +% {Own \LaTeX\ Work,% +% Submitted,% +% {Habilitations, Dissertations and Diploma Thesis}} +% \end{verbatim} +% and specify a numerical bibstyle +% \verb+\bibliographystyleA{plain}+, the labels in the +% bibliography and the cited references will be [A1], [A2], [A3], +% \dots; analogously, \verb+\bibliographystyleB{plain}+ results +% in labels and cited references [B1], [B2], [B3],\dots; and +% \verb+\bibliographystyleC{plain}+ results in labels and cited +% references [C1], [C2], [C3], \dots . This option is useful +% together with option \option{resetlabels} and numerical +% reference schemes. +% % \item[resetlabels] When using numerical reference schemes, % start each bibliography with~`[1]'. Default is continuous numbering, % such that labels are created unambiguously. @@ -267,7 +307,7 @@ % \subsection{Limitations} % % \begin{itemize} -% \item When using numerical reference schemes and references to the +% \item When numerical reference schemes are used and references to the % same item appear in different bibliographies, the labels % cannot be resolved properly. Rather, the replacement text % (i.e, the number) is used which is defined in the auxiliary @@ -395,7 +435,7 @@ % internal macro |\@citex| called from |\cite| by, e.g., changing % the number of arguments, and/or define new variants of |\cite|, such as % \package{natbib}'s |\citep|, deserve a special handling to ensure -% combatibility to \package{multibib}. In the first case, the problem +% compatibility to \package{multibib}. In the first case, the problem % arise because \package{multibib}'s redefinition of |\@citex| to write to % a new auxiliary file |\@newciteauxhandle| instead of writing to % |\@auxout| is overwritten. In the second case, the problem arise @@ -430,7 +470,7 @@ % |\@restoreauxhandle|. % \end{enumerate} % At present, packages \package{cite} and \package{jurabib} use this -% combatibility mechanism. +% compatibility mechanism. % % % @@ -447,7 +487,7 @@ % \begin{verbatim} % \def\@mb@citenamelist{cite,citep,citet,citealp,citealt,footcite} % \end{verbatim} -% At present, package \package{jurabib} use this combatibility mechanism. +% At present, package \package{jurabib} use this compatibility mechanism. % % % @@ -552,7 +592,7 @@ % % \section{The Macros} % -% One paradigm with guided the development of the code was to use +% One paradigm which guided the development of the code was to use % standard \LaTeX\ commands as much as possible, and to customize their % behavior using |\let|. % @@ -573,9 +613,29 @@ \newif\ifcontinuouslabels \continuouslabelstrue \DeclareOption{resetlabels}{\continuouslabelsfalse} -\ProcessOptions % \end{macrocode} % \end{macro} +% +% +% \begin{macro}{labeled} +% \changes{v1.3d}{2005/10/25}{Define option \option{labeled}.} +% +% Define a new option to add the internal suffixes for each +% bibliography as labels to the bibitems. +% \begin{macrocode} +\newif\iflabeled +\labeledfalse +\DeclareOption{labeled}{\labeledtrue} +% \end{macrocode} +% \end{macro} +% +% +% +% \noindent Finally, process all package options. +% +% \begin{macrocode} +\ProcessOptions +% \end{macrocode} % % % \subsection{Preliminaries} @@ -596,13 +656,12 @@ % \begin{macro}{\@newciteauxhandle} % \changes{v1.1b}{2001/10/10}{Handle removed.} % -% Define a new handle of the auxiliary file for -% all |\cite| and |\nocite| commands, standard as well as newly -% defined. For the standard commands, this handle is let to -% |\auxout|. Since version 1.1b the definition -% |\let\@newciteauxhandle\@auxout| is no longer needed since -% below we reset |\@citex| to its standard value after each call of -% |\mb@@citex|. +% Define a new handle of the auxiliary file for all |\cite| and +% |\nocite| commands, standard as well as newly defined. For the +% standard commands, this handle is let to |\auxout|. Since version +% 1.1b the definition |\let\@newciteauxhandle\@auxout| is no longer +% needed since below we reset |\@citex| to its standard value +% after each call of |\mb@@citex|. % \end{macro} % % @@ -726,6 +785,8 @@ % \changes{v1.0i}{2000/01/14}{No change of label width for option % \option{resetlabels}.} % \changes{v1.0k}{1999/01/14}{\package{suthesis} compatibility.} +% \changes{v1.3a}{2004/02/09}{Natbib specific definition of +% thebibliography, modified to use \macrott{usecounter}.} % % The argument of |\thebibliography| determines the width of the % labels in the bibliography. First it is checked if the parameter @@ -748,21 +809,62 @@ \addcontentsline{toc}{chapter}{\bibname}% \@ldthebibliography{#1}}}% {}% - \let\std@thebibliography\thebibliography - \def\thebibliography#1{% - \@isnumber{#1}% - {\ifnum\mb@biblabelwidth=0 - \@tempcnta\c@enumiv - \ifcontinuouslabels - \advance\@tempcnta#1% - \fi - \std@thebibliography{\@arabic\@tempcnta}% - \else - \std@thebibliography{\@arabic\mb@biblabelwidth}% + \@ifpackageloaded{natbib}% + {% + + +\renewenvironment{thebibliography}[1]{% + \bibsection\parindent \z@\bibpreamble\bibfont\list + {\@biblabel{\arabic{NAT@ctr}}}{\@bibsetup{#1}% + \usecounter{NAT@ctr}}% %% only changed here to usecounter + \ifNAT@openbib + \renewcommand\newblock{\par} + \else + \renewcommand\newblock{\hskip .11em \@plus.33em \@minus.07em}% + \fi + \sloppy\clubpenalty4000\widowpenalty4000 + \sfcode`\.=1000\relax + \let\citeN\cite \let\shortcite\cite + \let\citeasnoun\cite + }{\def\@noitemerr{% + \PackageWarning{natbib} + {Empty `thebibliography' environment}}% + \endlist\vskip-\lastskip} + + \let\std@thebibliography\thebibliography + \def\thebibliography#1{% + \@isnumber{#1}% + {\ifnum\mb@biblabelwidth=0 + \@tempcnta\c@NAT@ctr %% changed here to c@NAT@ctr + \ifcontinuouslabels + \advance\@tempcnta#1% + \fi + \std@thebibliography{\@arabic\@tempcnta}% + \else + \std@thebibliography{\@arabic\mb@biblabelwidth}% \global\mb@biblabelwidth 0 - \fi}% - {\std@thebibliography{#1}}% - }% + \fi}% + {\std@thebibliography{#1}}% + }% + }% + {% else, natbib not loaded + \let\std@thebibliography\thebibliography + + \def\thebibliography#1{% + \@isnumber{#1}% + {\ifnum\mb@biblabelwidth=0 + \@tempcnta\c@enumiv + \ifcontinuouslabels + \advance\@tempcnta#1% + \fi + \std@thebibliography{\@arabic\@tempcnta}% + \else + \std@thebibliography{\@arabic\mb@biblabelwidth}% + \global\mb@biblabelwidth 0 + \fi}% + {\std@thebibliography{#1}}% + }% + }% } % \end{macrocode} % \end{macro} @@ -773,6 +875,9 @@ % \changes{v1.0g}{2000/01/10}{Empty string is not handled as number.} % \changes{v1.1d}{2001/01/04}{Execute \macrott{@scannumber} in % \macrott{hbox}.} +% \changes{v1.3b}{2004/02/10}{\macrott{isnumber} changed to accept +% arguments with \macrott{fi}, e.g., +% {\macrott{iffalse}{bjko}\macrott{fi}}.} % % Macro |\@isnumber| behaves as follows: If |#1| is a number (which % may contain blanks at arbitrary positions), |#2| is executed, @@ -780,13 +885,18 @@ % % \begin{macrocode} \newcommand{\@isnumber}[3]{% - \def\argi{#1}% - \ifx\argi\empty + \def\argdef{#1}% + \edef\argedef{#1}% + \ifx\argedef\empty #3 \else - \global\@tempswafalse - \setbox\@tempboxa=\hbox{\@scannumber#1\plugh}% - \if@tempswa#2\else#3\fi + \ifx\argdef\argedef + \global\@tempswafalse + \setbox\@tempboxa=\hbox{\@scannumber#1\plugh}% + \if@tempswa#2\else#3\fi + \else + #3 + \fi \fi} % \end{macrocode} % \end{macro} @@ -993,29 +1103,55 @@ % \end{macro} % % +% \begin{macro}{\bibitem<s>} +% +% \changes{v1.3d}{2005/10/25}{Define a bibliography specific +% version of \macrott{@bibitem} and +% \macrott{@biblabel} if \option{labeled} is +% active.} +% +% \begin{macrocode} + \iflabeled % if option labeled + \expandafter\edef\csname @bibitem\@suffix\endcsname##1{% + \noexpand\item + \noexpand\if@filesw \noexpand\immediate\noexpand\write\noexpand\@auxout + {\noexpand\string\noexpand\bibcite{##1}% + {\@suffix\noexpand\the\noexpand\value{\noexpand\@listctr}}}% + \noexpand\fi + \noexpand\ignorespaces}% + \expandafter\edef\csname @biblabel\@suffix\endcsname##1{[\@suffix##1]}% + \fi % end if option labeled +% \end{macrocode} +% \end{macro} +% +% % \begin{macro}{\bibliography<s>} % \changes{v1.0i}{2000/01/12}{Remove setting of \macrott{usecounter} and % \macrott{newusecounter} which is done % in redefined \macrott{bibliography}.} % \changes{v1.1e}{2001/01/04}{Definition of \macrott{bibname} analogously % to \macrott{refname}.} -% -% Define new |\bibliography|\meta{s} equivalents. -% The standard |\bibliography| macro does -% two things: The bibdata file is written to the auxiliary file -% |\@auxout| and the |.bbl| file |\jobname.bbl| is inputed. For -% |\bibliography|\meta{s}, we thus let both |\@auxout| -% and |\jobname| refer to the new auxiliary file \meta{s}|.aux|. -% Since some styles and classes write the heading -% of the bibliography to the table of contents, the old meaning of -% |\@auxout| is saved in |\temp@auxout| and |\addtocontents| is locally -% replaced by \package{multibib}s variant |\mb@addtocontents| -% (defined above) which writes to |\temp@auxout| instead of -% |\auxout|. Further, the heading of the bibliography generated by -% |\refname| or |\bibname| depending on the class is set to the -% particular heading of |\bibliography|\meta{s}. After this -% redefinitions, the standard |\bibliography| can be evoked. -% Extra braces are needed to encapsulate the various |\let|s. +% \changes{v1.3d}{2005/10/25}{Activate the bibliography specific +% versions of \macrott{@bibitem} and +% \macrott{@biblabel} if \option{labeled} is +% active.} +% +% Define new |\bibliography|\meta{s} equivalents. +% The standard |\bibliography| macro does +% two things: The bibdata file is written to the auxiliary file +% |\@auxout| and the |.bbl| file |\jobname.bbl| is inputed. For +% |\bibliography|\meta{s}, we thus let both |\@auxout| +% and |\jobname| refer to the new auxiliary file \meta{s}|.aux|. +% Since some styles and classes write the heading +% of the bibliography to the table of contents, the old meaning of +% |\@auxout| is saved in |\temp@auxout| and |\addtocontents| is locally +% replaced by \package{multibib}s variant |\mb@addtocontents| +% (defined above) which writes to |\temp@auxout| instead of +% |\auxout|. Further, the heading of the bibliography generated by +% |\refname| or |\bibname| depending on the class is set to the +% particular heading of |\bibliography|\meta{s}. After this +% redefinitions, the standard |\bibliography| can be evoked. +% Extra braces are needed to encapsulate the various |\let|s. % \begin{macrocode} \expandafter\edef\csname bibliography\@suffix\endcsname##1{{% \let\noexpand\temp@auxout\noexpand\@auxout @@ -1026,7 +1162,13 @@ \let\noexpand\refname \expandafter\noexpand\csname refname\@suffix\endcsname \let\noexpand\bibname - \expandafter\noexpand\csname refname\@suffix\endcsname + \expandafter\noexpand\csname refname\@suffix\endcsname + \iflabeled + \let\noexpand\@bibitem + \expandafter\noexpand\csname @bibitem\@suffix\endcsname + \let\noexpand\@biblabel + \expandafter\noexpand\csname @biblabel\@suffix\endcsname + \fi \noexpand\bibliography{##1}% }} % \end{macrocode} @@ -1035,11 +1177,18 @@ % \newpage % % \begin{macro}{\bibliographystyle<s>} +% \changes{v1.3c}{2004/02/10}{Write directly the \macrott{bibstyle} +% macro to the specific auxfile instead of redefining a +% auxhandle and then using the standard +% \macrott{bibliographystyle} macro.} +% % Define new |\bibliographystyle|\meta{s} equivalents. % \begin{macrocode} - \expandafter\edef\csname bibliographystyle\@suffix\endcsname##1{{% - \let\noexpand\@auxout\csname @auxout\@suffix\endcsname - \noexpand\bibliographystyle{##1}}}% + \expandafter\edef\csname bibliographystyle\@suffix\endcsname##1{% + \noexpand\if@filesw + \noexpand\immediate\noexpand\write\csname @auxout\@suffix\endcsname + {\noexpand\string\noexpand\bibstyle{##1}}% + \noexpand\fi} % \end{macrocode} % \end{macro} % |