[comp.text.tex] Request for thoughts on using BibTeX.

james@abby.chem.ucla.edu (James Wilkinson) (07/02/90)

    I have decided that it is time for our research group to centralize its
bibliography information.  Since many of you already use large databases of
bibliographies, I thought I'd ask how you do it.

    I want to store both the bibliography specification and a short review of
the reference in a way that is compatible with TeX.  First, there is a question
of how one goes about labelling each reference in an intuitive and unambiguous
manner.  Our references frequently include entries with the same authors
publishing in the same journal in the same year or volume, so a simple scheme
which relies on only these three items isn't enough.

    I would like to use BibTeX to handle referencing from a LaTeX document.
However, it seems difficult to make a reliable algorithm for associating a
label with a given reference that is both intuitive and unique.  What I mean
by "intuitive" is that someone could say "I want to reference the article by
Joe Blow in the 1967 Journal of Irreconcilable Differences, page 555.  So I'll
place a \cite{label} in my LaTeX document and see if somebody has already
entered it." where the label is some obvious string.

    Additionally, I would like people to be able to look up any review
associated with the reference.  When I read a paper, I would like to enter both
the bibliography specification and a review of that paper.  Then I would like
to be able to do something like \review{label} to print out the review of the
reference.

    I could do all this with a simple database, but I want everything to be
compatible with LaTeX.  How do you have LaTeX and your bibliography database
interact?  Any suggestions or pointers appreciated.

JaW

ps. Has anyone written a general makefile for use with BibTeX and LaTeX?  For
instance, if you add a reference to your LaTeX file, you need to re-BibTeX the
.bib file, and LaTeX the .tex file twice.  If you change your .bib file, you
must do the same thing.  If you change the .tex file without changing any
referencing information, you probably only need to LaTeX the .tex file once.

James Wilkinson                            Phone: 1-213-206-5104
Department of Chemistry and Biochemistry     FAX: 1-213-206-5381
University of California, Los Angeles     BITNET: JAMES@UCLACH
405 Hilgard Avenue                      Internet: JAMES@ABBY.CHEM.UCLA.EDU
Los Angeles, California  90024-1569         SPAN: ABBY::JAMES or 5882::JAMES

pcg@cs.aber.ac.uk (Piercarlo Grandi) (07/04/90)

In article <009390BE.5D11CCA0@WIFFIN.CHEM.UCLA.EDU>
james@abby.chem.ucla.edu (James Wilkinson) writes:

       I have decided that it is time for our research group to centralize its
   bibliography information.  Since many of you already use large databases of
   bibliographies, I thought I'd ask how you do it.

       I could do all this with a simple database, but I want everything to be
   compatible with LaTeX.  How do you have LaTeX and your bibliography database
   interact?  Any suggestions or pointers appreciated.

The best technology is IMNHO to use tib. It uses refer format, which
vastly more readable and space saving than bibtex, is quite a bit
smaller, and has a standalone interrogation utility, just like refer.
BibTeX is a monstrosity compared to bib/tib/refer, even more so than TeX
compared to troff/scribe.
--
Piercarlo "Peter" Grandi           | ARPA: pcg%cs.aber.ac.uk@nsfnet-relay.ac.uk
Dept of CS, UCW Aberystwyth        | UUCP: ...!mcsun!ukc!aber-cs!pcg
Penglais, Aberystwyth SY23 3BZ, UK | INET: pcg@cs.aber.ac.uk

montnaro@spyder.crd.ge.com (Skip Montanaro) (07/10/90)

In article <009390BE.5D11CCA0@WIFFIN.CHEM.UCLA.EDU> james@abby.chem.ucla.edu
(James Wilkinson) writes: 

       I would like to use BibTeX to handle referencing from a LaTeX document.
   However, it seems difficult to make a reliable algorithm for associating a
   label with a given reference that is both intuitive and unique.  What I mean
   by "intuitive" is that someone could say "I want to reference the article by
   Joe Blow in the 1967 Journal of Irreconcilable Differences, page 555.  So I'll
   place a \cite{label} in my LaTeX document and see if somebody has already
   entered it." where the label is some obvious string.

I have a Refer-to-BibTeX program in Emacs Lisp (written by Henry Kautz) that
generates bibtex handles of the format "%a%y%t", where "%a" is the first
author's last name, "%y" is the year (last two digits), and "%t" is the
first "interesting" word of the title. For instance, two citations from one
bib file I have that it generated are:

	@misc( Jansen86Amoeba, 
	  author =	{Jack Jansen}, 
	  title =	{Amoeba Process Server Documentation (Kernel Part)}, 
	  year =	1986, 
	  month =	oct, 
	  keywords =	{amoeba process server kernel} )

	@techreport( Baalbergen86Overview, 
	  author =	{Erik H. Baalbergen}, 
	  title =	{An Overview of the Amoeba Connection}, 
	  year =	1986, 
	  month =	sep, 
	  number =	{paper}, 
	  type =	{internal}, 
	  institution =	{Dept. of Mathematics and Computer Science, Vrije Universiteit}, 
	  address =	{Amsterdam}, 
	  keywords =	{amoeba network} )

Note that in the second entry, the first interesting word in the title is
"Overview". 

You're bound to get some clashes, but there should be relatively few. Out of
2313 references spread over 38 files in my bibliography directory, one
handle of that format occurs 8 times (Hennessy81Mips). I've made no attempt
to merge my various bib files, most of which I picked up from comp.arch, so
I suspect those eight handles reference the same article. No other occurs
more than four times, due, I suspect, to multiple cites of the same article.

   ps. Has anyone written a general makefile for use with BibTeX and LaTeX?
   For instance, if you add a reference to your LaTeX file, you need to
   re-BibTeX the .bib file, and LaTeX the .tex file twice.  If you change
   your .bib file, you must do the same thing.  If you change the .tex file
   without changing any referencing information, you probably only need to
   LaTeX the .tex file once.

Here is a makefile I use. I got the techniques for conditionally changing
intermediate files from the GNU C makefiles. The move-if-change script from
the GNU C distribution follows the makefile.

    all : .INIT design.dvi

    clean : design-clean rexpr-clean
	    sccs clean

    # Don't rm these files if we interrupt the Make while they are the active
    # target
    .PRECIOUS : labels.changed citations.changed

    .INIT : move-if-change article.sty
	    @chmod +x move-if-change
	    @if [ ! -r labels.changed ] ; then \
		touch labels.changed ; \
		touch stamp-labels.changed ; \
	    fi
	    @if [ ! -r citations.changed ] ; then \
		touch citations.changed ; \
		touch stamp-citations.changed ; \
	    fi
	    @if [ ! -r design.aux ] ; then \
		touch design.aux ; \
	    fi
	    @if [ ! -r design.log ] ; then \
		touch design.log ; \
	    fi

    # All the things that go into creating a .dvi file
    design.dvi : design.tex design.bbl adduser.epic top-level.epic \
		 derived-reqts.epic labels.changed
	    latex design.tex

    # This neat trick was taken from GNU CC Makefile
    # labels.changed is only modified (forcing remake of design.dvi) if LaTeX
    # thinks the labels changed.
    labels.changed : stamp-labels.changed  ;
    stamp-labels.changed : design.log
	    @-egrep "LaTeX Warning:.*Label.*changed" design.log > tmp-labels.changed
	    @if [ -s tmp-labels.changed ] ; then mv tmp-labels.changed labels.changed ; fi
	    @touch stamp-labels.changed

    # citations.changed is only modified if it appears any new citations were
    # added or old ones removed. The egrep is only a first approximation, but
    # works okay in practice. Any line in design.aux that isn't a \@writefile
    # is assumed to have some affect on bibtex
    citations.changed : stamp-citations.changed ;
    stamp-citations.changed : design.aux
	    @-egrep -v "@writefile" design.aux | sort -u > tmp-citations.changed
	    @-./move-if-change tmp-citations.changed citations.changed
	    @touch stamp-citations.changed

    # TeX output of bibtex
    design.bbl : lead.bib citations.changed
	    -bibtex design

    design-clean :
	    -rm -f *.lot *.lof *.aux *.dvi *.log *.toc *.bbl *.blg *.ps tmp-* \
		    *.changed

    # This converts xfig output to eepic macros for TeX.
    %.epic : %.fig
	    fig2epic < $*.fig > $*.epic

    # This version of dvips understands the tpic specials generated by eepic
    %.ps : %.dvi
	    ${HOME}/src/latex/Dvips/dvips -f < $*.dvi > $*.ps

move-if-change:

if
test -r $2
then
if
cmp $1 $2 > /dev/null
then
rm $1
else
mv $1 $2
fi
else
mv $1 $2
fi


--
Skip (montanaro@crdgw1.ge.com)