[comp.text.tex] Bibtex question

kochhar@calliope.harvard.EDU (Sandeep Kochhar) (05/26/90)

Given a set of *.bib files, how can I print out all the citations
contained therein?  (I think someone posted an answer a few months
back, but I missed it.)

Note: one not-so-elegant way would be for me to write a program
(in C or awk etc.) that extracted all the keys and put them in
a latex file as \cite{key1,key2....}. Then I could just use bibtex.

However, I'm interested in a latex solution.



Sandeep Kochhar
(617) 495-3988              mail: kochhar@harvard.harvard.edu
Harvard University                kochhar@harvard.csnet
33 Oxford st,                     kochhar@harvard.uucp
Cambridge, MA 02138               kochhar@harvard.bitnet

scheuche@pleiades.cps.msu.edu (Anton Scheucher) (05/26/90)

The following LaTeX file should print out all the references in
a 'bib.bib' file.

----------------------------------------------------------------
\documentstyle{article}
\begin{document}
\nocite{*}                   % takes all references !!!
\bibliography{bib}
\bibliographystyle{alpha}
\end{document}
----------------------------------------------------------------
----------------------------------------------------------------
Scheucher Anton, Dipl. Ing.
Michigan State University   
E312 Owen Hall              email: scheuche@pleiades.cps.msu.edu
East Lansing, MI 48825                     phone: (517) 355 4071
----------------------------------------------------------------

kochhar@harvard.harvard.EDU (Sandeep Kochhar) (04/20/91)

Hi!
Here's a (simple?) question for bibtex style-file hackers...

I was trying to develop a ".bst" style that would print out as label the 
citation key as used in the ".bib" file.
e.g. 

@ARTICLE{foobar, 
	...
	...
}

would produce the command

\bibitem[foobar]{foobar}
...


in the ".bbl" file.

Seemed fairly easy. The original alpha style had the function:

FUNCTION {output.bibitem}
{ newline$
  "\bibitem[" write$
  label write$
  "]{" write$
  cite$ write$
  "}" write$
  newline$
  ""
  before.all 'output.state :=
}

All I did was change the line "label write$" to "cite$ write$", getting:

FUNCTION {output.bibitem}
{ newline$
  "\bibitem[" write$
  cite$ write$
  "]{" write$
  cite$ write$
  "}" write$
  newline$
  ""
  before.all 'output.state :=
}

It worked fine, except for labels that had underscores.
These caused latex to choke...

e.g.

@ARTICLE{foo_bar, ....}

would produce
\bibitem[foo_bar]{foo_bar},
which upsets latex.

I can fix the ".bbl" file by hand to prefix all underscores by a backslash.
This pleases latex.

However, I'd like to automate this process.

Any ideas on how to write a function in bibtex (".bst") to convert
the underscores to "backslash-underscore"...
(note: purify$ doesn't work since it *removes* the underscore)

(Note: I'd heard that there was a keys.bst somewhere, but I can't locate
it.... Anyone know?)

Thanks

-- 

Sandeep Kochhar
Harvard University              email: kochhar@harvard.harvard.edu
33 Oxford st.                   tel:   (617) 495-3998            
Cambridge, MA 02138             fax:   (617) 495-9837