update to the manual
[ebib.git] / manual / ebib-manual.muse
bloba231dc6607db76076b019740e09be5540a64022e
1 #author Joost Kremers
2 #title Ebib Manual
4 <div id="menu">
6 <contents>
8 </div>
10 <div id="main">
12 Ebib is a program with which you can manage BibTeX database files without
13 having to edit the raw =.bib= files. It runs in GNU/Emacs, version 21.1 or
14 higher (lower versions are not supported) and XEmacs (at least from version
15 21.4; lower version have not been tested, but may work.)
16   
17 It should be noted that Ebib is *not* a minor or major mode for editing
18 BibTeX files. It is a program in itself, which just happens to make use of
19 Emacs as a working environment, in the same way that for example Gnus is.
20   
21 The advantage of having a BibTeX database manager inside Emacs is that X is
22 no longer required, as Emacs can run on the console, and also that some
23 integration with Emacs' TeX and LaTeX modes becomes possible.  For example,
24 one can insert a key from the database into the text one is editing using
25 tab completion. Another advantage of Ebib is that it is completely
26 controlled by key commands: no stressful mouse movements are required, as
27 with most other (usually X-based) BibTeX database managers.
30 * Installation
32 To install Ebib, so that it will be loaded automatically when Emacs is
33 started, simply copy the file =ebib.el= to somewhere in your load path and
34 add the following line to Emacs' init file (=~/.emacs= for GNU/Emacs,
35 =~/.xemacs/init.el= for XEmacs):
37 <example>
38 (autoload 'ebib "ebib" "Ebib, a BibTeX database manager." t)
39 </example>
41 Note: if you do not know what your load path is set to, go to the =*scratch*=
42 buffer, type =load-path= on an empty line, put the cursor right after it and
43 type =C-j=. The value of =load-path= will then appear in the buffer.
45 When Ebib is loaded, you can run it with =M-x ebib=. This command is also
46 used to return to Ebib when you have put the program in the background. You
47 can bind this command to a key sequence by putting something like the
48 following in Emacs' init file:
50 <example>
51 (global-set-key "\C-ce" 'ebib)
52 </example>
54 You can of course choose any key combination you like. (In Emacs, key
55 combinations of =C-c <letter>= are reserved for the user, so that no package
56 may set them.)
58 It is recommended to byte-compile the source, Ebib runs quite a lot faster
59 when it is byte-compiled. You can do this either within Emacs with =M-x
60 byte-compile-file=, or from your shell by going into the directory where you
61 put =ebib.el= and typing:
63 <example>
64 emacs -batch -f batch-byte-compile ebib.el
65 </example>
67 (Substitute =emacs= with =xemacs= if you use XEmacs.) This will create a file
68 =ebib.elc=, which Emacs will load instead of =ebib.el=. Byte-compiling Ebib may
69 produce a warning about functions that are ``not known to be
70 defined''. This can be safely ignored. GNU Emacs and XEmacs have some small
71 differences, and the functions reported in this warning are those used by
72 the other version. Ebib makes sure that the correct functions are called.
76 * Basic Usage
78 A BibTeX database is somewhat of a free-form database. A BibTeX entry
79 consists of a set of field-value pairs. Furthermore, each entry is known by
80 a unique key. The way that Ebib navigates this database is by having two
81 windows, one that contains a list of all the entry keys in the database,
82 and one that contains the fields and values of the currently highlighted
83 entry.
85 When Ebib is started, the current windows in Emacs are hidden and the Emacs
86 frame is divided into two windows. The top one contains a buffer that is
87 called the *index buffer*, while the lower window contains the *entry
88 buffer*. When a database is loaded, the index buffer holds a list of all the
89 keys in the database. You can navigate through these keys with the cursor
90 keys. In the entry buffer, the fields of the currently highlighted entry
91 are shown, with their values.
93 In this chapter, all basic functions of Ebib are described, so that you can
94 get on your way using it. At times, reference will be made to later
95 chapters, where more specific functions are described.
99 ** Getting Started
101 Ebib is started with the command =M-x ebib=. Entering this command hides all
102 the windows in the current Emacs frame and replaces them with two windows:
103 the top one contains the index buffer, the bottom one, taking up the larger
104 part of the screen, contains the entry buffer. The index buffer is named
105 =none=, to indicate that no database has been loaded. If you open a database,
106 or start a new one, the index buffer will carry its name.
108 You can quit Ebib by typing =q=. You will be asked for confirmation, and you
109 will receive a warning if you happen to have an unsaved database. The
110 command =z= can also be used to leave Ebib. However, unlike =q=, which
111 completely quits Ebib, =z= only lowers it, so that it remains active in the
112 background. The =.bib= files that you have opened remain loaded, and you can
113 return to them by typing =M-x ebib= again.
116 *** Opening a =.bib= file
118 Loading a =.bib= file into Ebib is done with the command =o=. Ebib reads the
119 file that you specified, and reports how many entries it found, how many
120 =@string= definitions it found, and whether a =@preamble= was found. Note that
121 when Ebib reads a =.bib= file, it only reads entry types (e.g. =book, article,
122 phdthesis= etc.) that it knows about. Fields (e.g. =author, title, year= etc.)
123 that Ebib does not know about, are loaded (and saved) but not displayed, so
124 they cannot be edited. Therefore, you should make sure that all the entry
125 types and fields that your databases use are defined. A sensible set has
126 been predefined, so that anyone who's using standard BibTeX entry types
127 should have no problem loading an existing =.bib= file into Ebib. If,
128 however, you have custom entry types, or custom fields in your =.bib= files,
129 you should read the chapter on customising Ebib to learn how to define
130 them, so that Ebib knows about them. (See [[#entry-types][Entry types]].)
132 Every time Ebib reads a =.bib= file, it produces a few log messages. These
133 are written into a special buffer =*Ebib-log*=. If Ebib encounters entry tyes
134 in the =.bib= file that it doesn't know, it will log a warning. If Ebib finds
135 something that it believes to be incorrect, an error will be logged. If any
136 warnings or errors occur while loading the =.bib= file, Ebib tells you so
137 after loading the file. To view the log file, press =l= in the index buffer.
139 Note that even if it detects warnings or errors, Ebib will try to continue
140 parsing the rest of the =.bib= file. That means that normally, only the entry
141 in which an error occurs is not read. Entries occurring after the
142 problematic one are read.
145 *** Navigating a =.bib= file
147 Once you've opened a =.bib= file, the keys of all the entries in the file are
148 shown in alphabetical order in the index buffer in the top Ebib window. The
149 first entry is highlighted, meaning it is the current entry. The fields it
150 holds and their values are shown in the entry buffer in the bottom Ebib
151 window. The first field is the type field, which tells you what kind of
152 entry you're dealing with (i.e. =book, article=, etc.).
154 Below the type field, Ebib displays (up to) three sets of fields. The first
155 set are the so-called obligatory fields, the fields that BibTeX requires to
156 be filled. The second group are the optional fields, which do not have to
157 be filled but which BibTeX will normally add to the bibliography if they do
158 have a value. The third group are the so-called additional fields. These
159 fields are usually ignored by BibTeX (note that BibTeX will normally ignore
160 *all* fields it does not know), although there are bibliography styles that
161 treat some of these fields as optional rather than as additional; (i.e.,
162 the =harvard= styles do typeset the =url= field, if present.)
164 The first two groups of fields are different for each entry type, while the
165 third group are common to all entry types. You can use the additional
166 fields, for example, to add personal comments to the works in your
167 database. Ebib by default defines the following additional fields:
168 =crossref, url, annote, abstract, keywords= and =timestamp=. If these are not
169 sufficient for you, you need to customise Ebib and add your own
170 fields. (See [[#additional-fields][Additional Fields]], if you need to find out how to do that.)
172 To move around in the index buffer, you can use the cursor keys, =C-p= and
173 =C-n=, or for those more used to mutt's key bindings, with =k= and
174 =j=. Furthermore, =Space= and =PgDn= move a screenful of entries down, while =b=
175 and =PgUp= move in the other direction. Lastly, =g= and =Home= move to the first
176 entry, while =G= and =End= move to the last one.
178 Ebib is not restricted to opening just one =.bib= file at a time. You can
179 open more files by just typing =o= again and entering the filename. Ebib
180 numbers the databases: the number of each database is shown in the mode
181 line of the index buffer, directly before the database name. The keys 1--9
182 provide a quick way of jumping from one database to another. Note that the
183 numbering is dynamic: if you have three databases opened and then close the
184 second, database 3 becomes database 2.
186 With the =left= and =right= cursor keys, you can move to the previous or next
187 database. These keys wrap, so if you hit the =left= cursor key while the
188 first database is active, you move to the last database. If you are done
189 with a database and want to close it, type =c=. This closes the current
190 database. It does not leave Ebib, and all other databases you have open
191 will remain so.
194 *** Starting a New =.bib= File
196 If you want to start a new =.bib= file from scratch, you cannot just go and
197 enter entries. You first have to give the database a name. So, to start a
198 new database, type =o= first, and give the new file a name. Once you have
199 done this, you can start adding entries to the database.
202 ** Editing the Database
204 Of course, being able to open and view =.bib= files is only half the fun. One
205 needs to be able to edit the files as well. Ebib's essential editing
206 facilities are discussed here.
209 *** Adding and Deleting Entries
211 To add an entry to a database, you type =a=. When you do this, Ebib first
212 asks you for an entry key, as every entry must be identified by a unique
213 key. Just type a name for the new entry (say =jones1998=). Since the entry
214 key must be unique, Ebib will complain if you enter a key that already
215 exists.
217 Note that if you should later decide that you want to change the key of an
218 entry, you can do so with the command =E=. So if you have an entry with the
219 key =jones1998= and you want to add another entry by Jones from 1998, you can
220 call the new one =jones1998b= and rename the existing one to =jones1998a=.
222 Deleting an entry is done with =d=. Be careful with this: you will be asked
223 for confirmation, but once you've confirmed, the entry is gone, and it is
224 not possible to bring it back. There is no undo in Ebib. (If you haven't
225 saved the database yet, it is still possible to retrieve the deleted entry
226 from the =.bib= file, and otherwise it may still be in the backup file that
227 Ebib creates. See [[#saving-database][Saving a Database]].)
230 *** Editing Fields Values
232 Editing the field values for an entry is done in the lower of the two Ebib
233 buffers, the so-called entry buffer. You can move focus to the entry buffer
234 by typing the command =e= in the index buffer.
236 You can move between fields with the same keys that you use to move between
237 entries in the index buffer: the cursor keys =up= and =down=, =C-p= and =C-n=, or =j=
238 and =k=. =Space= and =PgDn= move to the next set of fields, while =PgUp= and =b= move
239 to the previous set of fields. =g= and =G=, and =Home= and =End= also work as
240 expected.
242 Editing a field value can be done with =e=. For most fields, Ebib will simply
243 ask you for a string value in the minibuffer. (Here, =RET= confirms the edit,
244 while =C-g= cancels it.) Although BibTeX requires that field values be
245 surrounded by braces {} (or double quotes "", but Ebib does not use those,
246 even though it can of course handle them when they are used in an existing
247 =.bib= file) you do not need to type these. Ebib adds them when it saves the
248 =.bib= file.
250 Some fields, however, are handled in a special way. The first of these is
251 the =type= field: if you edit this field, you must enter one of the
252 predefined entry types. Ebib will not allow you to enter anything else. You
253 can use tab-completion in this case. Similarly, if you edit the =crossref=
254 field, Ebib requires that you fill in a key from the database. Here, too,
255 you can use tab-completion.
257 Note that if you're adding a new entry, Ebib will automatically put you in
258 the entry buffer after you've typed the entry key: you don't have to type =e=
259 to move to the entry buffer. When creating a new entry, it is best to set
260 the =type= field first, because the =type= field determines which other fields
261 are available for an entry.
263 Note also that after editing a field, Ebib (usually) puts you on the next
264 field. This is convenient if you're creating a new entry and need to fill
265 out several fields in a row.
267 If you're done editing the fields of the entry, type =q= to move focus back
268 to the index buffer. (Note: keys may have different functions in the index
269 buffer and the entry buffer. =q= is a typical example: in the entry buffer,
270 it quits editing the entry and moves focus back to the index buffer. In the
271 index buffer, however, =q= quits Ebib.)
274 *** Editing Multiline Values
276 Apart from the =type= and =crossref= field, there is another field that Ebib
277 handles in a special way when you edit its value. This is the =annote=
278 field. Most field values normally consist of a single line of
279 text. However, because the =annote= field is meant for creating annotated
280 bibliographies, it would not be very useful if you could only write one
281 line of text in this field. Therefore, when you edit the =annote= field, Ebib
282 will put you in the so-called *multiline edit buffer*. This is essentially a
283 text mode buffer that allows you to enter as much text as you like. To
284 store the text and leave the multiline edit buffer, type =C-x b=. (This is of
285 course the standard Emacs command to switch buffers. It is redefined in
286 Ebib's multiline edit buffer.)
288 If you want to leave the multiline edit buffer without saving the text you
289 have just typed, you can use the command =C-x k=. This too is redefined in
290 the multiline edit buffer: it leaves the multiline edit buffer (and hides
291 it), but it does not actually kill the buffer.
293 Multiline values are not restricted to the =annote= field. Any field can in
294 fact hold a multiline value. (Except of course the =type= and =crossref=
295 fields.) To give a field a multiline value, use =l= instead of =e=. You will
296 again be put in the multiline edit buffer, where you can edit the
297 value. Note that you can use =l= even if a field already has a single line
298 value. Ebib will just make that the first line in the multiline edit
299 buffer.
301 When a field has a multiline value, only the first line is shown in the
302 entry buffer, for space reasons. To indicate that the value is multiline, a
303 plus sign =+= is placed in front of the value.
305 By the way, the =e= key is smart about the way an entry must be edited. If
306 you press =e= on a field that already has a multiline value, regardless of
307 the fact whether it is the =annote= field or not, Ebib puts you in the
308 multiline edit buffer. Therefore, you need =l= only if you want to give a
309 field a multiline value when it doesn't have one yet.
311 For more details on working with the multiline edit buffer, see
312 [[#multiline-edit-buffer][The Multiline Edit Buffer]].
315 *** Copy, cut, paste (yank), and delete
317 A few more commands are available when you're in the entry buffer editing
318 field values. The commands =c=, =x= and =y= implement a copy and paste system: =c=
319 copies the contents of the current field to the kill ring, =x= kills the
320 contents of the current field to the kill ring, and =y= yanks (pastes) the
321 most recently killed text in the kill ring. You can type =y= repeatedly to
322 get the same effect you get in Emacs when you type =M-y= after an initial
323 =C-y=: every additional use of =y= moves back in the kill ring.
325 Lastly, there is the command =d=, which deletes the contents of the current
326 field, without asking questions and without storing the text in the kill
327 ring.
329 Note that =y= only works when the current field does not have a value
330 yet. This is to prevent you from accidentally overwriting a field value. If
331 you do want to yank text into a field that already has a value, simply hit
332 =d= first to delete the text.
335 ** Saving a Database
336 #saving-database
338 When you have undertaken any kind of editing action on a database, it is
339 marked as modified, which is indicated in the mode line for the index
340 buffer. A modified database can be saved by typing =s=. This saves the
341 database to the file it was loaded from without asking for
342 confirmation. (It is similar to =C-x C-s= in Emacs.) If you're saving a file
343 for the first time after loading it, Ebib will create a backup file under
344 the same name appended with a tilde: =<filename>.bib~=.
346 If you have multiple databases open, have made changes in more than one of
347 them, and want to save all of them without going through each yourself, you
348 can use =S=. (That's a capital =S=.) This command saves all modified databases.
350 Another way to save a database is to use the command =w=. Use this if you
351 want to write the database to another file than the one it was loaded
352 from. Ebib will ask you for a filename to save to, and will of course warn
353 you if that file happens to exist already. Note that this command is
354 similar to =C-x C-w= in Emacs, so that after using it, the new =.bib= file
355 becomes associated with the database.
358 ** Searching
359 #searching
361 Ebib provides several search methods. First, if you are in the index
362 buffer, the normal Emacs incremental searches, =C-s= and =C-r=, function as
363 expected. You can use them to search entry keys. Note that once you've
364 found the key you're searching, you must hit =ENTER= to make it active. Ebib
365 does not update the entry buffer during incremental search, as this would
366 be rather pointless: you're only interested in the entry you're searching
367 for, not in the entries you pass along the way.
369 Of course, it is also possible to search the database itself. If you type
370 =/=, Ebib asks you for a search term. This can be a regural expression, to
371 allow for flexibility in searching. After hitting =ENTER=, Ebib will start
372 searching the database (starting from the current entry, *not* from the first
373 entry!) and will display the entry with the first occurrence of the search
374 string that it finds. All the occurrences of the search string in that
375 entry are highlighted.
377 Ebib searches all the fields of each entry. It is not possible with =/= to
378 specify the fields to search. Note that if the search term is found in a
379 field with a multiline value, Ebib will highlight the =+= sign that it
380 displays in front of the field value. Keep an eye out for this when doing a
381 search, because Ebib only shows the first line of multiline values, and if
382 the search term appears in another line, the highlighted =+= is the only
383 indication that the search term was found. (Well, that and the fact that
384 Ebib does *not* say =Search string not found=, of course...)
386 A search term may of course appear more than once in the database. To
387 search for the next occurrence, type =n=. This will continue searching for
388 the search string in the rest of the database. Again, the first entry found
389 to contain the search string is displayed. Note that =n= does not wrap: if
390 the end of the database is reached, Ebib stops searching. To continue
391 searching from the top, hit =g= and then =n=.
393 The functions described here form Ebib's basic search functionality. Ebib
394 also has a much more powerful search mechanism in the form of *virtual
395 databases*. These are described later. (See [[#virtual-databases][Virtual Databases]].)
398 ** LaTeX Integration
400 Having a BibTeX database manager running inside Emacs has an additional
401 advantage: it makes it trivially easy to insert BibTeX keys in your LaTeX
402 documents.
404 Ebib provides two functions for this. First, if you're in a LaTeX buffer,
405 you can call the function =ebib-insert-bibtex-key=. When you invoke this
406 command, Emacs prompts you for a key from the database(s) associated with
407 the current buffer. You can type the key, using TAB-completion, and after
408 hitting =RET=, Emacs puts a BibTeX citation at the cursor position in the
409 current buffer with the key you selected.
411 You can also do it the other way around: if you're in the index buffer in
412 Ebib, you can *push* an entry to a LaTex buffer. To do this, use the key =p=.
413 Ebib will ask you for a buffer to push the entry to, and will then insert
414 the string =\cite{<key>}= at the current cursor position in the buffer you've
415 supplied.
417 By default, both =ebib-insert-bibtex-key= and the command key =p= in the index
418 buffer insert the key into the LaTeX buffer with command =\cite=. It is
419 possible to change this, however. In fact, it is possible to define
420 multiple insertion strings, so that you can have Ebib insert a variety of
421 citation commands with an entry key. For details on defining and using
422 custom insertion strings, see [[#insertion-strings][Insertion Strings]].
424 There is another function that is available outside Ebib:
425 =ebib-entry-summary=. This command reads the key under the cursor in the
426 current buffer and displays the field values associated with that key in a
427 =*Help*= buffer. This allows you to quickly check a reference in a text.
429 Probably the easiest way to use both =ebib-insert-bibtex-key= and
430 =ebib-entry-summary= is to bind them to a key sequence. For example, you
431 could put the following in your =~/.emacs=:
433 <example>
434 (add-hook 'LaTeX-mode-hook #'(lambda ()
435           (local-set-key "\C-cb" 'ebib-insert-bibtex-key)))
436 </example>
438 This binds =C-c b= to the command =ebib-insert-bibtex-key= in AUCTeX's LaTeX
439 mode. (Note that commands of the form =C-c <letter>= are reserved for the
440 user, and should therefore not be set by any package. For this reasons,
441 Ebib does not set this command automatically.)
444 *** Consulting databases from within a LaTeX file
446 The commands =ebib-insert-bibtex-key= and =ebib-entry-summary= must consult the
447 database or databases loaded in Ebib, and Ebib tries to be smart about
448 which database(s) to consult. Usually, a LaTeX file has a =\bibliography=
449 command somewhere toward the end, which names the =.bib= file or files that
450 contain the bibliography entries. If you consult a BibTeX database from
451 within a LaTeX file, Ebib first looks for a =\bibliography= command, reads
452 the =.bib= files from it, and then sees if those files happen to be open. If
453 they are, Ebib uses them to let you pick an entry key (in the case of
454 =ebib-insert-entry-key=) or to search for the entry (in the case of
455 =ebib-entry-summary=).
457 Of course, it may be the case that the LaTeX file is actually part of a
458 bigger project, and that only the master file contains a =\bibliography=
459 command. To accommodate for this, Ebib checks whether the (buffer-local)
460 variable =TeX-master= is set to a filename. If it is, it reads that file and
461 tries to find the =\bibliography= command there. (Note: =TeX-master= is an
462 AUCTeX variable, which is used to keep track of multi-file projects. If you
463 don't use AUCTeX, this functionality doesn't work, and Ebib will only check
464 the current file for a =\bibliography= command.)
466 Note that if one of the =.bib= files in the =\bibliography= command isn't
467 loaded, Ebib issues a warning message about this, and continues to check
468 for the next =.bib= file. These warning messages appear in the minibuffer,
469 but are probably directly overwritten again by further messages or prompts
470 Ebib produces, so check the =*Messages*= buffer if Ebib doesn't seem to be
471 able to find an entry that you're sure is in one of your databases.
473 Another thing to keep in mind is that Ebib only looks for a =\bibliography=
474 command once: the first time either =ebib-insert-bibtex-entry= or
475 =ebib-entry-summary= is called. It stores the result of this search and uses
476 it the next time either of these commands is used. Therefore, if you make a
477 change to the =\bibliography= command, you must reload the file (use =M-x
478 revert-buffer=) to make sure Ebib rereads the =\bibliography= command.
480 If no =\bibliography= command is found at all, either in the LaTeX file
481 itself, or in the master file, Ebib simply consults the current database,
482 i.e. the database that was active when Ebib was lowered with =z=.
485 ** Cross-referencing
487 BibTeX has a cross-referencing facility. Suppose you have an entry
488 =jones1998=, which appeared in a book that is also in your database, say
489 under =miller1998=. You can tell BibTeX that =jones1998= is contained in
490 =miller1998= by putting =miller1998= in the =crossref= field. When BibTeX finds
491 such a cross-reference, all the fields of =jones1998= that don't have a value
492 inherit their values from =miller1998=. At the very least, this saves you
493 some typing, but more importantly, if two or more entries cross-reference
494 the same entry, BibTeX automatically includes the cross-referenced entry in
495 the bibliography (and puts a reduced reference in the cross-referencing
496 entries).
498 When you fill in the =crossref= field in Ebib, Ebib displays the values of
499 the cross-referenced entry in the entry buffer. To indicate that they are
500 just inherited values, they are marked with =ebib-crossref-face=, which by
501 default is red. (You can customise it, of course. See the customisation
502 option [[#crossref-face][Crossref Face]].) These values are just displayed for convenience:
503 otherwise, Ebib treats these fields as if they are empty. That is, they
504 cannot be edited (to edit them, you need to edit the cross-referenced
505 entry), and it's not possible to copy these values to the kill ring.
507 If you're viewing an entry that has a cross-reference, and want to go to
508 the cross-referenced entry you can type =F=. This command reads the value of
509 the =crossref= field and then displays that entry.
511 Note that if you want to use BibTeX's cross-referencing options, you need
512 to set the option [[#save-xrefs-first][Save Xrefs first]]. This tells Ebib to save all entries
513 with a =crossref= field first in the =.bib= file. Without this, BibTeX's
514 cross-referencing will not work reliably. 
517 ** Printing the Database
518 #printing-database
520 Sometimes it may be useful to have a =.pdf= file or print-out of your
521 database. Although Ebib does not actually do the printing itself, it can
522 create a LaTeX file for you that you can compile and print. In fact, there
523 are two ways of doing this.
525 The first is the command =L=. This command creates a simple LaTeX document
526 that essentially contains a <verb>\nocite{*}</verb> command followed by a
527 <verb>\bibliography</verb> command referring to the =.bib= file belonging to
528 the current database. You can then run the usual sequence of LaTeX, BibTeX,
529 LaTeX, LaTeX on this file, creating a document containing a list of all the
530 references in your database.
532 The second command for printing a database is =P=. This command also creates
533 a LaTeX file. However, instead of simply providing a
534 <verb>\nocite{*}</verb> command, =P= creates a =tabular= environment for each
535 entry in the database listing all the fields of that entry and their
536 values.
538 The difference between =L= and =P= should be obvious: with =L=, you get a list of
539 references created by BibTeX. This means that the references look the way
540 they will when actually used in a document, but it also means that the list
541 only contains the information that BibTeX deems relevant.
543 With =P= you get an overview of your database with *all* the field values of
544 each entry, including the ones that BibTeX does not use. The entries are
545 not formatted as literature references, but in a way similar to how they
546 are shown in Ebib.
548 By default, =P= only shows single-line field values. That is, multiline
549 values are normally excluded. If you want to include multiline values in
550 the print-out, you have to set the option =Print Multiline= in Ebib's
551 customisation buffer. (See [[#customisation-buffer][The Customisation Buffer]].) With this option set,
552 Ebib will include all multiline values in the LaTeX file that =P=
553 creates. Note however that Ebib does not change anything about the
554 formatting of the text in a multiline value. So if you plan to make (heavy)
555 use of this option, make sure that the way you type your text conforms to
556 LaTeX's conventions (e.g. empty lines to mark paragraphs, etc.) and doesn't
557 contain any characters such as =&= that are illegal in LaTeX. (Or,
558 alternatively, use LaTeX code in your multiline fields.)
560 As mentioned, when you use either =L= or =P=, Ebib creates a LaTeX file. More
561 precisely, it creates a temporary buffer and writes the LaTeX code into it,
562 and then saves the contents of that buffer to a file. After it has done
563 that, Ebib will lower itself and instruct Emacs to open the file in a
564 buffer, which will then be properly set up as a LaTeX buffer. From there
565 you can run LaTeX and view the result.
567 Before doing all this, Ebib will ask you which file to write to. Be careful
568 with this: since this is supposed to be a temporary file, Ebib will simply
569 assume that if you provide a filename of an existing file, it can overwrite
570 that file without warning!
572 A better way to tell Ebib which file to use is to set the option =Print
573 Tempfile= in Ebib's customisation buffer to some temporary file. When this
574 option is set, Ebib will always use this file to write to, and will not ask
575 you for a filename anymore when you type =L= or =P=.
577 There are two more customisation options for printing the database. These
578 are =Print Preamble= and =LaTeX Preamble=. With these options, you can specify
579 what Ebib should put in the preamble of the LaTeX files it creates. Use
580 this if you want to use specific packages
581 (e.g. <verb>\usepackage{a4}</verb> or
582 <verb>\usepackage{times})</verb>. This is especially useful for =L=, since by
583 default, Ebib uses BibTeX's standard bibliography style. With the option
584 =LaTeX Preamble= you can set your preferred bibliography style. Details are
585 discussed in the chapter on customisation, see [[#customisation-buffer][The Customisation Buffer]].
589 ** Marking Entries
591 Commands in the index buffer generally operate on one single entry, or on
592 all entries. For some, however, it may sometimes be useful to perform them
593 on more than one entry, but not necessarily all of them. This can be
594 achieved by marking entries. You can mark the entries you want to perform a
595 command on with the key =m=. This marks (or unmarks) the current
596 entry. Marked entries are displayed in inverse video (in GNU Emacs) or
597 white on red (in XEmacs; note that the face properties of marked entries
598 can be customised through the customisation option [[#marked-face][Marked Face]].)
600 Of the commands discussed so far, four can be used on marked entries: =d=, =p=,
601 =L= and =P=. Note, however, that it is not enough to mark the entries you want
602 and then type any of these commands. If you do so, they will behave as if
603 no entries were marked. To get these commands to work on the marked
604 entries, you have to type a semicolon before them. That is, =; d= deletes all
605 marked entries, and =; L= and =; P= create a LaTeX file of only the marked
606 entries. The command =m= itself can also be used with the =;= prefix. If there
607 are any marked entries, =; m= unmarks them all. Otherwise, =; m= marks all
608 entries.
610 =; p= pushes all marked entries to a LaTeX buffer. It does so by putting them
611 all in a single =\cite= command, separated by commas, not by putting them in
612 separate =\cite= commands.
615 ** Calling a Browser
617 With more and more scientific literature becoming available on-line, it
618 becomes common to store URLs in a BibTeX database. Sometimes you may want
619 to load such a URL in your browser. Ebib provides a convenient way for
620 doing so.
622 If you type =u= in the index buffer, Ebib will take the first URL stored in
623 the =url= field of the current entry and pass it to your
624 browser. Furthermore, in the entry buffer, you can use =u= on *any* field. If
625 you happen to have more than one URL stored in the relevant field, and you
626 want to pass the second (or third, etc.) to the browser, you can use a
627 prefix argument. So typing =M-2 u= sends the second URL to your browser, =M-3
628 u= the third, and so on.
630 It is not even necessary that the relevant field contains *only* URLs. It may
631 contain other text mixed with the URLs: Ebib simply searches the URLs in
632 the field and ignores the rest of the text. Ebib considers every string of
633 characters that starts with =http://= or =https://= and does not contain
634 whitespace or any of the characters =" ' <= or =>= as a URL. Furthermore, Ebib
635 regards everything that is enclosed in a LaTeX <verb>\url{...}</verb>
636 command as a URL. This behaviour is controlled by a regular expression that
637 can be customised. (See [[#url-regexp][Url Regexp]].)
639 There exists an Emacs function =browse-url=, which provides a nifty interface
640 to calling an external browser. In principle, Ebib uses this
641 function. However, if this function is not present on your installation,
642 you can set the option [[#browser-command][Browser Command]] to call the browser.
644 As just explained, if you press =u= in the index buffer, Ebib searches the
645 =url= field of the current entry for URLs. If you have the habit of putting
646 your URLs in another field, however, you may change the customisation
647 option [[#standard-url-field][Standard Url Field]] and tell Ebib to use another field for searching
648 the URLs. (Keep in mind, though, that in the entry buffer, you can load a
649 URL from any field.)
652 * Advanced Features
654 The features discussed in the previous chapter should be sufficient to get
655 started using Ebib. However, Ebib has several more advanced features, which
656 are described in this chapter.
659 ** Preloading =.bib= files
661 Chances are that you will be doing most of your work with one or a few =.bib=
662 files, and you may find yourself opening the same file or files every time
663 you start Ebib. If so, you can tell Ebib to always load specific =.bib= files
664 on startup. To do this, specify the files in Ebib's customisation buffer,
665 under the option [[#preload-bib-files][Preload Bib Files]].
668 ** =@Preamble= Definition
670 Apart from database entries, BibTeX allows three more types of elements to
671 appear in a =.bib= file. These are =@comment=, =@preamble= and =@string=
672 definitions. Ebib provides facilities to handle the latter two. =@comment=
673 definitions cannot be added to a =.bib= file through Ebib, and if Ebib finds
674 one in a =.bib= file, it will simply ignore it.
676 =@preamble= and =@string= definitions can be handled, however. Ebib allows you
677 to add one =@preamble= definition to the database.  In principle, BibTeX
678 allows more than one such definition, but really one suffices, because you
679 can use the concatenation character =#= to include multiple TeX or LaTeX
680 commands. So, rather than having two =@preamble= definitions such as:
682 <example>
683 @preamble{ "\newcommand{\noopsort}[1]{} " }
684 @preamble{ "\newcommand{\singleletter}[1]{#1} " }
685 </example>
687 <literal style="texinfo">@noindent</literal>you can write this in your =.bib=
688 file:
690 <example>
691 @preamble{ "\newcommand{\noopsort}[1]{} "
692          # "\newcommand{\singleletter}[1]{#1} " }
693 </example>
695 Creating or editing a =@preamble= definition in Ebib is done by hitting =r= in
696 the index buffer. Ebib uses the multiline edit buffer for editing the text
697 of the =@preamble= definition, which means that as discussed above, =C-x b=
698 stores the =@preamble= text and returns focus to the index buffer, while =C-x
699 k= returns focus to the index buffer while abandoning any changes you may
700 have made. (For details on using the multiline edit buffer, see
701 [[#multiline-edit-buffer][The Multiline Edit Buffer]].)
703 In order to create a =@preamble= as shown above in Ebib, you only have to
704 type the text between the braces.  Ebib will take care of including the
705 braces of the =@preamble= command, but otherwise it will save the text
706 exactly as you enter it. So you'd have to type the following in Ebib:
708 <example>
709 "\newcommand{\noopsort}[1]{} "
710 # "\newcommand{\singleletter}[1]{#1} "
711 </example>
713 Note that when Ebib loads a =.bib= file that contains more than one =@preamble=
714 definition, it will concatenate all the strings in them in the manner just
715 described and save them in one =@preamble= definition.
719 ** =@String= Definitions
721 If you press =t= in the index buffer, Ebib hides the entry buffer in the
722 lower window and replaces it with the *strings buffer*. In this buffer, you
723 can add, delete and edit =@string= definitions.
725 Adding a =@string= definition is done with the command =a=. This will first ask
726 you for an abbreviation and then for the value to be associated with that
727 abbreviation. Once you've entered these, Ebib will sort the new
728 abbreviation into the buffer.
730 Moving between the =@string= definitions can be done in the usual way: the
731 cursor keys =up= and =down=, =C-p= and =C-n= and =k= and =j= move up and down. =Space=
732 and =PgDn= move ten strings down, while =b= and =PgUp= move in the other
733 direction. The keys =g=, =G=, =Home= and =End= also function as expected.
735 To delete a =@string= definition, use =d=. To edit the value of a definition,
736 use =e=. There is also a command =c=, which copies the value of the current
737 =@string= definition to the kill ring. Unlike in the entry buffer, there are
738 no corresponing commands =y= and =x=. (In fact, =x= does exist, but has another
739 function.) Yanking from the kill ring can be done with =C-y/M-y= in the
740 minibuffer when you edit a =@string='s value. Cutting a =@string='s value
741 is pointless, because a =@string= definition must have a value.
743 Having defined =@string= definitions, there must of course be a way to use
744 them. Just giving a field a string abbreviation as value will not do,
745 because Ebib puts braces around the value that you enter when it writes the
746 =.bib= file, so that BibTeX will not recognise the abbreviation, and will not
747 expand it. BibTeX will only recognise an abbreviation if it appears in the
748 =.bib= file outside of any braces.
750 To accomplish this, you must mark a field's value as *raw*. A raw field is a
751 field whose value is not surrounded by braces when the database is saved,
752 so that BibTeX recognises it as an abbreviation. To mark a field raw, press
753 =r=. An asterisk will appear before the field, indicating that it is
754 raw. Pressing =r= again will change the field back to normal. If you press =r=
755 on a field that does not have a value yet, Ebib will ask you for one.
757 Note that this also makes it possible to enter field values that are
758 composed of concatenations of strings and abbreviations. The BibTeX
759 documentation for example explains that if you have defined:
761 <example>
762 @string{WGA = "World Gnus Almanac"}
763 </example>
765 <literal style="texinfo">@noindent</literal>you can create a BibTeX field
766 like this:
768 <example>
769 title = 1966 # WGA
770 </example>
772 <literal style="texinfo">@noindent</literal>which will produce ``1966 World
773 Gnus Almanac''. Or you can do:
775 <example>
776 month = "1~" # jan
777 </example>
779 <literal style="texinfo">@noindent</literal>which will produce someting
780 like ``1 January'', assuming your bibliography style has defined the
781 abbreviation =jan=. All this is possible with Ebib, simply by entering the
782 exact text including quotes or braces around the strings, and marking the
783 relevant field as raw.
785 An easy way to enter a =@string= abbreviation as a field value is to use the
786 key =s= instead of =e=. If you type =s=, Ebib will ask you for a =@string=
787 abbreviation to put in the current field, and will automatically mark the
788 field as raw. With this command, Ebib will only accept =@string= definitions
789 that are in the database, so that by using =s= you can make sure you don't
790 make any typos. Note that you can use tab completion to complete a partial
791 string.
794 ** Sorting the =.bib= file
795 #sorting-bib-file
797 By default, the entries in the database are saved to the =.bib= file in
798 alphabetical order according to entry key. If you only deal with the =.bib=
799 file through Ebib, you may not care in which order the entries are
800 saved. However, it may sometimes be desirable to be able to specify the
801 sort order of entries in more detail. (Apparently, this can be useful with
802 ConTeXt, for example.)
804 You can specify a sort order in Ebib's customisation buffer. To sort the
805 entries, you must set at least one sort level (that is, a field to sort the
806 entries on). You can also specify more than one sort level: if two entries
807 have identical values for the first sort level, they will be sorted on the
808 second sort level. E.g., if the first sort level is =author= and the second
809 is =year=, then the entries are sorted by author, and those entries that have
810 identical values for the =author= field are sorted by year.
812 A sort level is not restricted to a single field. You can specify more
813 fields for a single sort level. Within a single sort level, a second sort
814 field is used if the first sort field does not have a value. For example,
815 books that have an editor instead of an author will have an empty =author=
816 field. If you sort the database on the =author= field, such entries will all
817 appear at the beginning of the =.bib= file, which is most likely not what you
818 want.
820 To remedy this, you can specify both the =author= and the =editor= fields for
821 the first sort level. Ebib will then sort an entry on its =author= field if
822 it has a value, and will otherwise use the value of the =editor= field.
824 The difference between two sort fields within one sort level and two sort
825 levels is that a second sort *field* is an alternative for the first field
826 when it has no value, while a second sort *level* is an additional sort
827 criterion when two or more entries cannot be sorted on the first level,
828 because they have identical values.
830 By default, the option =Sort Order= has no value, which means that the
831 entries in the =.bib= file are sorted according to entry key. Those that wish
832 to customise the sort order will usually want to set the first sort level
833 to =author editor=, and the second to =year=. In that way, the entries in the
834 =.bib= file are sorted according to author/editor, and entries with the same
835 author/editor are sorted by year.
837 Entries that cannot be sorted on some sort level, because the sort fields
838 are empty, are sorted on entry key. (Keep in mind that if the first sort
839 level yields *no value* for a specific entry, Ebib does *not* use the second
840 sort level to sort that entry. It uses the entry key. The second sort level
841 is only used if the first yields *identical* values for two or more entries.)
843 Note that if you have set the option =Save Xrefs First= (see the previous
844 section), it is pointless to set a sort order. Saving cross-referencing
845 entries first messes up any sort order, so Ebib simply ignores the sort
846 order if =Save Xrefs First= is set.
849 ** Merging and Importing
851 As described in the previous chapter, adding entries to a database can be
852 done manually with the key =a=. There are other ways of adding entries to a
853 database, however.
855 With the command =M= you can merge a second =.bib= file into your current
856 database. When you hit =M=, you are asked for a filename. Ebib then reads the
857 entries in this file and adds them to the database. Duplicate entries (that
858 is, entries with an entry key that already exists in the database) will not
859 be loaded. Ebib logs a warning about each duplicate entry to its log
860 buffer, and displays a warning after loading the =.bib= file when this
861 happens.
863 Another way to add entries to a database is to import them from an Emacs
864 buffer. If, for example, you find ready-formatted BibTeX entries in a text
865 file or e.g. the internet, you can copy & paste them to any Emacs buffer
866 (e.g. the =*scratch*= buffer), and then execute the command =M-x
867 ebib-import=. Ebib will then go through the buffer and load all BibTeX
868 entries it finds into the current database (i.e. the database that was
869 active when you lowered Ebib). If you call =ebib-import= while the region is
870 active, Ebib will only read the BibTeX entries in the region.
873 ** Exporting Entries
875 Sometimes it can be useful to copy entries from one database to another, or
876 to create a new =.bib= file with several entries from an existing
877 database. For this purpose, Ebib provides exporting facilities. To export
878 an entry to a =.bib= file, use the command =x=. Ebib will ask you for a
879 filename to export the entry to. (If you have already exported an entry
880 before, Ebib will present the filename you used as default, but you can of
881 course change it.)
883 For obvious reasons, Ebib appends the entry to the file that you enter if
884 it already exists, it does not overwrite the file. If this is not what you
885 want, delete the file first, as Ebib provides no way to do this.
887 If you have more than one database open in Ebib, it is also possible to
888 copy entries from one database to another. To do this, use the =x= command
889 with a numeric prefix argument. E.g., if the database you want to export an
890 entry to is the second database, type =M-2 x= to export the current entry to
891 it. The number of the database is given in the modeline of the index
892 buffer.
894 If the database you're copying an entry to already contains an entry with
895 the same entry key, Ebib will not copy the entry, and issue an appropriate
896 warning message.
898 Note that the command =x= can operate on marked entries. So to export several
899 entries in one go mark them and type =; x=. You can use a prefix argument in
900 the normal way: =M-2 ; x= exports the marked entries to database 2.
902 Apart from entries, it is also possible to export the =@preamble= and =@string=
903 definitions. The =@preamble= definition is exported with the command =X= in the
904 index buffer. =@string= definitions can be exported in the strings buffer: =x=
905 in this buffer exports the current string, while =X= exports all =@string=
906 definitions in one go. All these commands function in the same way: when
907 used without a prefix argument, they ask for a filename, and then append
908 the relevent data to that file. With a numeric prefix argument, they copy
909 the relevant data to the corresponding open database.
912 ** Timestamps
913 #timestamps
915 Ebib provides the possibility to add a timestamp to every new entry,
916 recording the time it was added to the database. The timestamp is recorded
917 in the (additional) field =timestamp=. (By default, this field is not shown,
918 but you can make it visible by pressing =H= in the index buffer.)
920 You can tell Ebib to create timestamps by setting the option =Use Timestamp=
921 in Ebib's customisation buffer. With this option set, a timestamp will be
922 included in entries added to the database with =a=. Ebib will also add a
923 timestamp to entries imported from a buffer or merged from a file, and to
924 entries exported to another database or to a file. When importing or
925 exporting entries, existing timestamps will be overwritten. The logic
926 behind this is that the timestamp records the date and time when the entry
927 was added to the database, not when it was first created.
929 Note that if this option is unset, the timestamp of an entry will be
930 retained when it's imported or exported. Therefore, if you record
931 timestamps and want to im-/export entries without changing their
932 timestamps, temporarily unset this option.
934 Ebib uses the function =format-time-string= to create the timestamp. The
935 format string that Ebib uses can be customised in Ebib's customisation
936 buffer. The default string is ="%a %b %e %T %Y"=, which produces a timestamp
937 of the form ="Mon Mar 12 01:03:26 2007"=. Obviously, this string is not
938 suited for sorting, so if you want to be able to sort on timestamps, you
939 will need to customise the format string. See the documentation for
940 =format-time-string= on the options that are available.
943 ** Multiple Identical Fields
944 #multiple-identical-fields
946 Under normal circumstances, a BibTeX entry only contains one occurrence of
947 each field. If BibTeX notices that an entry contains more than one
948 occurrence of an obligatory or optional field, it will issue a
949 warning. Ebib is somewhat less gracious, it simply takes the value of the
950 last occurrence without giving any warning. (Note, by the way, that BibTeX
951 will use the value of the *first* occurrence, not the last.) When additional
952 fields appear more than once in an entry, BibTeX does not warn you, since
953 it ignores those fields anyway. Here, too, Ebib's standard behaviour is to
954 ignore all but the last value.
956 However, some online reference management services ``use'' this feature of
957 BibTeX in that they put multiple =keywords= fields in the BibTeX entries that
958 they produce. If you were to import such an entry into Ebib, you would lose
959 all your keywords except the last one. To remedy this, you can tell Ebib
960 that it should allow multiple occurrences of a single field in a BibTeX
961 entry. You can do this by setting the customisation option
962 [[#allow-identical-fields][Allow Identical Fields]].
964 With this option set, Ebib collapses the multiple occurrences into a single
965 occurrence. All the values of the different occurrences are collected and
966 stored in the single occurrence, separated by semicolons. That is, Ebib
967 does not retain the multiple occurrences, but it does retain the values. So
968 suppose you have an entry that contains the following =keywords= fields:
970 <example>
971 @book{jones1998,
972     author = {Jones, Joan},
973     year = {1998},
974     ...
975     keywords = {sleep},
976     keywords = {winter},
977     keywords = {hybernation}
979 </example>
981 If you load this entry into Ebib with the option =Allow Identical Fields=
982 set, you will get the following:
984 <example>
985 @book{jones1998,
986     author = {Jones, Joan},
987     year = {1998},
988     ...
989     keywords = {sleep; winter; hybernation}
991 </example>
994 ** Virtual Databases
995 #virtual-databases
997 In the previous chapter, Ebib's basic search functionality was
998 discussed. (See [[#searching][Searching]].) Ebib also provides a much more sophisticated
999 search and filtering mechanism in the form of *virtual databases*.
1001 A virtual database is a database that is not associated with any =.bib=
1002 file. Rather, it is created from another database by selecting entries from
1003 it based on a specific search pattern, called a *filter*. This allows you,
1004 for example, to select all entries from a database that contain the string
1005 ``Jones'' in their =author= field. A filter can be as complex as you want:
1006 you can select all entries that do *not* contain ``Jones'' in the =author=
1007 field, or all entries that contain ``Jones'' in either the =author= or the
1008 =editor= field, or all entries that contain ``Jones'' in the =author= field,
1009 and ``symbiotic hybernation'' in the =keyword= field, etc. Basically, the
1010 filter can consist of an arbitray number of search criteria combined with
1011 the logical operators =and, or= and =not=.
1014 *** Simple Selection
1016 Creating a virtual database is simple: press =&=, and Ebib will ask you for a
1017 field to select on, and for a regular expression to select with. So if you
1018 want to select all entries that contain ``Jones'' in the =author= field, you
1019 press =&= and type =author= as the field and =Jones= as the regexp to filter on.
1021 Ebib will then create a virtual database containing the entries matching
1022 your selection criterion. A virtual database has the same name as the
1023 database it is based on, prepended with =V:=. It also has a number like any
1024 other database, and you can move back and forth to other databases with the
1025 number or cursor keys.
1027 If you don't want to filter on one specific field but rather want to select
1028 all entries that match a certain regexp in any field, you can type =any= as
1029 the field to filter on. So specifying =any= as the field and =Jones= as the
1030 regexp, the virtual database will select all entries that have a field that
1031 contains ``Jones'' in them.
1034 *** Complex Filters
1036 Once you have a virtual database, it remains associated with the database
1037 it was created from. This means that you can refine or extend the selection
1038 (i.e. the filter) that the virtual database is based on. If, in the current
1039 example, you want to include all the entries that have ``Jones'' in the
1040 =editor= field, you have to perform a logical =or= operation: you want to
1041 select an entry if it contains ``Jones'' in the =author= field (which you
1042 already did) *or* if it contains ``Jones'' in the =editor= field.
1044 A short sidenote: the first impulse in a case like this might be to use =and=
1045 instead of =or=: after all, you want to select all entries that contain
1046 ``Jones'' in the =author= field *and* all entries that contain ``Jones'' in the
1047 =editor= field. However, the filter that you build up is used to test each
1048 entry *individually* whether it meets the selection criterion. An entry meets
1049 the criterion if it contains ``Jones'' in the =author= field *or* if it
1050 contains ``Jones'' in the =editor= field. Therefore, =or= is the required
1051 operator in this case. If you would use =and=, you would only get those
1052 entries that contain ``Jones'' in both the =author= *and* =editor= fields.
1054 To perform a logical =or= operation, press the key =|=. Like before, you will
1055 be asked which field you want to filter on, and which regexp you want to
1056 filter with. Ebib will then update the virtual database with all entries in
1057 the original database that match the additional criterion.
1059 It is also possible to perform a logical =and= on the virtual database. Use
1060 this if you want to select those entries that contain ``Jones'' in the
1061 =author= field and e.g. ``symbiotic hybernation'' in the =keyword= field. A
1062 logical =and= operation is done with the key =&=. (Note: this is the same key
1063 that is used to create a virtual database. In fact, you can also create a
1064 virtual database with =|=: when used in a normal database, =&= and =|= are
1065 equivalent. They are only different in virtual databases.)
1067 Both the =&= and =|= commands can be used with the negative prefix argument =M--=
1068 (or =C-u -=, which is identical). In this case, the search criterion is
1069 negated. That is, the negative prefix argument performs a logical =not=
1070 operation on the search criterion.
1072 That is, if you want to select all entries from a database that do *not*
1073 contain ``Jones'' in the =author= field, you can do this by typing =M-- &= and
1074 then filling out the relevant field and regexp. This prefix argument is
1075 available both in real and in virtual databases.
1077 There is another way of performing a logical =not= operation, which is only
1078 available in virtual databases: by pressing the key =~=, you invert the
1079 current filter. That is, if you have a virtual database with all the
1080 entries containing ``Jones'' in the =author= or in the =editor= field, and you
1081 press =~=, the selection is inverted, and now contains all entries that do
1082 *not* have ``Jones'' in the =author= or =editor= field.
1084 Although =~= and the negative prefix argument to =&= or =|= both perform logical
1085 =not= operations, they are *not* equivalent: =~= negates the entire filter built
1086 up so far, while the negative prefix argument only negates the single
1087 selection criterion you enter with it.
1089 If you want to know what the filter for the current virtual database is
1090 exactly, you can type =V=. This command displays the current filter in the
1091 minibuffer. The filter is specified as a Lisp expression, meaning that the
1092 operators appear before their operands, not in between them. That is, =x and
1093 y= is written as =(and x y)=.
1095 With a prefix argument (any prefix argument will do), the command =V= not
1096 only displays the current filter, but also reapplies it. This can be useful
1097 when you've made changes to the source database: Ebib does not
1098 automatically update a virtual database when its source database is
1099 modified.
1102 *** Properties of Virtual Databases
1104 Virtual databases differ from normal databases in several ways. First, they
1105 cannot be modified: you cannot add or delete entries, and you cannot modify
1106 the contents of fields. It is also not possible to import entries to them
1107 or merge another file with them. Furthermore, it is not possible to export
1108 entries to them or from them.
1110 A virtual database cannot be saved in the normal way with =s=, and the
1111 command =S= to save all databases ignores virtual databases. If you want to
1112 save a virtual database, you can use the command =w=. This command not only
1113 saves the virtual database, it also changes it into a normal database, and
1114 detaches it from its original source database, so that you can modify it
1115 without affecting the source database.
1117 The command =L= also doesn't work with virtual databases. The reason for this
1118 is that the virtual database is not associated with an actual =.bib= file, so
1119 there is no file to create a list of references from. However, it is
1120 possible to use the command =P= with a virtual database to create a list of
1121 entries. See [[#printing-database][Printing the Database]], for details on these two commands.
1124 ** The Multiline Edit Buffer
1125 #multiline-edit-buffer
1127 As mentioned several times before, Ebib has a special multiline edit
1128 buffer, which is used to edit field values that contain newlines (so-called
1129 *multiline fields*), and also to edit the contents of the =@preamble=
1130 command. This section discusses the details of this buffer.
1132 Ebib enters multiline edit mode in one of three cases: when you press =P= in
1133 the index buffer, to edit the =@preamble= definition, when you hit =l= in the
1134 entry buffer to edit the current field as multiline, or when you hit =e= on
1135 the =annote= field, or on a field whose value already is multiline.
1137 The multiline edit buffer uses a special major mode,
1138 =ebib-multiline-edit-mode=, which is derived from =text-mode=. The changes with
1139 respect to =text-mode= are minor (see below), which means that any
1140 customisations you may have made to =text-mode= will be available in the
1141 multiline edit buffer.
1143 The settings that are specific for =ebib-multiline-edit-mode= are the
1144 functions assigned to the key sequences =C-x b=, =C-x k= and =C-x C-s=. These key
1145 sequences do not have their usual functions, but rather are redefined to
1146 fit Ebib. Both =C-x b= and =C-x k= can be used to leave the multiline edit
1147 buffer. =C-x b= will store the text as it is to the database, while =C-x k=
1148 will leave the multiline edit buffer *without* storing the text, i.e., the
1149 original value of the field or preamble that you were editing will be
1150 retained. If the text in the buffer was modified, =C-x k= will ask you if you
1151 really want to abandon your changes.
1153 If you leave the multitiline edit buffer with =C-x b= when the buffer is
1154 empty (i.e., you deleted all the text, including the final newline), and
1155 you were editing a field value or the =@preamble= definition, the field value
1156 or preamble will be deleted. (This is in fact the *only* way to delete the
1157 =@preamble= definition. Field values on the other hand can also be deleted by
1158 hitting =x= or =d= on them in the entry buffer.)
1160 The third command that is redefined in the multiline edit buffer is =C-x
1161 C-s=. This command can be used to save the database. Because Ebib does not
1162 do an autosave of the current database, it is advisable to save the
1163 database manually every now and then to prevent data-loss in case of
1164 crashes. It would be annoying to have to leave the multiline edit buffer
1165 every time you want to do this, so =C-x C-s= has been redefined to allow you
1166 to do this from within the buffer.
1169 * The Ebib Buffers
1170 #ebib-buffers
1172 This chapter lists all the key commands that exist in Ebib, with a short
1173 description and the actual command that they call. The latter information
1174 is needed if you want to customise Ebib's key bindings. (See
1175 [[#modifying-key-bindings][Modifying Key Bindings]].)
1179 ** The Index Buffer
1181   =Up= :: go to previous entry. =(ebib-prev-entry)=
1183   =Down= :: go to next entry. =(ebib-next-entry)=
1185   =Right= :: move to the next database. =(ebib-next-database)=
1186   
1187   =Left= :: move to the previous database. =(ebib-prev-database)=
1189   =PgUp= :: scroll the index buffer down. =(ebib-index-scroll-down)=
1191   =PgDn= :: scroll the index buffer up. =(ebib-index-scroll-up)=
1192   
1193   =Home= :: go to first entry. =(ebib-goto-first-entry)=
1195   =End= :: go to last entry. =(ebib-goto-last-entry)=
1197   =Return= :: make the entry under the cursor current. Use after e.g. =C-s=.
1198 =(ebib-select-entry)=
1199   
1200   =Space= :: equivalent to =PgDn=.
1201   
1202   =1-9= :: jump to the corresponding database.
1204   =/= :: search the database. =(ebib-search)=
1205   
1206   =&= :: Create a virtual database, or perform a logical =and= on the current
1207 virtual database. With negative prefix argument: apply a logical =not= to the
1208 selectional criterion. =(ebib-virtual-db-and)=
1210   =|= :: Create a virtual database, or perform a logical =or= on the current
1211 virtual database. With negative prefix argument: apply a logical =not= to the
1212 selectional criterion. =(ebib-virtual-db-or)=
1214   =~= :: Perform a logical =not= on the current virtual
1215 database. =(ebib-virtual-db-not)=
1217   =a= :: add an entry. =(ebib-add-entry)=
1219   =b= :: equivalent to =Pgup=.
1221   =c= :: close the database. =(ebib-close-database)=
1222   
1223   =C= :: customise Ebib. =(ebib-customize)=
1225   =d= :: delete the current entry. =(ebib-delete-entry)=
1227   =; d= :: delete all marked entries.
1229   =e= :: edit the current entry. =(ebib-edit-entry)=
1230   
1231   =E= :: edit the key of the current entry. =(ebib-edit-keyname)=
1233   =f= :: display the full filename of the current database in the minibuffer.
1234 =(ebib-print-file-name)=
1236   =F= :: follow =crossref=. =(ebib-follow-crossref)=
1238   =g= :: equivalent to =Home=.
1240   =G= :: equivalent to =End=.
1242   =h= :: show help for the index buffer. =(ebib-index-help)=
1244   =H= :: show/hide hidden fields. =(ebib-toggle-hidden)=
1246   =j= :: equivalent to =Down=.
1248   =J= :: jump to another database. This accepts a numeric prefix argument,
1249 but will ask you for a database number if there is
1250 none. =(ebib-switch-to-database)=
1252   =k= :: equivalent to =Up=.
1254   =l= :: show the log buffer. (=ebib-show-log=)
1256   =L= :: create a LaTeX file from the current database that produces a list
1257 of references formatted by BibTeX. =(ebib-latex-database)=
1259   =; L= :: create a LaTeX file with the marked entries only.
1261   =m= :: mark (or unmark) the current entry. =(ebib-mark-entry)=
1263   =; m= :: unmark all marked entries.
1265   =M= :: merge a =.bib= file. =(ebib-merge-bibtex-file)=
1266   
1267   =n= :: find next occurrence of the search string. =(ebib-search-next)=
1269   =C-n= :: equivalent to =Down=.
1271   =M-n= :: equivalent to =PgDn=.
1272   
1273   =o= :: open a =.bib= file. =(ebib-load-bibtex-file)=
1275   =p= :: push an entry to a LaTeX buffer =(ebib-push-entry-key)=
1277   =; p= :: push the marked entries to a LaTeX buffer.
1279   =C-p= :: equivalent to =Up=.
1281   =M-p= :: equivalent to =PgUp=.
1283   =P= :: create a LaTeX file for printing the database, listing the entire
1284 contents of each entry. =(ebib-print-database)=
1286   =; P= :: create a LaTeX file with the marked entries.
1288   =r= :: show and edit the =@preamble= definition in the
1289 database. =(ebib-edit-preamble)=
1291   =q= :: quit Ebib. This sets all variables to nil, unloads the database(s)
1292 and quits Ebib. =(ebib-quit)=
1294   =s= :: save the database. =(ebib-save-current-database)=
1296   =S= :: save all modified databases. =(ebib-save-all-databases)=
1298   =t= :: show and edit the =@string= definitions in the
1299 database. =(ebib-edit-strings)=
1301   =u= :: extract a URL from the =url= field and send it to a browser. With
1302 numeric prefix argument, extract the *n*th url.
1304   =V= :: Display the filter of the current virtual database in the
1305 minibuffer. With prefix argument: reapply the filter. =(ebib-print-filter)=
1307   =w= :: write the database to a different file. =(ebib-write-database)=
1309   =x= :: export the current entry to a file, or, when used with numeric
1310 prefix argument, to another database. =(ebib-export-entry)=
1312   =; x= :: export the marked entries to a file, or, when used with a numeric
1313 prefix argument, to another database.
1315   =C-x b= :: equivalent to =z=.
1317   =C-x k= :: equivalent to =q=.
1319   =X= :: export the =@preamble= definition to a file or, when used with a
1320 numeric prefix argument, to another database. =(ebib-export-preamble)=
1322   =z= :: lower Ebib. =(ebib-lower)=
1325 ** The Entry Buffer
1327   =Up= :: go to the previous field. =(ebib-prev-field)=
1329   =Down= :: go to the next field. =(ebib-next-field)=
1331   =PgUp= :: go to the previous set of fields. =(ebib-goto-prev-set)=
1333   =PgDn= :: go to the next set of fields. =(ebib-goto-next-set)=
1334   
1335   =Home= :: go to the first field. =(ebib-goto-first-field)=
1336   
1337   =End= :: go to the last field. =(ebib-goto-last-field)=
1339   =Space= :: equivalent to =PgDn=.
1341   =b= :: equivalent to =PgUp=.
1343   =c= :: copy the contents of the current field to the kill
1344 ring. =(ebib-copy-field-contents)=
1346   =d= :: delete the value of the current field. The deleted contents will *not*
1347 be put in the kill ring, and is therefore irretrievably
1348 lost. =(ebib-delete-field-contents)=
1349   
1350   =e= :: edit the current field. =(ebib-edit-fields)=
1352   =g= :: equivalent to =Home=.
1353   
1354   =G= :: equivalent to =End=.
1356   =h= :: show help for the entry buffer. =(ebib-entry-help)=
1358   =j= :: go to the next field. =(ebib-next-field)=
1360   =k= :: go to the previous field. =(ebib-prev-field)=
1362   =l= :: edit the current field as multiline. =(ebib-edit-multiline-field)=
1364   =C-n= :: equivalent to =Down=.
1366   =M-n= :: equivalent to =PgDn=.
1367   
1368   =C-p= :: equivalent to =Up=.
1370   =M-p= :: equivalent to =PgUp=.
1372   =q= :: quit editing the current entry and return focus to the index
1373 buffer. =(ebib-quit-entry-buffer)=
1375   =r= :: toggle a field's ``raw'' status. =(ebib-toggle-raw)=
1376   
1377   =s= :: insert an abbreviation from the =@string= definitions in the
1378 database. =(ebib-insert-abbreviation)=
1380   =u= :: extract a URL from the current field and send it to a browser. With
1381 numeric prefix argument, extract the *n*th url.
1383   =x= :: cut the contents of the current field. Like =c=, =x= puts the contents
1384 of the current field in the kill ring. =(ebib-cut-field-contents)=
1386   =y= :: yank the last element in the kill ring to the current
1387 field. Repeated use of =y= functions like =C-y/M-y=. Note that no text will be
1388 yanked if the field already has a value. =(ebib-yank-field-contents)=
1391 ** The Strings Buffer
1393   =Up= :: go to the previous string. =(ebib-prev-string)=
1395   =Down= :: go to the next string. =(ebib-next-string)=
1397   =PgUp= :: go ten strings up. =(ebib-strings-page-up)=
1399   =PgDn= :: go ten strings down. =(ebib-strings-page-down)=
1401   =Home= :: go to the first string. =(ebib-goto-first-string)=
1402   
1403   =End= :: go to the last string. =(ebib-goto-last-string)=
1405   =Space= :: equivalent to =PgDn=.
1407   =a= :: add a new =@string= definition. =(ebib-add-string)=
1409   =b= :: equivalent to =PgUp=.
1411   =c= :: copy the text of the current string to the kill
1412 ring. =(ebib-copy-string-contents)=
1413   
1414   =d= :: delete the current =@string= definition from the database. You will be
1415 asked for confirmation. =(ebib-delete-string)=
1416   
1417   =e= :: edit the value of the current string. =(ebib-edit-string)=
1419   =g= :: equivalent to =Home=.
1420   
1421   =G= :: equivalent to =End=.
1423   =h= :: show help for the strings buffer. =(ebib-strings-help)=
1425   =j= :: equivalent to =Down=.
1427   =k= :: equivalent to =Up=.
1429   =l= :: edit the value of the current string as
1430 multiline. =(ebib-edit-multiline-string)=
1432   =C-n= :: equivalent to =Down=.
1434   =M-n= :: equivalent to =PgDn=.
1436   =C-p= :: equivalent to =Up=.
1438   =M-p=  :: equivalent to =PgUp=.
1440   =q= :: quit the strings buffer and return focus to the index
1441 buffer. =(ebib-quit-strings-buffer)=
1443   =x= :: export the current =@string= definition to a file or, when used with a
1444 prefix argument, to another database. =(ebib-export-string)=
1445   
1446   =X= :: export all the =@string= definitions to a file or, when used with a
1447 prefix argument, to another database. =(ebib-export-all-strings)=
1450 * Customisation
1451 #customisation
1453 Ebib can be customised through Emacs' standard customisation interface. The
1454 only thing that cannot be customised in this way are the key bindings. If
1455 you wish to customise those, you have to use the file =~/.ebibrc=.
1458 ** The Customisation Buffer
1459 #customisation-buffer
1461 Ebib's customisation group is a subgroup of the =Tex= group. It can be
1462 invoked by typing =M-x customize-group RET ebib RET=}, or by pressing =C= in
1463 the index buffer. This chapter gives a short description of all the options
1464 available in the customisation buffer.
1467 *** Default Type
1469 The default type is the default entry type given to a new entry. Every
1470 entry in the Ebib database must have a type, because the type defines which
1471 fields are available. When a new entry is created, Ebib gives it a default
1472 type, which can be customised through this option. The standard value is
1473 =article=.
1476 *** Preload Bib Files
1477 #preload-bib-files
1479 This option allows you to specify which file(s) Ebib is to load when it
1480 starts up. Specify one file per line, press the =INS= button to add more
1481 files. You can complete a partial filename with =M-TAB=.
1484 *** Additional Fields
1485 #additional-fields
1487 The additional fields are those fields that are available for all entry
1488 types, and which BibTeX generally ignores. This option allows you to
1489 specify which additional fields you wish to use in your database. Specify
1490 one field per line, press the =INS= button to add more fields.
1492 By default, the following additional fields are defined: =crossref=, =url=,
1493 =annote=, =abstract=, =keywords= and =timestamp=.
1496 *** Index Window Size
1498 This option lets you specify the size of the index window at the top of the
1499 Ebib screen. The default value is 10.
1502 *** Insertion Strings
1503 #insertion-strings
1505 With the command =ebib-insert-bibtex-key= or with the command key =p= in the
1506 index buffer, you can insert a BibTeX key into a LaTeX buffer. This option
1507 allows you to customise the string that Ebib inserts in the buffer.
1509 In fact, it is possible to define multiple strings. Each string must be
1510 numbered: this number provides a way to identify the string that you want
1511 to use. You can select the desired string by calling =ebib-insert-bibtex-key=
1512 or by hitting =p= with a numeric prefix argument corresponding to the string.
1514 Each string *must* contain a =%s= directive, which is replaced with the BibTeX
1515 key. For example, it is possible to define the following:
1517 <example>
1518 0:  {%s}
1519 1:  \cite{%s}
1520 2:  \nocite{%s}
1521 </example>
1523 With this, typing =M-2 M-x ebib-insert-bibtex-key=, followed by a BibTeX key
1524 inserts the command <verb>\nocite{<key>}</verb> into the current
1525 buffer. Similarly, typing =M-2 p= in the index buffer inserts the current key
1526 into the buffer you choose. (Note that the prefix argument also works when
1527 you have bound =ebib-insert-bibtex-key= to a key sequence. That is, if you
1528 have bound it to say =C-c b=, typing =M-2 C-c b= inserts the second string.)
1530 Even if you have specified multiple strings, you can still use
1531 =ebib-insert-bibtex-key= or hit =p= without prefix argument. In that case, ebib
1532 just inserts string number 1. Note that if you define only one custom
1533 string, it still needs to be numbered. Give it number 1, so that you can
1534 enter it without prefix argument.
1536 The default value of this option is =((0 . "%s") (1 . "\cite{%s}"))=. With
1537 this setting, both =ebib-insert-bibtex-key= and =p= insert the key with the
1538 LaTeX command <verb>\cite</verb> by default, and they can furthemore be
1539 used with a prefix argument =0= (i.e. =M-0 ebib-insert-bibtex-key= or =M-0 p=) to
1540 insert just the bare key, without a <verb>\cite</verb> command.
1543 *** Sort Order
1545 The use of this option is explained above, see [[#sorting-bib-file][Sorting the .bib file]]. To
1546 create a sort order, click the =INS= button to create a sort level, and then
1547 click the =INS= button under that sort level to enter a sort field. If you
1548 want to add more than one sort field to the sort level, simply hit =INS=
1549 again.
1552 *** Save Xrefs First
1553 #save-xrefs-first
1555 For cross-referencing to work, the cross-referencing entries must appear in
1556 the =.bib= file *before* the cross-referenced entries. In order to tell Ebib to
1557 save all entries with a =crossref= field first, you must set the option =Save
1558 Xrefs First= in Ebib's customisation buffer. With this option set, BibTeX's
1559 crossreferencing options work as intended.
1561 By default, this option is unset, because it slows down saving the =.bib=
1562 file somewhat. (Actually, i don't think the difference is noticeable,
1563 unless you explicitly time it, but still.)
1566 *** Crossref Face
1567 #crossref-face
1569 Field values inherited from a cross-referenced entry are marked with this
1570 face. By default, the face has red as foreground colour.
1573 *** Marked Face
1574 #marked-face
1576 When entries are marked (with =m=), they are highlighted in this face. By
1577 default, GNU Emacs uses the text property =highlight=. XEmacs only allows
1578 this on terminals, therefore it displays marked entries with a red
1579 background and a white foreground colour. This option allows you to change
1580 these defaults.
1583 *** Use Timestamp
1585 If this option is set, Ebib will add a =timestamp= field to every new entry,
1586 recording the date and time it was added to the database. See [[#timestamps][Timestamps]].
1589 *** Timestamp Format
1591 This option specifies the format string that is used to create the
1592 timestamp. The format string is used by =format-time-string= to create a time
1593 representation. The default value is ="%a %b %e %T %Y"=, which produces a
1594 timestamp of the form ="Mon Mar 12 01:03:26 2007"=. See the documentation for
1595 =format-time-string= for the forms that the format string can take.
1598 *** Standard Url Field
1599 #standard-url-field
1601 This is the field that Ebib searches for URLs if you press =u= in the index
1602 buffer. Its default value is =url=.
1605 *** Url Regexp
1606 #url-regexp
1608 This is the regular expression that Ebib uses to search for URLs in a
1609 field. The default value is:
1611 <example>
1612 \\url{\(.*\)}\|https?://[^ '<>\"\n\t\f\l]+
1613 </example>
1615 With this regular expression, Ebib considers everything that is in a LaTeX
1616 <verb>\url{...}</verb> command as a URL, and furthermore every string of
1617 text that starts with =http://= or =https://= and does not contain whitespace
1618 or one of the characters =' " <= or =>=.
1621 *** Browser Command
1622 #browser-command
1624 If this option is unset (which is the default), Ebib uses the Emacs
1625 function =browse-url= to start a browser. If this function does not exist,
1626 you can set this option. For example, if you use the Firefox browser, set
1627 this option to =firefox=.
1629 For this to work, the browser that you use must be able to handle a URL on
1630 the command line.
1633 *** Print Preamble
1635 This option specifies the preamble that is to be added to the LaTeX file
1636 Ebib creates for printing the database (i.e., the =P= command). By default,
1637 the preamble is empty. You can set your own <verb>\usepackage</verb>
1638 commands, or anything else you may need.
1641 *** Print Multiline
1643 When this options is set, Ebib includes multiline field values when it
1644 creates a LaTeX file with =P= (=ebib-print-database=). When unset, multiline
1645 values are excluded, which saves space. By default, this option is unset.
1648 *** Latex Preamble
1650 This option specifies the preamble to be added to the LaTeX file for
1651 creating a list of references from the database (i.e., the =L= command). By
1652 default, the line <verb>\bibliographystyle{plain}</verb> is put in the
1653 preamble, but you may want to specify your own BibTeX packages and options.
1656 *** Print Tempfile
1658 This option specifies the name and location of the temporary file Ebib
1659 creates with the commands =ebib-print-database= and
1660 =ebib-latex-database=. By default, this option has no value,
1661 which means that Ebib will ask for a filename each time either of these
1662 commands is called.
1665 *** Allow Identical Fields
1666 #allow-identical-fields
1668 If this option is set, Ebib stores the values of multiple occurrences of a
1669 single field within an entry in a single occurrence of that field,
1670 separated by semicolons. By default, this option is unset, because it slows
1671 down the loading of =.bib= files. See [[#multiple-identical-fields][Multiple Identical Fields]].
1674 *** Entry Types
1675 #entry-types
1677 This option allows you to customise the entry types that Ebib uses. Each
1678 entry type has a name, a set of obligatory fields and a set of optional
1679 fields. You can add, alter or delete single fields in an entry type, or
1680 whole entry types.
1682 If you want to add an entry type, hit the =INS= key on the top level and give
1683 the new entry a name, then add obligatory and/or optional fields. It is not
1684 necessary that an entry type has both obligatory and optional fields, you
1685 can define an entry that has only obligatory or only optional fields.
1688 ** Modifying Key Bindings
1689 #modifying-key-bindings
1691 If you are unhappy about Ebib's standard key bindings, you can change them
1692 to anything you like. To do this, you have to create a file =~/.ebibrc= and
1693 write your preferred key bindings in it. A key binding definition is built
1694 up as follows:
1696 <example>
1697 (ebib-key <buffer> <key> <command>)
1698 </example>
1700 =<buffer>= is either =index=, =entry= or =strings=, for the corresponding
1701 buffer. =<key>= is a standard Emacs key description, and =<command>= is the
1702 Ebib command to be associated with the key. The commands that can be used
1703 here are listed in [[#ebib-buffers][The Ebib Buffers]]. Note that it is possible to bind more
1704 than one key to a single function: just add as many =ebib-key= statements as
1705 necessary.
1707 As an example, the following binds =C-s= to =ebib-search= in the index buffer,
1708 so that the database can be searched with =C-s= as well as with =/=:
1710 <example>
1711 (ebib-key index "\C-s" ebib-search)
1712 </example>
1714 If you want to unbind a key, you can simply leave out =<command>=. So if you
1715 want to bind the command =ebib-delete-entry= to =D= rather than =d=, you need to
1716 put the following in =.ebibrc=:
1718 <example>
1719 (ebib-key index "D" ebib-delete-entry)
1720 (ebib-key index "d")
1721 </example>
1723 The first line binds =D= to the command =ebib-delete-entry=. The second line
1724 unbinds =d=.
1726 If a command can be called with a prefix key (as for example
1727 =ebib-delete-entry= can), =ebib-key= will automatically rebind the prefixed
1728 version as well. So in the example above, the first line not only binds =D=,
1729 it also binds =; D=. Similarly, the second line not only unbinds =d=, but also
1730 =; d=.
1732 It is also possible to redefine the prefix key itself. To do this, you must
1733 specify =mark-prefix= for =<buffer>=. The value of =<command>= is irrelevant
1734 here, so it can be left out:
1736 <example>
1737 (ebib-key mark-prefix ":")
1738 </example>
1740 This sets up =:= as the new prefix key. Doing this automatically unbinds the
1741 existing prefix key.
1743 </div>