aboutsummaryrefslogtreecommitdiff
path: root/doc/user/bib.skb
blob: 25a0771a2839e1654552578c6817d4e8f7e85726 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
;;; bib.skb  --  The Skribilo bibliography.
;;; -*- coding: iso-8859-1 -*-
;;;
;;; Copyright 2007, 2008  Ludovic Court�s <ludo@gnu.org>
;;; Copyright 2001, 2002, 2003, 2004  Manuel Serrano
;;;
;;;
;;; This file is part of Skribilo.
;;;
;;; Skribilo is free software: you can redistribute it and/or modify
;;; it under the terms of the GNU General Public License as published by
;;; the Free Software Foundation, either version 3 of the License, or
;;; (at your option) any later version.
;;;
;;; Skribilo is distributed in the hope that it will be useful,
;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;;; GNU General Public License for more details.
;;;
;;; You should have received a copy of the GNU General Public License
;;; along with Skribilo.  If not, see <http://www.gnu.org/licenses/>.

;*---------------------------------------------------------------------*/
;*    Index                                                            */
;*---------------------------------------------------------------------*/
(chapter :title "Bibliographies"

   (p [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:]

   (itemize 
      (item [
Use the default pre-existing ,(emph "bibliography table") or create a 
custom one.])
      (item [
Provide a ,(emph "bibliography database").])
      (item [
Load the database using the ,(markup-ref "bibliography") function.])
      (item [
Reference to bibliography entries with ,(code [,(markup-ref "ref")
,(param [:bib])]) function calls.]))
   
   [The following sections will guide you through these steps.])


;*---------------------------------------------------------------------*/
;*    Bibliography tables                                              */
;*---------------------------------------------------------------------*/
(section :title "Bibliography Tables"
   
   (p [This section describes functions dealing with ,(emph
[bibliography tables]).  Essentially, bibliography tables are the
representation of your bibliographies used by Skribilo at run-time.])
   
   (p [The predicate ,(code "bib-table?") returns ,(code "#t") if and only
if its argument is a bibliography table as returned by 
,(markup-ref "make-bib-table") or ,(markup-ref "*bib-table*"). Otherwise
,(code "bib-table?") returns ,(code "#f").])
   
   (doc-markup 'bib-table?
	       '((obj [The value to be tested]))
	       :see-also '(make-bib-table *bib-table* bibliography the-bibliography)
	       :force-engines *api-engines*
	       :common-args '()
	       :source #f ;;"skribilo/biblio.scm"
               :def '(define-markup (bib-table? obj) ...))
   
   (p [The function ,(code "*bib-table*") returns a global, pre-existing
bibliography-table:])
   (doc-markup '*bib-table*
	       '()
	       :see-also '(bib-table? make-bib-table bibliography the-bibliography)
	       :force-engines *api-engines*
	       :common-args '()
               :source #f
               :def '(define-markup (*bib-table*) ...))
   (p [Technically, ,(code "*bib-table*") is actually an ,(srfi-ref 39)
parameter object, so it can be queried and modified like any other
parameter object.])
   
   (p [The function ,(code "make-bib-table") constructs a new 
bibliography-table:])
   (doc-markup 'make-bib-table
	       '((ident [The name of the bibliography table.]))
	       :see-also '(bib-table? *bib-table* bibliography the-bibliography)
	       :force-engines *api-engines*
	       :common-args '()
	       :source #f
               :def '(define-markup (make-bib-table ident) ...)))
   
;*---------------------------------------------------------------------*/
;*    bibliography ... @label bibliography@                            */
;*---------------------------------------------------------------------*/
(section :title "Bibliography"

(p [The ,(markup-ref "bibliography") function loads bibliography entries
into the bibliography table specified using the ,(param :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 ,(markup-ref "ref").  A bibliography database
must be loaded ,(emph "before") any reference is introduced.  It is
advised to place the ,(markup-ref "bibliography") function call before
the call to the ,(markup-ref "document") function call.])

(doc-markup 'bibliography
	    `((:command ,[An external command to be applied when loading
              the bibliography entries. The sequence ,(code "~a") is replaced
              with the name of the file when the command is invoked.])
	      (:bib-table ,[The ,(ref :mark "make-bib-table" :text "table") 
               where entry is searched.])
	      (#!rest entry... ,[If ,(param 'entry) is a string, it denotes
              a file containing the entry (see ,(ref :mark "*bib-path*" 
              :text "bibliograph path")). Otherwise, it is a list described
              by the ,(ref :subsection "Bibliography Syntax" :text "syntax") 
              below.]))
	    :see-also '(bib-table? make-bib-table *bib-table* the-bibliography)
	    :force-engines *api-engines*
	    :common-args '())

(mark "*bib-path*")
(p [Files passed as an argument to ,(markup-ref "bibliography") are
searched in the current ,(emph [bibliography path]), which is defined by
the ,(tt [*bib-path*]) ,(srfi-ref 39) parameter.  This parameter
contains a list of directories and its value can be obtained using
,(code [(*bib-path*)]).  Its value can be altered using the ,(tt
[-B]) command-line option of the ,(tt [skribilo]) compiler (see ,(numref
:text [Chapter] :ident "compiler") for details).])

(p [The ,(param :command) option can be used to import foreign
bibliography.  The following example, shows how to directly use a BibTeX
bibliography using the ,(ref :section "Skribebibtex") translator.])

(example-produce 
 (example :legend "Printing a Bibliography" (prgm :file "src/bib6.skb")))


;; bibliography syntax
(subsection :title "Bibliography Syntax"

(p [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:])

(disp :verb #t :bg *prgm-skribe-color* [
<entry>  -->  ,(bold "(")<kind> <key> <field>+,(bold ")")
<kind>   -->  techreport | article | inproceedings | book
<key>    -->  <symbol> | <string>
<field>  -->  ,(bold "(")<symbol> <string>,(bold ")")])

(p [BibTeX files cannot be directly loaded but the tool ,(ref :section
"Skribebibtex" :text (tt "skribebibtex")) can be use to automatically
convert BibTeX format to Skribe bibliography format.  Here is an example
of a simple Skribe database.])

(prgm :file "src/bib1.sbib")))

;*---------------------------------------------------------------------*/
;*    the-bibliography ... @label the-bibliography@                    */
;*---------------------------------------------------------------------*/
(section :title "Printing a Bibliography"

(p [The function ,(code "the-bibliography") displays the bibliography. ])

(doc-markup 'the-bibliography
	    `((:bib-table ,[The bibliography 
               ,(ref :mark "make-bib-table" :text "table") to be displayed.])
              (:pred ,[A predicate filtering the bibliography entries. It takes
                      two parameters: the bibliography entry and the 
                      ,(code "the-bibliography") node.])
	      (:sort ,[A function sorting a list of entries.])
	      (:labels ,[Specifies the style for bibliography entries
                        labels.  The default, ,(code "number"), uses
                        numbers to identify references, e.g., "\[7\]".
                        When ,(code "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 ,(it [et al.]) 1980\]".])
	      (:count ,[The symbol ,(code "partial") or ,(code "full")
               specifies the numbering to be applied. The value 
               ,(code "partial") tells Skribilo to count only the entries
               filtered in by ,(param :pred). The value ,(code "full")
               tells Skribilo to count all entries, event those filtered out
               by ,(param :pred).]))
	    :see-also '(bib-table? make-bib-table *bib-table*
	                bibliography noabbrev)
	    :force-engines *api-engines*
	    :common-args '())

(p [Note that the ,(code "name+year") label style will only work if the
following conventions are followed by the ,(code "author") field of your
bibliography entries:

,(itemize
    (item [the ,(code [author]) fields of bibliographic entries should
be a string containing a comma-separated list of full author names;])
    (item [each ``full author name'' should have the form ,(code
"first-name second-name ... last-name").]))

When using the ,(code "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 ,(code
"author") field in a ,(ref :ident "noabbrev" :text (code "noabbrev"))
markup.])
   
(doc-markup 'noabbrev
	    '()
	    :see-also '(the-bibliography bib-sort/first-author-last-name))
   
(p [The following example illustrates typical use of a bibliography.])

(example-produce 
 (example :legend "Printing a Bibliography" (prgm :file "src/bib2.skb"))
 (disp (include "src/bib2.skb")))

;; filtering bibliography
(subsection :title "Filtering Bibliography Entries"
(index "the-bibliography" :note "filtering")

(p [The ,(param :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 ,(emph "all") the entries of a bibliography, is it needed to
print the bibliography with a predicate returning always ,(code "#t").])

(example-produce 
 (example :legend "Unfiltering Bibliography Entries" (prgm :file "src/bib3.skb"))
 (disp (include "src/bib3.skb")))

(p [The second example, filters out the entries that are not ,(emph "book")
or that are not referenced to from the document.])

(example-produce 
 (example :legend "Unfiltering Bibliography Entries" (prgm :file "src/bib4.skb"))
 (disp (include "src/bib4.skb")))

(p [The last example, illustrates how to change the rendering of a
bibliography. It uses the ,(markup-ref "processor") construction 
and it defines two ,(ref :ident "writer" :text "writers") for
displaying ,(code "&bib-entry-ident") and ,(code "&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 ,(code "&bib-entry-"). The parent of all these
markups is the bibliography entry itself. The ,(code "&bib-entry-") markups
are options of there parent.])

(example-produce 
 (example :legend "Unfiltering Bibliography Entries" (prgm :file "src/bib5.skb"))
 (disp (include "src/bib5.skb"))))

;; sorting bibliography
(subsection :title "Sorting Bibliography Entries"
(index "the-bibliography" :note "sorting")

(p [The ,(param :sort) option of the ,(markup-ref "the-bibliography")
markup is used for sorting the bibliography entries. There are three
pre-existing functions for sorting entries:])

(doc-markup 'bib-sort/authors
	    '((l [The list of entries.]))
	    :force-engines *api-engines*
	    :source "skribilo/biblio.scm"
	    :others '(bib-sort/idents bib-sort/dates)
	    :see-also '(bib-sort/first-author-last-name)
	    :common-args '())

(p [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.])

(example-produce 
 (example :legend "Sorting Bibliography Entries" 
	  (prgm :file "skribilo/biblio.scm"
	        :definition 'bib-sort/idents)))
   
(p [In addition, the ,(code [(skribilo biblio author)]) module exports
a fourth procedure that sorts bibliography entries:])

(doc-markup 'bib-sort/first-author-last-name
            '((entries [The list of entries.]))
            :force-engines *api-engines*
            :source "skribilo/biblio/author.scm"
            :see-also '(bib-sort/authors the-bibliography noabbrev)
            :common-args '())
	    
(p [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 ,(code "name+year") label style of ,(ref :ident
"the-bibliography" :text (code "the-bibliography")).])))

;*---------------------------------------------------------------------*/
;*    skribebibtex                                                     */
;*    FIXME: Uncomment section below when we have a replacement.       */
;*---------------------------------------------------------------------*/
(section :title "Skribebibtex"
   
   (p [FIXME: This tool is not available as of Skribilo version
,(skribilo-version).]))

#;(section :title "Skribebibtex"
(index "skribebibtex" :note "manual page")
(index "BibTeX")
(p [
In this section we present the Skribebibtex translator that compiles BibTeX
source files into a Skribe bibliography.])

;; Synopsis (FIXME)
;;(subsection :title "SYNOPSIS" :number #f
;;   (compiler-command *skribebibtex-bin* "options" "input"))

;; Description
(subsection :title "DESCRIPTION" :number #f [
This manual page is not meant to be exhaustive. It
documents the ,(tt "skribebibtex"), a tool that translates
,(bold "BibTeX") files into ,(it "Skribe"), bibliography format. These 
files can be used by the ,(bold "skribe") compiler to produce  
bibliography entries.])

;; Suffixes
(subsection :title "SUFFIXES" :number #f [
The ,(ref :chapter "Skribilo Compiler" :text "skribilo") compiler uses file 
suffixes in order to select amongst its possible targets which to choose. 
These suffixes are:

,(description (item :key (it ".bib") [a ,(bold "BibTeX") source file.]))])

;; Options (FIXME)
;;(subsection :title "OPTIONS" :number #f 
;;(compiler-options *skribebibtex-bin*))

   ))

;;; Local Variables:
;;; ispell-local-dictionary: "american"
;;; End: