6. Skribilo User Manual — Bibliographies
Contents↑ Skribilo User Manual

Skribilo provides support for bibliographies. To setup a bibliography database and to be able to refer to its entries from a document, the following things must be done:

The following sections will guide you through these steps.

6.1 Bibliography Tables

This section describes functions dealing with bibliography tables. Essentially, bibliography tables are the representation of your bibliographies used by Skribilo at run-time.

The predicate bib-table? returns #t if and only if its argument is a bibliography table as returned by make-bib-table or *bib-table*. Otherwise bib-table? returns #f.

(bib-table? obj)
obj The value to be tested

The function *bib-table* returns a global, pre-existing bibliography-table:

Technically, *bib-table* is actually an SRFI-39 parameter object, so it can be queried and modified like any other parameter object.

The function make-bib-table constructs a new bibliography-table:

(make-bib-table ident)
ident The name of the bibliography table.

6.2 Bibliography

The bibliography function loads bibliography entries into the bibliography table specified using the :bib-table parameter. It can be passed either lists representing entries (such as an article or book reference), or strings denoting the names of files that contains several entries. All the entries loaded in memory can then be referred to with ref. A bibliography database must be loaded before any reference is introduced. It is advised to place the bibliography function call before the call to the document function call.

(bibliography [:bib-table (*bib-table*)] [:command] entry...)
:command An external command to be applied when loading the bibliography entries. The sequence ~a is replaced with the name of the file when the command is invoked. html lout latex context info xml
:bib-table The table where entry is searched. html lout latex context info xml
entry... If entry is a string, it denotes a file containing the entry (see bibliograph path). Otherwise, it is a list described by the syntax below.

Files passed as an argument to bibliography are searched in the current bibliography path, which is defined by the *bib-path* SRFI-39 parameter. This parameter contains a list of directories and its value can be obtained using (*bib-path*). Its value can be altered using the -B command-line option of the skribilo compiler (see Chapter 14 for details).

The :command option can be used to import foreign bibliography. The following example, shows how to directly use a BibTeX bibliography using the Skribebibtex translator.

Ex. 27: Printing a Bibliography

6.2.1 Bibliography Syntax

The Skribe/Skribilo bibliography database uses a format very close to the BibTeX one, which is a parenthetic version of BibTeX. Here is the syntax of an entry:

<entry>  -->  (<kind> <key> <field>+)
<kind>   -->  techreport | article | inproceedings | book
<key>    -->  <symbol> | <string>
<field>  -->  (<symbol> <string>)

BibTeX files cannot be directly loaded but the tool skribebibtex can be use to automatically convert BibTeX format to Skribe bibliography format. Here is an example of a simple Skribe database.

6.3 Printing a Bibliography

The function the-bibliography displays the bibliography.

(the-bibliography :pred [:labels 'number] [:count 'partial] [:sort bib-sort/authors] [:bib-table (*bib-table*)])
:bib-table The bibliography table to be displayed. html lout latex context info xml
:pred A predicate filtering the bibliography entries. It takes two parameters: the bibliography entry and the the-bibliography node. html lout latex context info xml
:sort A function sorting a list of entries. html lout latex context info xml
:labels Specifies the style for bibliography entries labels. The default, number, uses numbers to identify references, e.g., "[7]". When name+year is chosen, long labels including the first author's last name (and optionally the second author's last name) and the year of publication will be used. For instance: "[Smith 1984]", "[Smith & Johnson 1979]", or "[Smith et al. 1980]". html lout latex context info xml
:count The symbol partial or full specifies the numbering to be applied. The value partial tells Skribilo to count only the entries filtered in by :pred. The value full tells Skribilo to count all entries, event those filtered out by :pred. html lout latex context info xml

Note that the name+year label style will only work if the following conventions are followed by the author field of your bibliography entries:

When using the name+year label style, it is sometimes desirable to preclude automatic abbreviations for some authors, e.g., when the author is the name of a consortium or company rather than that of a person. In that case, you should enclose the value of your author field in a noabbrev markup.

(noabbrev [:class] [:ident])
:ident The node identifier. html lout latex context info xml
:class The node class. html lout latex context info xml

The following example illustrates typical use of a bibliography.

Ex. 28: Printing a Bibliography

... produces:

Scheme [5] is functional programming language. It exists several books about this language [2, 3].

-- Bibliography --
[2]Christian Queinnec. Lisp In Small Pieces. Cambridge University Press, 1996.[3]Harold Abelson, Gerald Jay Sussman. Structure and Interpretation of Computer Programs. MIT Press, Cambridge, Mass., USA, 1985.[5]Richard Kelsey, William D. Clinger, Jonathan Rees. The Revised5 Report on the Algorithmic Language Scheme. In Higher-Order and Symbolic Computation, 11(1) , Sep 1998, .

Note that the current locale setting affects the language used in bibliography entries. For instance, if the LC_ALL environment variable is set to sv_SE.utf8, then phrases like ``Chapter'' or ``Technical Report'' will be written in Swedish.

6.3.1 Filtering Bibliography Entries

The :pred option is bound to a function of one argument that filters bibliography entries. It is used to control which entries must appears on a bibliography. The default behavior is to display only the entries referenced to in the text. For instance, in order to display all the entries of a bibliography, is it needed to print the bibliography with a predicate returning always #t.

Ex. 29: Unfiltering Bibliography Entries

... produces:

[1]IEEE Std 1178-1990. IEEE Standard for the Scheme Programming Language. Institute of Electrical and Electronic Engineers, Inc., New York, NY, 1991.[2]Christian Queinnec. Lisp In Small Pieces. Cambridge University Press, 1996.[3]Harold Abelson, Gerald Jay Sussman. Structure and Interpretation of Computer Programs. MIT Press, Cambridge, Mass., USA, 1985.[4]Manuel Serrano. http://www.inria.fr/mimosa/fp/Bigloo. 2006. http://www.inria.fr/mimosa/fp/Bigloo.[5]Richard Kelsey, William D. Clinger, Jonathan Rees. The Revised5 Report on the Algorithmic Language Scheme. In Higher-Order and Symbolic Computation, 11(1) , Sep 1998, .[6]William D. Clinger, Jonathan Rees. The Revised4 Report on the Algorithmic Language Scheme. Nov 1991. http://www.cs.indiana.edu/scheme-repository/R4RS/r4rs_toc.html.

The second example, filters out the entries that are not book or that are not referenced to from the document.

Ex. 30: Unfiltering Bibliography Entries

... produces:

[2]Christian Queinnec. Lisp In Small Pieces. Cambridge University Press, 1996.[3]Harold Abelson, Gerald Jay Sussman. Structure and Interpretation of Computer Programs. MIT Press, Cambridge, Mass., USA, 1985.

The last example, illustrates how to change the rendering of a bibliography. It uses the [?mark processor: skribilo/documentation/manual.scm:315:4:] construction and it defines two [?ident writer: ./bib.skb:252:21:] for displaying &bib-entry-ident and &bib-entry-title markups. These two markups are introduced by Skribe when it loads a bibliography. All fields of bibliography entries are represented by markups whose prefix are &bib-entry-. The parent of all these markups is the bibliography entry itself. The &bib-entry- markups are options of there parent.

Ex. 31: Unfiltering Bibliography Entries

... produces:

[IEEE STD 1178-1990:1991]IEEE Std 1178-1990. IEEE Standard for the Scheme Programming Language. Institute of Electrical and Electronic Engineers, Inc., New York, NY, 1991.[CHRISTIAN QUEINNEC:1996]Christian Queinnec. Lisp In Small Pieces. Cambridge University Press, 1996.[HAROLD ABELSON, GERALD JAY SUSSMAN:1985]Harold Abelson, Gerald Jay Sussman. Structure and Interpretation of Computer Programs. MIT Press, Cambridge, Mass., USA, 1985.

6.3.2 Sorting Bibliography Entries

The :sort option of the the-bibliography markup is used for sorting the bibliography entries. There are three pre-existing functions for sorting entries, defines in the (skribilo biblio) module (see Section 1.5).

(bib-sort/authors l)
(bib-sort/idents l)
(bib-sort/dates l)
l The list of entries.

The first function sorts the entries according to an alphabetic ordering on authors. The second sorts according to an alphabetic ordering on entries identifier. The last one sorts according to entries date.

Ex. 32: Sorting Bibliography Entries

In addition, the (skribilo biblio author) module exports a fourth procedure that sorts bibliography entries:

(bib-sort/first-author-last-name entries)
entries The list of entries.

This procedure allows entries to be sorted according to the last name of the first author of each bibliography entry. For this to work, the author field of bibliography entries must follow the same conventions as for the name+year label style of the-bibliography.

6.4 Skribebibtex

FIXME: This tool is not available as of Skribilo version 0.10.0.

(made with skribilo)