12.4.2 Building a bibliography

Bibliography files contain a list of citations, like this:

@Book{vinci,
  author = {Vinci, Albert C.},
  title = {Fundamentals of Traditional Music Notation},
  publisher = {Kent State University Press},
  year = {1989}
}

There are a variety of types of citation (e.g. Book (as above), article, publication). Each cited publication has a list of entries that can be used to identify the publication. Bibliograpies are normally stored as files with a .bib extension. One part of the doc-build process is transforming the bibliography information into texinfo files. The commands to do this are in the ‘GNUmakefile’ in the ‘Documentation’ directory.

A typical line of the makefile to translate a single bibliography is:

$(outdir)/colorado.itexi:
        BSTINPUTS=$(src-dir)/essay $(buildscript-dir)/bib2texi \
                -s $(top-src-dir)/Documentation/lily-bib \
                -o $(outdir)/colorado.itexi \
                $(src-dir)/essay/colorado.bib

Line by line:

$(outdir)/colorado.itexi:

We’re making the file ‘colorado.itexi’ and so this is the make instruction.

        BSTINPUTS=$(src-dir)/essay $(buildscript-dir)/bib2texi \

It’s in the ‘essay’ directory and we want to run the bib2texi.py script against it.

                -s $(top-src-dir)/Documentation/lily-bib \

The style template is ‘lily-bib.bst’ and is found in the ‘Documentation’ directory.

                -o $(outdir)/colorado.itexi \

The output file in ‘colorado.itexi’.

                $(src-dir)/essay/colorado.bib

The input file is ‘colorado.bib’ in the ‘essay’ directory.

The bib2texi Python script used to be used with a variety of options, but now is always called using the same options, as above. Its job is to create the file containing the options for bibtex (the program that actually does the translation), run bibtex, and then clean up some temporary files. Its main "value add" is the creation of the options file, using this code:

open (tmpfile + '.aux', 'w').write (r'''
\relax
\citation{*}
\bibstyle{%(style)s}
\bibdata{%(files)s}''' % vars ())

The key items are the style file (now always lily-bib for us) and the input file.

The style file is written in its own specialised language, described to some extent at

http://amath.colorado.edu/documentation/LaTeX/reference/faq/bibtex.pdf

The file ‘lily-bib.bst’ also has fairly extensive commenting.


LilyPond — Contributor’s Guide v2.21.0 (development-branch).