[comp.text.tex] Sectioned Bibliography in addition to References

sm10+@andrew.cmu.edu (Steven Meyer) (12/16/90)

I have a question about creating two sections of \bibitems. Is there a
*.bst that could do this (doubtful) or some other mechanism? Any
suggestions?  I'd like to have both a References section (formed from
the \cite commands in the text) plus a Bibliography section (formed
from the \nocite command or some other way) at the end of my text. The
references would be a normal \bibstyle{alpha} collection of texts used
as references within my text. The sectioned bibliography would include
texts used for basic information but which weren't actually referenced
by my text.  Additionally, I need the bibliography to be sectioned by
subject matter because it would include texts on vastly different
subjects. The bibliography could be an appendix before the actual
references, it could be formed from a \nocite{*} command in a dummy
file, I'm not picky! Does anyone have a .bst for this or some other
technique. I'd think this would be FABS (Frequently Asked-for Bib
Style).

An example of the bibliography is:

BIBLIOGRAPHY

Engineering Mechanics

[Timoshenko 52] First engineering mechanics text bibitem

[Timoshenko 54] Second engineering mechanics text bibitem
.
.
.

Linguistics

[Chomsky 56] First linguistics text bibitem

[Chomsky 64] Second linguistics text bibitem
.
.
.

Computer Graphics

[Requicha 80] First graphics text bibitem

[Requicha 81] Second graphics text bibitem
.
.
.
etc.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Thanx
Steve
sm10@viaont.ce.cmu.edu

alberto@cs.umd.edu (Jose Alberto Fernandez R) (12/18/90)

In article <0bOhFgm00WB34HVFZX@andrew.cmu.edu> sm10+@andrew.cmu.edu (Steven Meyer) writes:

   From: sm10+@andrew.cmu.edu (Steven Meyer)
   Newsgroups: comp.text.tex
   Date: 16 Dec 90 01:57:00 GMT
   Organization: Civil Engineering, Carnegie Mellon, Pittsburgh, PA


   I have a question about creating two sections of \bibitems. Is there a
   *.bst that could do this (doubtful) or some other mechanism? Any
   suggestions?  I'd like to have both a References section (formed from
   the \cite commands in the text) plus a Bibliography section (formed
   from the \nocite command or some other way) at the end of my text. The
   references would be a normal \bibstyle{alpha} collection of texts used
   as references within my text. 

   Thanx
   Steve
   sm10@viaont.ce.cmu.edu

I wrote the bibunits style to something similar to what you have. The
style allows you to specify references by sections or chapters or to
define a bibunit environment with its own separate references. Also is
possible to specify if a citation in a bibunit must be included in the
general bibliografy or not.

The only problem with this style is that the message of rerun to get
cross-references right ALWAYS appears. ANY IDEA OF HOW TO CORRECT
THIS?

	Jose Alberto.

--------8<------CUT HERE-----8<---------
%% 
%% BIBUNITS.STY     by Jose Alberto Fernandez (alberto@cs.umd.edu)
%% 
%% BIBUNITS is a style to generate separate bibliographies for
%% different units (parts) of the text (currently only one of
%% chapters, sections or bibunit-environments). 
%% The style will separate the citations of each unit of text into a
%% separate file to be processed by bibtex. The global bibliography
%% section produced by LATEX also can appear in the document and
%% citations can be placed in both at the same time.
%% 
%% Use the \bibliographyunit[<unit>] (<unit> = \chapter, \section) to
%% select how the references will be generated. (For every chapter or
%% for every section). Use \bibliographyunit with no arguments to
%% deactivate bibliographyunits. By default citations will only appear
%% in the local bibliography. WARNING: By default \bibliographyunit is
%% in a deactivated state.
%% 
%% If \bibliographyunit is active the \bibliography{bibtex-files} and
%% \bibliographystyle{style} commands also specify the bibtex-files
%% and style to be used by default in the local units. The commands
%% \bibliography*{<bibtex-files>} and \bibliographystyle*{<style>}
%% specify the defaults for BIBUNITS and not generate any information
%% for the global bibliography. WARNING: This values are taken as
%% defaults only when executed after activate \bibliographyunit
%% 
%% The environment \begin{bibunit}[<style>] .. \end{bibunit} allows
%% the creation of a unit while \bibliographyunit is not active. The
%% optional parameter <style> specifies a style for the biblography
%% different from the default if any. WARNING: The use of this
%% environment while \bibliographyunit is active can produce extrange
%% results. Note that default style and bibtex-files only exist if
%% specified while \bibliographyunit was active.
%% 
%% Use \cite and \nocite to generate citations. \cite* and \nocite*
%% can be use to generate citations to be added in both the local and
%% global bibliography while inside a unit.
%%
%% You must insert the command \putbib[<bibtex-files>] before the end
%% of each <unit> in the location where you want the bibliography to
%% be inserted. If the optional argument is ommited, \putbib uses the
%% default bibtex-files if any.
%% 
%% BIBTEX processing:
%% For each <unit>, in sequence, there is now a corresponding file 
%% \jobname.\the\@bibunitauxcnt.aux that need to be compiled though
%% BIBTEX as well as the \jobname.aux that generates the global
%% database. 
%% 
%% Suppose your document is foo.tex, you must now invoke bibtex not only
%% on foo, but also on foo.1, ..., foo.n given that there are n
%% different <units> with separate bibliography.

\newwrite\@bibunitaux                                %File desc.
\newcount\@bibunitauxcnt \@bibunitauxcnt = 0         %Units cnt.
\newif\if@localcite                                  %Local/Global cite
\def\@localcitedflt{\@localcitetrue} \@localcitedflt
% 
% \cite definition
%
\let\REALcite\cite
\def\NEWcite{
  \@ifstar{\@localcitefalse\REALcite}
    {\@localcitetrue\REALcite}}
%
% \@cite new definition
\let\REAL@citex\@citex
\def\NEW@citex[#1]#2{\if@filesw
  \immediate\write\@bibunitaux{\string\citation{#2}}\fi
  \if@localcite
    \if@filesw
      \@fileswfalse\REAL@citex[#1]{#2}\@fileswtrue
    \else\REAL@citex[#1]{#2}\fi 
  \else\REAL@citex[#1]{#2}\fi
  \@localcitedflt}
%
% \nocite definition
% 
\let\REALnocite\nocite
\def\NEWnocite{
  \@ifstar{\@localcitefalse\@NEWnocite}
    {\@localcitetrue\@NEWnocite}}
\def\@NEWnocite#1{\@bsphack
  \if@filesw
    \immediate\write\@bibunitaux{\string\citation{#1}}\fi
  \@esphack
  \if@localcite\else\REALnocite{#1}\fi\@localcitedflt}
%
% \bibliography definition
% 
\def\@bibdata{}                              %Data files store
\let\REALbibliography\bibliography
\def\NEWbibliography{
  \@ifstar{\@localcitetrue\@NEWbibliography}
    {\@localcitefalse\@NEWbibliography}}
\def\@NEWbibliography#1{
  \if@filesw
    \immediate\write\@auxout{\string\gdef\string\@bibdata{#1}}\fi
  \if@localcite\else\REALbibliography{#1}\fi\@localcitedflt}
%
% \bibliographystyle definition
%
\def\@bibstyle{}                              %Style store
\let\REALbibliographystyle\bibliographystyle
\def\NEWbibliographystyle{
  \@ifstar{\@localcitetrue\@NEWbibliographystyle}
    {\@localcitefalse\@NEWbibliographystyle}}
\def\@NEWbibliographystyle#1{
  \if@filesw
    \immediate\write\@auxout{\string\gdef\string\@bibstyle{#1}}\fi
  \if@localcite\else\REALbibliographystyle{#1}\fi\@localcitedflt}
%
% \begin{bibunit} .. \end{bibunit} definition
% 
\def\bibunit{\advance\@bibunitauxcnt 1
  \global\let\cite\NEWcite
  \global\let\@citex\NEW@citex
  \global\let\nocite\NEWnocite
  \if@filesw
    \immediate\openout\@bibunitaux \jobname.\the\@bibunitauxcnt.aux
  \fi\@ifnextchar[{\@bibunitx}{\@bibunitx[\@bibstyle]}
}
\def\@bibunitx[#1]{\if@filesw
  \immediate\write\@bibunitaux{\string\bibstyle{#1}}\fi}
\def\endbibunit{
  \global\let\cite\REALcite
  \global\let\@citex\REAL@citex
  \global\let\nocite\REALnocite
  \if@filesw
    \immediate\closeout\@bibunitaux\fi}
%
% \chapter or \section substituting definition
%
\let\OLD@bibunit\@gobble
\def\@bibunit{\endbibunit\bibunit\OLD@bibunit}
\def\@endbibunit{}
%
% \bibliographyunit definition
% 
\def\bibliographyunit{\@endbibunit
  \@ifnextchar[{\@bibliographyunit}{
    \global\let\OLD@bibunit\@gobble
    \global\let\bibliography\REALbibliography
    \global\let\bibliographystyle\REALbibliographystyle
    \endbibunit
    \gdef\@endbibunit{}}}
\def\@bibliographyunit[#1]{
  \global\let\bibliography\NEWbibliography
  \global\let\bibliographystyle\NEWbibliographystyle
  \global\let\OLD@bibunit#1
  \global\let#1\@bibunit
  \gdef\@endbibunit{\global\let#1\OLD@bibunit}}
%
% \putbib definition
% 
\def\putbib{\@ifnextchar[{\@putbib}{\@putbib[\@bibdata]}}
\def\@putbib[#1]{\if@filesw
  \immediate\write\@bibunitaux{\string\bibdata{#1}}\fi
  \@input{\jobname.\the\@bibunitauxcnt.bbl}}

%% END OF BIBUNITS.STY 
--
:/       \ Jose Alberto Fernandez R | INTERNET: alberto@cs.umd.edu
:| o   o | Dept. of Computer Sc.    | BITNET: alberto@cs.umd.edu
:|   ^   | University of Maryland   | UUCP: {...}!mimsy!alberto
:\  \_/  / College Park, MD 20742   | 

alberto@cs.umd.edu (Jose Alberto Fernandez R) (12/19/90)

Sorry folks but multibibliography style that I sent yesterday has a
bug. I send the wrong version. The correction is very simple,
change the line:

\def\bibunit{\advance\@bibunitauxcnt 1

to

\def\bibunit{\global\advance\@bibunitauxcnt 1


Thanks

	
	Jose Alberto.

--
:/       \ Jose Alberto Fernandez R | INTERNET: alberto@cs.umd.edu
:| o   o | Dept. of Computer Sc.    | BITNET: alberto@cs.umd.edu
:|   ^   | University of Maryland   | UUCP: {...}!mimsy!alberto
:\  \_/  / College Park, MD 20742   |