(Converted to HTML and slightly modified.)
However, to the best of my knowledge, there are still problems which are not satisfactorily handled by any existing programs:
First, Bibulus comes with a program which will convert old BibTeX databases to XML.
Second, data in XML is generally very easy to convert to another kind of XML, for instance by means of an XSLT script. Although no such scripts are included in the Bibulus module at the moment, it could easily be done if there was a need for them, for instance in order to use XML bibliographies conforming to other bibliographic DTDs with Bibulus.
\bibulus{citationstyle=numerical,
surname=comes-first,
givennames=initials,
blockpunctuation=.}
Of course, many more options are possible.
Entries can also be specified or modified within the LaTeX document. For instance, the following command will add a note with the text "Great!" to the entry called sample.
\bibulusadd{sample}{note}{Great!}
The name was given in the hope that the program will be fond of "drinking" many books, and that it will rule together with the best typesetting systems (hopefully more happily than its ancient namesake).
> bib2xml xampl This is BibTeX, Version 0.99c (Web2C 7.3.1) The top-level auxiliary file: tmp6600.aux The style file: bib2xml.bst Database file #1: xampl.bib Odd edition number: Silver
It should be clear from the above that bib2xml calls BibTeX to do its job, thus ensuring it can parse all documents that BibTeX can. It produced one warning, since Bibulus assumes that editions can only be numbers, but xampl.bib contains a "silver edition".
The result of this is a file, xampl.xml, which conforms to the Bibulus DTD.
For instance, in the original file there is an entry which looks like this:
@PHDTHESIS{phdthesis-full,
author = "F. Phidias Phony-Baloney",
title = "Fighting Fire with Fire:
Festooning {F}rench Phrases",
school = "Fanstord University",
type = "{PhD} Dissertation",
address = "Department of French",
month = jun # "-" # aug,
year = 1988,
note = "This is a full PHDTHESIS entry",
}
In Bibulus XML, this has become:
<thesis id="phdthesis-full" type="phd">
<author>
<name gender="unknown"
nametype="familylast">
<given>F. Phidias</given>
<family>Phony-Baloney</family>
</name>
</author>
<title>Fighting fire with fire:
Festooning French
phrases</title>
<institution>Fanstord
University</institution>
<place>Department of French</place>
<year month="8">1988</year>
<note>This is a full
PHDTHESIS entry</note>
</thesis>
Some notes:
Let us regard a further example from the same file.
@ARTICLE{article-full,
author = {L[eslie] A. Aamport},
title = {The Gnats and Gnus Document
Preparation System},
journal = {\mbox{G-Animal's} Journal},
year = 1986,
volume = 41,
number = 7,
pages = "73+",
month = jul,
note = "This is a full ARTICLE entry",
}
This is transformed by bib2xml to the following:
<article id="article-full">
<crossref id="article-full-PART2"/>
<author>
<name gender="unknown"
nametype="familylast">
<given>L[eslie] A.</given>
<family>Aamport</family>
</name>
</author>
<title>The gnats and gnus document
preparation system</title>
<pages>73+</pages>
<note>This is a full ARTICLE
entry</note>
</article>
<magazine id="article-full-PART2">
<journal>G-Animal's Journal</journal>
<volume>41</volume>
<number>7</number>
<year month="7">1986</year>
</magazine>
Most of this is hardly surprising by now, except for the fact that the entry has been split into two. This does not affect the output since Bibulus (like BibTeX) will inline cross-references that are only used a limited number of times (specified by the user). This allows for a significant simplification of the DTD.
The same situation holds for validation, i.e., checking that an XML file conforms to the definitions in the DTD: There is no Bibulus validator, but many standard tools can be used, and it is highly recommended to validate Bibulus bibliographic databases in this way instead of relying on built-in error handling.
Without making any changes to the LaTeX document, one can then start to use bibulustex instead of bibtex. If a standard bibliography style is used (e.g., plain), this should produce equivalent output.
However, only a few bibliography styles are defined, so this is likely to be less than needed.
The default is a style close to BibTeX plain, so only options that differ need to be defined. For instance, if one wants alpha labels (first letters of the last name + last two digits of the year) instead of numerical labels and furthermore wants author names to be written in small caps, one can just write the following in the LaTeX document:
\bibulus{citationstyle=alpha,
namefont=sc}
It is also possible to create an alias for a title if one is not happy with its label in the XML file. For instance, if The TeXbook is stored with the ID knuth86, one might want to issue the following command:
\bibalias{knuth86}{texbook}
After this, citing knuth86 and texbook will
be fully equivalent.
my $bib = new Bibulus::LaTeX; $bib->procaux($filename); open (BBL, ">$filename.bbl") or die "Could not write $filename.bbl.\n"; print BBL $bib->getbib; close BBL;
If more functionality is needed, one can thus make a personalised version of bibulustex with extra functionality.
For instance, to output all years ab urbe condita (after the foundation of Rome), add the following after the first line:
$bib->whenparsing('year',
sub {
return $_[0] + 754;
});
Most of this is just Perl code. What matters is the following: The code within the sub is executed when a <year> is encountered; the contents of this XML chunk is passed to the sub in $_[0]; and, whatever the sub returns replaces the old contents of the chunk.
This is a very simple and silly example, but the possibilities are endless, especially as the full power of Perl is available.
Create a file called, say, myBibulus.pm and put the following into it:
package myBibulus;
use Bibulus::LaTeX;
our @ISA = qw(Bibulus::LaTeX);
sub newblock {
return "\par ";
}
Now replace the line
my $bib = new Bibulus::LaTeX;with
my $bib = new myBibulus;in your personalised version of bibulustex, and the bibliographies produced will now have the blocks separated by \par instead of \newblock.
Any internal Bibulus function can be overridden in this way.
For more information, please visit the project's website.
There are also two mailing lists, one for developers and one for users -- please consider joining one of them.
Bibulus still has a some way to go, but with the help of the user community, we can do it!