🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.text.tex
Article #10148

Re: Mutiple Bibliographies

#10148
From: Werenfried Spit
Date: Thu, 06 Jun 1991 15:27
81 lines
4301 bytes
In <OLIVER.91Jun5024515@hippocrates.mit.edu> oliver@athena.mit.edu (James D. Oliver III) writes:


>Is there a macro which will allow mutiple bibliographies in a single
>document, for example, having a report with a separate bibliography for
>each chapter?  Any pointers appreciated.

I wrote this one some time ago; I am not sure if
it is 100% proof (I remember there was a problem 
with referencing the same source in more than one
chapter)
Put in in the documentstyle

%%%%%%%%%%%%%%%%% bibliography %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Changes to put references after each chapter
% S.D. & W.S. (15-12-89)
%
% 1. defined mybibliography{bibdata-filename}{chapter-filename.bbl}
% 2. redefined \@bibitem with label consisting of chapter.biblabel
% 3. redefined \@citex to look for above-defined label, also in collapse part
% 4. redefined \thebibliography to define a new section instead of chapter

\def\mybibliography#1#2{\if@filesw\immediate\write\@auxout{\string
\bibdata{#1}}\fi\@input{#2.bbl}}

\def\@bibitem#1{\item\if@filesw \immediate\write\@auxout
       {\string\bibcite{\the\c@chapter.#1}{\the\c@bibcounter}}\fi\ignorespaces}

% Redefined in collapse, but can still be used
\def\@citex[#1]#2{\if@filesw\immediate\write\@auxout{\string\citation{#2}}\fi
  \def\@citea{}\@cite{\@for\@citeb:=#2\do
  {\def\@cbib
    {\the\c@chapter.\@citeb}\@citea\def\@citea{,\penalty\@m}\@ifundefined
    {b@\@cbib}{{\bf ?}\@warning
    {Citation `\@cbib' on page \thepage \space undefined}}%
  \hbox{\csname b@\@cbib\endcsname}}}{#1}}

\def\thebibname{References}
\def\thebibliography#1{\section*{\thebibname}
 \markboth{\thebibname}{\thebibname}
 \addcontentsline{toc}{section}{\protect\numberline{\null}\thebibname}
 \list{[\arabic{bibcounter}]}{\settowidth\labelwidth{[#1]} % evt \arabic{chapter}. ervoor
  \leftmargin\labelwidth \itemsep 0pt plus 1pt \parsep 0pt \usecounter{bibcounter}}
 \def\newblock{\hskip 0.5em plus 0.3em minus -0.05em}
 \small \sloppy \sfcode`\.=1000 \relax}
\let\endthebibliography=\endlist
        
% Collapse citation numbers to ranges.  Non-numeric and undefined labels
% are handled.  No sorting is done.  E.g., 1,3,2,3,4,5,foo,1,2,3,?,4,5
% gives 1,3,2-5,foo,1-3,?,4,5
% Here also \@cbib replaces \@citeb for references after each chapter

\newcount\@tempcntc
\def\@citex[#1]#2{\if@filesw\immediate\write\@auxout{\string\citation{#2}}\fi
  \@tempcnta\z@\@tempcntb\m@ne\def\@citea{}\@cite{\@for\@citeb:=#2\do
    {\def\@cbib{\the\c@chapter.\@citeb}\@ifundefined
      {b@\@cbib}{\@citeo\@tempcntb\m@ne\@citea\def\@citea{,}{\bf ?}\@warning
         {Citation `\@cbib' on page \thepage \space undefined}}%
       {\setbox\z@\hbox{\global\@tempcntc0\csname b@\@cbib\endcsname\relax}%
\ifnum\@tempcntc=\z@ \@citeo\@tempcntb\m@ne\@citea\def\@citea{,}\hbox{\csname b@\@cbib\endcsname}%
     \else
      \advance\@tempcntb\@ne
      \ifnum\@tempcntb=\@tempcntc
      \else\advance\@tempcntb\m@ne\@citeo
      \@tempcnta\@tempcntc\@tempcntb\@tempcntc\fi\fi}}\@citeo}{#1}}
\def\@citeo{\ifnum\@tempcnta>\@tempcntb\else\@citea\def\@citea{,}%
  \ifnum\@tempcnta=\@tempcntb\the\@tempcnta\else
   {\advance\@tempcnta\@ne\ifnum\@tempcnta=\@tempcntb \else \def\@citea{--}\fi
    \advance\@tempcnta\m@ne\the\@tempcnta\@citea\the\@tempcntb}\fi\fi}

\newif\if@restonecol
\def\theindex{\@restonecoltrue\if@twocolumn\@restonecolfalse\fi
\columnseprule \z@
\columnsep 35pt\twocolumn[\@makeschapterhead{Index}]
 \@mkboth{Index}{Index}\thispagestyle{plain}\parindent\z@
 \parskip\z@ plus .3pt\relax\let\item\@idxitem}
\def\@idxitem{\par\hangindent 40pt}
\def\subitem{\par\hangindent 40pt \hspace*{20pt}}
\def\subsubitem{\par\hangindent 40pt \hspace*{30pt}}
\def\endtheindex{\if@restonecol\onecolumn\else\clearpage\fi}
\def\indexspace{\par \vskip 10pt plus 5pt minus 3pt\relax}
Technical Details
Message-ID: <1991Jun6.152758.1435@fys.ruu.nl>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!wuarchive!uunet!mcsun!hp4nl!alchemy!ruunfs!spit
References: <OLIVER.91Jun5024515@hippocrates.mit.edu>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!wuarchive!uunet!mcsun!hp4nl!alchemy!ruunfs!spit
From: spit@fys.ruu.nl (Werenfried Spit)
Newsgroups: comp.text.tex
Subject: Re: Mutiple Bibliographies
Message-ID: <1991Jun6.152758.1435@fys.ruu.nl>
Date: 6 Jun 91 15:27:58 GMT
References: <OLIVER.91Jun5024515@hippocrates.mit.edu>
Organization: Physics Department, University of Utrecht
Lines: 81