diff options
author | Karl Berry <karl@freefriends.org> | 2010-09-13 19:16:35 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2010-09-13 19:16:35 +0000 |
commit | 8ac4866fb38af45e87b21dff99b0d56b506721a6 (patch) | |
tree | ca1b1afa5303dd8db10076f8046bef5b82ac5fe1 /Master/texmf-dist/tex/latex/cite/chapterbib.sty | |
parent | 815cea44e9f0f8cdc1b7b8d69dcd507d010301c2 (diff) |
cite update (12sep10)
git-svn-id: svn://tug.org/texlive/trunk@19710 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/cite/chapterbib.sty')
-rw-r--r-- | Master/texmf-dist/tex/latex/cite/chapterbib.sty | 124 |
1 files changed, 64 insertions, 60 deletions
diff --git a/Master/texmf-dist/tex/latex/cite/chapterbib.sty b/Master/texmf-dist/tex/latex/cite/chapterbib.sty index 573d3eb12e4..fe302365bc6 100644 --- a/Master/texmf-dist/tex/latex/cite/chapterbib.sty +++ b/Master/texmf-dist/tex/latex/cite/chapterbib.sty @@ -1,9 +1,9 @@ -% chapterbib.sty Version 1.14 (31-Mar-2009) Donald Arseneau +% chapterbib.sty Version 1.16 (5-Sep-2010) Donald Arseneau % % Allow multiple bibliographies in a LaTeX document, including items % \cite'd in more than one bibliography. % -% Copyright (C) 1989-2009 by Donald Arseneau and Niel Kempson +% Copyright (C) 1989-2010 by Donald Arseneau and Niel Kempson % These macros may be freely transmitted, reproduced, or modified % provided that this notice is left intact. % @@ -104,20 +104,7 @@ \cb@dobiblio{\@currentipfile.bbl}% \endgroup} -\long\def\@firstofone#1{#1} -\@ifundefined{reset@font}{\let\reset@font\relax}{} -\@ifundefined{bfseries}{\def\bfseries{\bf}}{} -\@ifundefined{G@refundefinedtrue}{\let\G@refundefinedtrue\relax}{} -\@ifundefined{PackageWarning}{\let\cb@warning\@warning}% - {\def\cb@warning{\PackageWarning{chapterbib}}} - -\@ifundefined{@newl@bel}{% pre-1995; must redefine \@testdef - \let\@test@defiii\@testdef - \def\@testdef#1#2#3{% - \if#1b\relax\@test@defiii b{#2\@extra@binfo}{#3}% - \else \@test@defiii #1{#2}{#3}\fi}% - \let\cb@dobiblio\@input}% - {\let\cb@dobiblio\@input@} +\let\cb@dobiblio\@input@ \def\FinalBibPrefix{\bibname\space for\space}% \def\@auto@bibname{Bibliography} @@ -157,22 +144,26 @@ \expandafter\def\expandafter\cb@sectionbib\@tempc{#1}% }} -\long\def\@gobblethree#1#2#3{}% -\def\strip@prefix#1>{} +\@ifundefined{G@refundefinedtrue}{\let\G@refundefinedtrue\relax}{} \@ifundefined{bibname}{\def\bibname{Bibliography}}{} % The following very messy hacking is to apply a prefix to each % cite value, shown in the cites and the bibitems, and active % with hyperref. The user should declare something like: % \CitationPrefix{\thechapter.} +% Because this hooking-in is so tricky and specific, it is best +% to regard this feature as perpetually "experimental". % \let\@cb@use@prefix\@empty \let\@CitationPrefix\@empty % -\newcommand\bibitemPrefix[1]{% +\newcommand\CitationPrefix[1]{% \def\@CitationPrefix{#1}% - \@ifundefined{cb@emptytoks}{\newtoks\cb@emptytoks}{}% - \cb@emptytoks={}% + \@ifundefined{cb@emptytoks}{\newtoks\cb@emptytoks}{}\cb@emptytoks={}% + \def\@cb@use@prefix{% Performed at the first \bibitem of each (sub-)bibliography + \let\value\@cb@valuehack + \def\@itemlabel{\@biblabel {\the\value\@listctr}}% + \let\@cb@use@prefix\@empty}% \def\@cb@valuehack##1{% hook into "\the\value\@listctr" \ifx\@listctr##1% only affect "\value\@listctr" \cb@emptytoks % use up the preceding \the @@ -180,26 +171,19 @@ \the % restore \the \fi \csname c@\@listctr\endcsname}% regular \value -% -% This is performed once, at the first \bibitem of each (sub-)bibliography - \def\@cb@use@prefix{% - \let\value\@cb@valuehack - \def\@itemlabel{\@biblabel {\the\value\@listctr}}% - \let\@cb@use@prefix\@empty} } -% redefine \@lbibitem to use prefixed number; set hook to use prefix -% (through \value) in \@bibitem also. -\def\@cb@insertprefix{% +% redefine \@lbibitem to use prefixed number; set hook (through \value) +% to use prefix in \@bibitem also. This \@cb@insertprefix is executed +% by \bibliography. +\def\@cb@insertprefix{% \let\@cborg@lbibitem\@lbibitem \let\@cborg@bibitem\@bibitem \def\@bibitem{\@cb@use@prefix\@cborg@bibitem}% \def\@lbibitem[##1]{\@cb@use@prefix\@cborg@lbibitem[\@CitationPrefix##1]}% + \let\@cb@insertprefix\@empty % ensure no recursive use } -\@ifundefined{DeclareOption}{% LaTeX2.09 - \def\@CB@wtoc#1{}% disable; broken in 2.09 -}{% LaTeX2e option -\ProvidesPackage{chapterbib}[2009/03/31 \space v 1.14] +\ProvidesPackage{chapterbib}[2010/09/05 \space v 1.16] \DeclareOption{sectionbib}{\AtBeginDocument{\sectionbib{\section*}{section}}% \let\FinalBibPrefix\@empty \providecommand\StartFinalBibs{\chapter*{\bibname}% @@ -213,9 +197,12 @@ \DeclareOption{gather}{\gdef\cb@biblist{}\let\cb@sub@input\@gobble} \ProcessOptions -\@ifundefined{chapter}{% - \@ifundefined{section}{}{\providecommand\CBMainSectioning{section}}% -}{\providecommand\CBMainSectioning{chapter}} +\@ifundefined{chapter}% +{\@ifundefined{section}% + {\providecommand\CBMainSectioning{page}}% silly default to prevent errors + {\providecommand\CBMainSectioning{section}}% +}{\providecommand\CBMainSectioning{chapter}}% + \ifx\cb@sub@input\@input@ % For [duplicate] \def\cb@dofinalbibs{\if@filesw @@ -231,11 +218,12 @@ \ifx\cb@biblist\@empty % duplicate or gather declared \providecommand\StartFinalBibs{\def\bibname{\@auto@bibname}}% - \def\cb@dobiblio#1{\begingroup\makeatletter + \def\cb@dobiblio#1{% defined to save local context for later "dofinalbibs" + \begingroup\makeatletter \ifx\the@ipfilectr\@empty % in root \StartFinalBibs \cb@dofinalbibs - \else % in chapter, or section - \let\cb@elt\relax % list \cb@elt{title}{input#}{file} + \else % in chapter, or section; append to \cb@biblist + \let\cb@elt\relax % list \cb@elt{title}{input#}{file}{citeprefix} \let\@ifchapapp\@secondoftwo % provide a *possible* title \expandafter\ifx\csname the\CBMainSectioning\endcsname\thechapter \@ifundefined{@chapapp}{}{\let\@ifchapapp\@firstoftwo}\fi @@ -243,25 +231,31 @@ {\FinalBibPrefix \@ifchapapp{\@chapapp}{\csname the\CBMainSectioning\endcsname}\space \csname the\CBMainSectioning\endcsname}}{}% - \protected@xdef\cb@biblist{\cb@biblist - \cb@elt{\FinalBibTitles}{\the\c@inputfile}{\@currentipfile}}% + \protected@xdef\cb@biblist{\cb@biblist\cb@elt + {\FinalBibTitles}{\the\c@inputfile}{\@currentipfile}{\@CitationPrefix}}% \cb@sub@input{#1}% - \fi\endgroup} - \def\cb@dogatherbib#1#2#3{% Title, count, fname + \fi\endgroup}% end \cb@dobiblio + \def\cb@dogatherbib#1#2#3#4{% Title, count, fname, prefix + \begingroup \protected@edef\@auto@bibname{#1}% + \def\@CitationPrefix{#4}% + \ifx\@CitationPrefix\@empty\else \@cb@insertprefix \fi \global\c@inputfile#2\global\advance\c@inputfile\m@ne - \IfFileExists{#3.bbl}{\cb@input{#3.bbl}}{}} + \IfFileExists{#3.bbl}{\cb@input{#3.bbl}}{}% + \endgroup} \fi \AtBeginDocument{\let\sectionbib\undefined} -} + \endinput %====================== BEGIN INSTRUCTIONS =========================== chapterbib.sty Version - ~~~~~~~~~~~~~~ 1.14 (31-MAR-2009) DA (\nocite*, \CitationPrefix, etc) + ~~~~~~~~~~~~~~ 1.16 (05-SEP-2010) DA \CitationPrefix with [gather], drop 2.09 + 1.15 (30-JUL-2009) DA (typo \CitationPrefix) + 1.14 (31-MAR-2009) DA (\nocite*, \CitationPrefix, etc) 1.13 (11-DEC-2007) DA (new final-bib titling) 1.12 (21-MAR-2004) DA 1.11 (29-FEB-2004) DA (allow \nocite check) @@ -289,7 +283,8 @@ to allow multiple bibliographies without using \include (see item 4). There are two added hooks, \citeform and \citepunct, which you can redefine to customise the formatting of each entry in a citation list, - and the declaration \CitationPrefix to use in preference to \citeform. + and the declaration \CitationPrefix to use in preference to \citeform + for numbering-by-chapter. Usage, Restrictions, and Options ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -320,15 +315,18 @@ "@\@citeb" to "@\@citeb\@extra@b@citeb", and insert the line \@ifundefined{@extra@b@citeb}{\def\@extra@b@citeb{}}{} somewhere (but not as a comment or as part of another definition!). + If the package also redefines \bibcite then you should change that definition, replacing "@#1" with "@#1\@extra@binfo", and insert \gdef\@extra@binfo{} - somewhere in the file. - Some citation packages deviate quite far from LaTeX's own method of - organizing cite tags using "b@\@citeb". The instructions above catch - such extensions as "Y@\@citeb", but not more radical differences. + somewhere in the file. If the package defines a command that acts + similarly to \bibcite (being written to the aux file), then it should + have "\@extra@binfo" inserted the same way. + Some citation packages deviate quite far from LaTeX's own method + of organizing cite tags using "b@\@citeb". The instructions above + catch such extensions as "Y@\@citeb", but not more radical differences. In such cases, try contacting the author of the citation package. - If a citation style does not define "\nocite", then that command + If a citation style does not define "\nocite", then that command would not be converted when you make the patches to "@\@citeb". Chapterbib will try to detect the hook in "\nocite", but if this fails you may need to redefine "\nocite" (with any "@\@citeb" changed to @@ -407,7 +405,7 @@ \newcommand\CBMainSectioning{motif} 9. To have bibliographies in each chapter PLUS a bibliography-by-chapter at - the end, follow item 9, but declare \usepackage[duplicate]{chapterbib} + the end, follow item 8, but declare \usepackage[duplicate]{chapterbib} (or \usepackage[duplicate,sectionbib]{chapterbib}). 10. If you use Babel, load chapterbib before babel. @@ -430,7 +428,9 @@ \CitationPrefix{\thechapter.} in the preamble. The prefix will be applied to all the chapter-bibs but will not be used in an overall (root) bibliography, if you have one. - + (The \CitationPrefix mechanism is likely to break often if it conflicts + with other packages.) + \citepunct gives the punctuation (comma-penalty-space) between items in the \cite list. @@ -515,13 +515,17 @@ % a chapter-identifier on each cite. It locally redefines both % \@bibitem and \@lbibitem at each \bibliography. The insertion % of the prefix is straightforward for \@lbibitem, but for \@bibitem -% the prefix is inserted by a redefined \value macro (eeek!). +% the prefix is inserted by a redefined \value macro (eeek!). It has +% a deficiency in not being sorted as a simple number by cite.sty. % %--------------------------------------------------------------- % % Authors Niel Kempson (original) -% ~~~~~~~ Donald Arseneau <asnd@triumf.ca> March 1993 - Mar 2009 +% ~~~~~~~ Donald Arseneau <asnd@triumf.ca> March 1993 - Sept 2010 % +% Changes with ver 1.16: Propagate prefix info to final bibs; +% drop support for ancient LaTeX versions +% Changes with ver 1.15: Fix typo \bibitemPrefix -> \CitationPrefix % Changes with ver 1.14: No warning from \nocite* in chapters, \CitationPrefix % Changes with ver 1.13: Rewrite final-bibs titling % Changes with ver 1.12: Update \@citex \bfseries @@ -529,9 +533,9 @@ % Changes with ver 1.10: \CBMainSectioning; \bibsection hook % Changes with ver 1.9: sectionbib remove \@mkboth % Changes with ver 1.8: options gather and duplicate; babel workarounds; toc -% Changes with ver 1.7: change the \sectionbib command re. headings. -% update \nocite and alter \citeform -% Changes with ver 1.6: change the \sectionbib command to take arguments. +% Changes with ver 1.7: Change the \sectionbib command re. headings. +% Update \nocite and alter \citeform +% Changes with ver 1.6: Change the \sectionbib command to take arguments. % Changes with ver 1.5: rootbib option; item 8 in instructions. % Changes with ver 1.4: sectionbib and draft options % Changes with ver 1.3: rewrite: |