Path: utzoo!attcan!uunet!samsung!uakari.primate.wisc.edu!crdgw1!montnaro From: montnaro@spyder.crd.ge.com (Skip Montanaro) Newsgroups: comp.text.tex Subject: Re: Request for thoughts on using BibTeX. Message-ID: Date: 9 Jul 90 18:14:19 GMT References: <009390BE.5D11CCA0@WIFFIN.CHEM.UCLA.EDU> Sender: news@crdgw1.crd.ge.com Reply-To: montanaro@crdgw1.ge.com (Skip Montanaro) Organization: GE Corporate Research & Development, Schenectady, NY Lines: 141 In-reply-to: james@abby.chem.ucla.edu's message of 2 Jul 90 04:54:45 GMT 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)