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:
bibliography
function.
ref
:bib
function calls.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:
(
*bib-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.
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...
)
~a
is replaced
with the name of the file when the command is invoked.
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 BibliographyThe 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.
(book queinnec:lisp ( author "Christian Queinnec" ) (title "Lisp In Small Pieces" ) (publisher "Cambridge University Press" ) (year "1996" )) (book scheme:ieee (title "IEEE Standard for the Scheme Programming Language" ) ( author (noabbrev "IEEE Std 1178-1990" )) (publisher "Institute of Electrical and Electronic Engineers, Inc." ) (address "New York, NY" ) (year "1991" )) (misc bigloo ( author "Manuel Serrano" ) (year "2006" ) (url "http://www.inria.fr/mimosa/fp/Bigloo" )) (misc scheme:r4rs (title [ The Revised,( sup [ 4 ] ) Report on the Algorithmic Language Scheme ] ) ( author "William D. Clinger, Jonathan Rees" ) (month "Nov" ) (year "1991" ) (url "http://www.cs.indiana.edu/scheme-repository/R4RS/r4rs_toc.html" )) (article scheme:r5rs (title "The Revised5 Report on the Algorithmic Language Scheme" ) ( author "Richard Kelsey, William D. Clinger, Jonathan Rees" ) (journal "Higher-Order and Symbolic Computation" ) (volume "11" ) (number "1" ) (month "Sep" ) (year "1998" ) (url "http://kaolin.unice.fr/Bigloo/doc/r5rs.html" )) (book as:sicp ( author "Harold Abelson, Gerald Jay Sussman" ) (title "Structure and Interpretation of Computer Programs" ) (year "1985" ) (publisher "MIT Press" ) (address "Cambridge, Mass., USA" ))
The function
the-bibliography
displays the bibliography.
(
the-bibliography
:pred
[
:labels
'number
] [
:count
'partial
] [
:sort
bib-sort/authors
] [
:bib-table
(*bib-table*)
]
)
the-bibliography
node.
html
lout
latex
context
info
xml
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
Note that the
name+year
label style will only work if the
following conventions are followed by the
author
field of your
bibliography entries:
author
fields of bibliographic entries should
be a string containing a comma-separated list of full author names;
first-name second-name ... last-name
.
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
]
)
the-bibliography
,
bib-sort/first-author-last-name
.The following example illustrates typical use of a bibliography.
Ex. 28: Printing a Bibliography... 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. | [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.
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
.
... 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:
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.
( center (frame :border 1 :margin 2 :width 90. ( processor :engine (make-engine '_ :filter string-upcase) :combinator ( lambda (e1 e2) ( let ((e (copy-engine '_ e2))) (markup-writer '&bib-entry-ident e :action ( lambda (n e) ( let* ((be (ast-parent n)) (o (markup-option be 'author)) (y (markup-option be 'year))) (output (markup-body o) e1) (display ":" ) (output (markup-body y) e)))) (markup-writer '&bib-entry-title e :action ( lambda (n e) (evaluate-document ( it (markup-body n)) e))) e)) (the-bibliography :pred ( lambda (m n) (eq? (markup-option m 'kind) 'book))))))
... 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. |
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.
bib-sort/first-author-last-name
.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
.
FIXME: This tool is not available as of Skribilo version UNKNOWN.