Manual

User Manual:

Open the PDF directly: View PDF PDF.
Page Count: 12

DownloadManual
Open PDF In BrowserView PDF
BibTeX2HTML

A translator of BibTeX bibliographies into HTML
Version 1.99  March 23, 2018
Jean-Christophe Filliâtre and Claude Marché

http://www.lri.fr/~filliatr/bibtex2html

Contents
1 Introduction

1

2 The bibtex2html command tool
2.1

2.2

1

Additional elds and automatic web links

. . . . . . . . . . . . . . . . . . . . . .

2

2.1.1

Abstracts

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

2

2.1.2

Keywords

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

2

Command line options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

2

2.2.1

General aspect of the HTML document

. . . . . . . . . . . . . . . . . . .

2

2.2.2

Controlling the translation . . . . . . . . . . . . . . . . . . . . . . . . . . .

4

2.2.3

Selecting the entries

4

2.2.4

Sorting the entries

2.2.5

Miscellaneous options

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . .

3 The bib2bib command line tool

5
5

6

3.1

Command line options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

6

3.2

Filter conditions

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

8

3.3

Examples

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

10

3.3.1

Selecting entries of a given year . . . . . . . . . . . . . . . . . . . . . . . .

10

3.3.2

Selecting references of a given author . . . . . . . . . . . . . . . . . . . . .

11

3.3.3

Other examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

11

Note on duplicates entries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

11

3.4

4 The aux2bib command line tool

11

5 Frequently Asked Questions

12

1

Introduction

BibTeX2HTML is a collection of tools for producing automatically HTML documents from
bibliographies written in the BibTeX format. It consists in three command line tools:

• bib2bib

is a lter tool that reads one or several bibliography les, lters the entries with

respect to a given criterion, and outputs the list of selected keys together with a new
bibliography le containing only the selected entries;

1

• bibtex2html

is a translator that reads a bibliography le and outputs two HTML doc-

uments that contains respectively the cited bibliography in a nice presentation, and the
original BibTeX le augmented with several transparent HTML links to allow easy navigation.

bibtex2html can handle any

BibTeX style le, including those producing multiple

bibliographies.

• aux2bib

reads a

A

.aux

le as produced by L TEX and writes to standard output a BibTeX

le containing exactly the BibTeX entries refereed in the

2

.aux

le.

The bibtex2html command tool

bibtex2html is a BibTeX to HTML translator. It is invocated as

bibtex2html

le.bib ]

[options] [

where the possible options are described below and where
le, which must have a

.bib

le.bib

is the name of the BibTeX

sux. If this le is not given, then entries are input from standard

input.
Then two HTML documents are created (unless option

-nobibsource is selected or input is

standard input, see below) :

• le.html

which is the bibliography in HTML format ;

• le_bib.html

bibtex

which contains all the entries in ASCII format.

is called on

le.bib

in order to produce the a LaTeX document, and then this LaTeX

document is translated into an HTML document. The BibTeX le

le.bib

is also parsed in order

to collect additional elds (abstract, url, ps, http, etc.) that will be used in the translation.
If input is standard input and option

--output is not given, the rst le is output to standard

output, and the second is not created.

2.1 Additional elds and automatic web links
bibtex2html

The main interest of

with respect to a traditional LaTeX to HTML translator is

the use of additional elds in the BibTeX database and the automatic insertion of web links.
A link is inserted:

•

at each cross-reference inside the bibliography entries;

•

when the

•

for each BibTeX eld whose name is "ftp", "http", "url", "ps" ,"dvi", "rtf", "pdf", "doc-

\url

LaTeX macro is used in the text;

umenturl", "urlps" or "urldvi". The name of this link depends on the nature of the link:




.dvi, .ps, .pdf, .rtf, .txt
.gz, .Z or .zip;

it is the le sux, whenever this sux is
possibly followed by a compression sux,
otherwise the name of the link is either

http

or

ftp

or

.html,

depending on the protocol.

You can insert web link for other elds and/or specify alternative names for the links using
the options

-f

and

-nf

(see below).

2

2.1.1 Abstracts
If a BibTeX entry contains a eld

abstract

then its contents is quoted right after the bibliog-

raphy entry .
This behavior may be suppressed with the option

--no-abstract.

If you want both versions with and without abstracts, use the option

--both.

In that case,

links named "Abstract" will be inserted from the page without abstracts to the page with
abstracts,

2.1.2 Keywords
If a BibTeX entry contains a eld

keywords then its contents is displayed after the bibliography

entry (and after the abstract if any).
This behavior may be suppressed with the option

--no-keywords.

2.2 Command line options
Most of the command line options have a short version of one character (e.g.
easy-to-remember/understand long version (e.g.

--reverse-sort).

-r)

and an

2.2.1 General aspect of the HTML document
-t

string, --title string
specify the title of the HTML le (default is the le name).

--header

string

give an additional header for the HTML document.

--footer

string

give an additional footer for the HTML document.

-s

string, --style string
use BibTeX style

string

(plain, alpha, etc.). Default style is plain.

-noabstract, --no-abstract
do not print the abstracts (if any).

-nokeywords, --no-keywords
do not print the keywords (if any).

-both, --both
produce both pages with and without abstracts. If the BibTeX le is foo.bib then the two
pages will be respectively foo.html and foo_abstracts.html (The sux may be dierent,
see option

--suffix).

Links are inserted from the page without abstracts to the page with

abstracts.

-nokeys, --no-keys
do not print the cite keys. Note: this option implicitly suppresses the use of HTML tables
to format the entries; to enforce the use of tables, use option
option

-nokeys

on the command line).

3

-use-table

(passing it

after

-use-keys, --use-keys
use the cite keys from the BibTeX input le (and not the ones generated by the BibTeX
style le).

-rawurl, --raw-url
print URLs instead of les' types.

-heveaurl, --hevea-url
interpret the macro

\url

as HeVeA's one, i.e. with two arguments, the rst one being the

url and the second one the text to print. The default behavior is to interpret the macro

\url
-f

as the one from the package

url,

which has only one argument (the url itself ).

eld, --field eld
add a web link for that BibTeX eld.

-nf

eld string, --named-field eld string
-f
Springer's").
similar

-note

to

but

species

the

way

to

display

the

link

(e.g.

-nf springer "At

eld, --note eld

declare that a eld must be treated like the

abstract

eld, i.e. is an annotation to be

displayed as a text paragraph below the entry.

-multiple, --multiple
make a separate web page for each entry.

les as BibTeX entries!

Beware: this option produces as many HTML

-single, --single
produce a single document, inserting each BibTeX entry (the input) right after its BibTeX
output

-bg

color, --background color
set the background color of the HTML le (default is none).

-css

le, --style-sheet le
set a style sheet le for the HTML document (default is none).

-dl, --dl
use HTML

DL

lists instead of HTML tables to format entries.

-unicode, --unicode
use Unicode entities for the following macros :

\models \curlyvee \curlywedge \bigcirc \varepsilon
\not{\models}
-html-entities, --html-entities
use HTML entities for the following macros :

4

\= \Im \Leftarrow \Re \Rightarrow \aleph \ang \angle \approx
\ast \cdot \cdots \cong \copyright \cup \dagger \diamond \emptyset
\equiv \exists \forall \ge \geq \in \infty \int \land \lang
\lceil \le \leftarrow \leftrightarrow \leq \lfloor \longleftarrow
\longrightarrow \lor \lozenge \nabla \ne \neg \neq \ni \notin
\oplus \otimes \partial \perp \pm \prod \propto \rang \rceil
\rfloor \rightarrow \sim \simeq \sqrt \subset \subseteq
\sum \supset \supseteq \therefore \times \tm \to \vartheta
\vee \wedge \wp

2.2.2 Controlling the translation
-m

le, --macros-from le
A

read the L TEX macros in the given le.

Note:

bibtex2html

does not handle macros

arguments; arguments are simply discarded.

-noexpand --no-expand
do not expand the abbreviation strings, leave them in the output le.

2.2.3 Selecting the entries
-citefile

lename, --citefile lename

Select only keys appearing in

bib2bib.
-e

lename.

To be used manually or in conjonction with

key, --exclude key
exclude an particular entry.

2.2.4 Sorting the entries
-d, --sort-by-date
sort by date.

-a, --sort-as-bibtex
sort as BibTeX (usually by author).

-u, --unsorted
unsorted i.e. same order as in .bib le (default).

-r, --reverse-sort
reverse the sort.

--revkeys
number entries in reverse order (i.e. from

n

5

to 1 in plain style).

2.2.5 Miscellaneous options
-nodoc, --nodoc
do not produce a full HTML document but only its body (useful to merge the HTML
bibliography in a bigger HTML document).

-nobibsource, --nobibsource
do not produce the

_bib.html

le. In that case, no BibTeX entry link are inserted in

the HTML le.

-suffix

string, --suffix string

give an alternate sux

-fsuffix

string
string

for HTML les (default is

.html).

for HTML links (default is

.html).

le, --output le
species the output le. If

-c

.html).

string, --link-suffix string

give an alternate sux

-o

for both HTML les and links (default is

string, --file-suffix string

give an alternate sux

-lsuffix

string

le

is

-,

then the standard output is selected.

command, --command command
specify the BibTeX command (default is

bibtex -min-crossrefs=1000).
bibtex command.

May be useful

for example if you need to specify the full path of the

--print-keys
print the BibTeX entries on the standard output (one per line), as selected and sorted

bibtex2html. This is useful if
bibtex2html in another program.
by

you want to use the selection and sorting facilities of
Note: you may need to set also the

-q

option (quiet)

to suppress the usual output.

-i, --ignore-errors
ignore BibTeX errors.

-q, --quiet
be quiet.

-w, --warn-error
stop at the rst warning.

-h, --help
print a short usage and exit.

-v, --version
print the version and exit.

-noheader, --no-header
do not insert the

bibtex2html

command in the HTML document (default is to insert it

as a comment at the beginning).

6

3

The bib2bib command line tool

bib2bib

is a tool for extracting some entries from a list of bibliography les. It is invocated as

bib2bib

[options]

le1.bib · · · len.bib

where the possible options are described below and where
the BibTeX les, which must have a

.bib

le1.bib · · · len.bib

are the names of

sux. If no les at all are given on the command line,

then input is taken from standard input.
The options allow to specify a lter condition to test against each references read from bib
les. The result will be a new BibTeX le containing all the entries of the input les that satisfy
the condition. Notice that this output le contains all the necessary informations: each string
and each cross-reference needed will be also in that le.
Additionally,

bib2bib

may output a le containing all the keys of entries that satisfy the

condition. This second le is suitable for input as option

-citefile

to

bibtex2html.

3.1 Command line options
-c condition
specify a condition for selecting the entries. The output will retain only the entries that
satisfy this condition. If several such condition are given, then only the entries that satisfy
all the conditions are selected.

The syntax of conditions is given below, notice that it

is better to escape shell expansions in that conditions, in other words, you should write
conditions between quotes.

-ob

lename
specify the lename where the selected entries are output.

If not given, it defaults to

standard output.

-oc

lename
specify the lename where the list of selected keys is output. If not given, this le is not
created.
Notice that the two output les above are suitable for use with bibtex2html. A typical use
would be

bib2bib -oc citef ile -ob bibf ile.bib -c condition file1.bib file2.bib ...
bibtex2html -citefile citef ile bibfile.bib
which will produce exactly the HTML le for the selected references.

--expand
expand all abbreviations in the output le.

--expand-xrefs
expand all crossrefs in the output le. Notice that the meaning of such an expansion is not
completely obvious: it's better to let bibtex (via bibtex2html) handle the cross-references
itself, depending on the style considered.
Notice that

-noexpand

bibtex2html

itself will expand the strings (by default, unless you specify the

option) but not the cross-references.

7

--no-comment
prevent generation of extra comments at beginning of output bib le.

--remove

f
f

remove all occurrences of eld . This option can be used several times to remove several
elds.

--rename

f1 f2

rename all occurrences of eld

f1

into

f2.

This option can be used several times to rename

several elds. Beware that if an entry already has both elds
two elds

f1 and f2,

this will result in

f2, and BibTeX styles usually take only the rst occurrence into account.

Example:

bib2bib --remove abstract --remove copyright --rename x-pdf url bibf ile.bib
removes all

-s

abstract

and

copyright

elds and rename all

x-pdf

elds into name

url.

f
sorts the entries of the bibliography with respect to the given eld

f,

which may also be

$key or $type to refer to the key or to the entry type, as for lter conditions. It may
be $date, to ask for sorting from oldest to newest, as for option -d of bibtex2html.

also

This option may be used several times to specify a lexicographic order, such as by author,
then by type, then by date:

bib2bib -s 'author' -s '$type' -s '$date' bibf ile.bib
When sorting, the resulting bibliography will always contains the comments rst, then the
preambles, then the abbreviations, and nally the regular entries. Be warned that such a
sort may put cross-references before entries that refer to them, so be cautious.

-r
reverses the sort order.

-q, --quiet
be quiet.

-w, --warn-error
stop at the rst warning.

--php-output

le

outputs the bib le as a two-dimensional array in PHP syntax, in

le.

3.2 Filter conditions
A lter condition is a boolean expression that is evaluated against a BibTeX entry to decide
whether this entry should be selected. A condition is either:

comparison

expressions, written as e1 op e2

•

a

•

a matching of a eld name with respect to a

between two

8

;

regular expression, written as f ield : regexp ;

•

a conjunction of two conditions, written as

•

a disjunction of two conditions, written as

•

a negation of a condition, written as

•

a test of existence of a eld, written as

not c

c1 and c2
c1 or c2
(or

! c)

exists f

(or

(or

c1 & c2 )

;

c1 | c2 );

;

(or

? f)

where

f

is a eld name ;

where an expression is either:

•

a string constant, written either between double quotes or single quotes ;

•

an integer constant ;

•

a eld name ;

•

the special ident

$key

the special ident

$type

•

which corresponds to the key of an entry.
which corresponds to the type of an entry (ARTICLE, INPRO-

CEEDINGS, etc.). Notice that an entry type is always written in uppercase letters.
Comparison operators are the usual ones:

=, <, >, <=, >=

and

<>.

The eld names are any sequences of lowercase or uppercase letters (but no distinction is
made between lowercase and uppercase letters).
Be careful when writing conditions in a shell command: the shell must not interpret anything
in a condition, such as

$key.

So usually you need to put conditions inside quote characters that

forbid shell interpretation: single quotes under Unix shell, or double quotes under Microsoft
Windows shell.

This is why strings in conditions may be put indierently between single or

double quotes: you will use the ones which are not the ones you use to forbid shell interpretation.
In examples below, we will use Unix convention, so under Windows you have to permute the
use of single and double quotes.
Note that within

$$key

and

$$type

Makefiles

you have to escape the

$

character in

$key

or

$type

(using

instead, at least with GNU make).

Regular expressions must be put between single or double quotes, and must follow the GNU
syntax of regular expressions, as for example in GNU Emacs. Any character other than

$^.*+?[]

matches itself, see Table 1 for the meaning of the special characters.
Notice that if several conditions are given with option

-c

on the command line, then they

are understood as the conjunction of them, in other words

bib2bib -c 'c1 ' · · · -c 'cn '
is equivalent to

bib2bib -c 'c1 and · · · and cn '
Table 2 shows a formal grammar for conditions.

Remarks on evaluation of conditions
•

According to BibTeX conventions, entry types, keys and eld names have to be considered
case insensitive, that is no distinction is made between uppercase and lowercase letters.
Inside

bib2bib, these are always converted to uppercase, so you may take this into account

when writting conditions (see below).

9

.
[..]

matches any character except newline
character set; ranges are denoted with
initial

^
$
\r
\n
\t
\b
\ddd
\char
regexp*
regexp+
regexp?
regexp1 \| regexp2

^,

as in

[^0-9],

as in

[a-z];

an

complements the set

matches the beginning of the string matched
matches the end of the string matched
matches a carriage return
matches a linefeed
matches a tabulation
matches word boundaries

ddd in decimal
char among $^.*+?[]\

matches character with ASCII code
quotes special character
matches
matches
matches

regexp
regexp
regexp

zero, one or several times
one or several times
once or not at all

alternative between two regular expressions, this operator
has low priority against

\( regexp \)

-,

*, +

and

?

grouping regular expression

Table 1: Syntax of regular expressions

Cond → Cond and Cond | Cond or Cond | not Cond | exists Id
Cond → Cond & Cond | Cond | Cond | ! Cond | ? Id
| Expr Comp Expr | Expr:String | ( Cond )
Comp → = | > | < | >= | <= | <>
Expr → Id | String | Int | $key | $type
Id → [a − zA − Z]+
String → "([^"\] | \" | \\)∗ " | '([^'\] | \' | \\)∗ '
Integer → [0 − 9]+
Table 2: Syntax of conditions

•

On the other hand, case matters when comparing strings, or matching them against regular

title : "Computer" may return true if the title contains the
capital letter, whereas title : "computer" would return false.

expressions. For example,
word

•

Computer

with a

A consequence of the two previous remarks, is that if you want for example to check
equality of the entry type and a string value, put the value in uppercase, as for example

$type = "INPROCEEDINGS",
•

otherwise the condition would be always false.

When performing a comparison with an non-existent eld, the result is always false ;
beware that this means that for example

not (f = "value") and f <> "value" are not
f, the rst condition is true whereas the

equivalent: for an entry that does not have a eld
second is false.

•

As usual,
and

or

not

has higher priority than

and,

associate to the left.

10

which itself has higher priority than

or. and

•

Comparison using

>, <, >=

and

<=

may only be used between integer values. In any other

case, a warning is displayed and the result is false.

•

There is a special handling for strings containing LaTeX accented letters (or for backward compatibility, ISO-Latin1 accented characters): each variant of writing such letters
are considered the same, and equivalent to their HTML entity form, for example strings

"Filli\^atre", "Filli{\^a}tre", "Filli\^{a}tre" and "Filliâtre" are considered
identical and indeed equal to "Filliâtre". Note that when using such a string
as a regular expression, there is no need to escape the backslash, since interpretation of
LaTeX accenting commands is made before interpretation into a regexp.

Using HTML

entities for matching accented names is thus considered as the safest method.

3.3 Examples
Here are some examples to help you writing the lter conditions you are interested in.

3.3.1 Selecting entries of a given year
The following command reads input les

biblio1.bib and biblio2.bib, and select only entries

that appeared in 1999 :

bib2bib -oc cite1999 -ob 1999.bib -c 'year=1999' biblio1.bib biblio2.bib
The resulting le

cite1999

contains the list of keys selected. You can then produce the HTML

le by

bibtex2html -citefile cite1999 1999.bib
You may also select references appeared after and/or before a given year.

For example,

references after 1997:

bib2bib -oc citeaft1997 -ob aft1997.bib -c 'year>1997' biblio.bib
or between 1990 and 1995:

bib2bib -oc cite90-95 -ob 90-95.bib -c 'year>=1990 and year<=1995' biblio.bib

3.3.2 Selecting references of a given author
The following command reads input les

biblio.bib

and select only entries whose (co)author

is Donald Knuth:

bib2bib -oc knuth-citations -ob knuth.bib -c 'author : "Knuth"' biblio.bib
More complicated, if you would like to have only the references whose author is Knuth only, you
may try

bib2bib -oc knuth-citations -ob knuth.bib \
-c 'author : "^\(Donald \(E. \)?Knuth\|Knuth, Donald \(E.\)?\)$"' biblio.bib
or equivalently but missing the possible  E.:

bib2bib -oc knuth-citations -ob knuth.bib -c 'author = "Donald Knuth"
or author = "Knuth, Donald"' biblio.bib

11

3.3.3 Other examples
Any boolean combination of comparison and/or matching are possible. For example, the following command extract the references that appeared since 1995 and have lambda-calculus in their
title, with anything between lambda and calculus:

bib2bib -oc lambda -c 'year >= 1995 and title : "lambda.*calculus"' biblio.bib
for example, it will select a title containing

$\lambda$-calculus.

3.4 Note on duplicates entries
bib2bib

has the eect of merging several bib les into a single one. This process may result in

duplicate entries in the resulting les, which is considered as erroneous by
this is not really a bug of

bib2bib

bibtex.

Of course,

since it is of your own to take care not having entries with

the same key.
However, there are two particular cases when this occurs naturally: when two bib les share
common abbreviations, or when they share common cross-references.
In order to make

bib2bib

behaves correctly in such a case, it is designed as follows: for

repeated abbrevs, the rst abbrev is kept and the others are ignored, and for repeated regular
entries, the last entry is kept and the others are ignored. With this behaviour, everything works
well as soon as repeated abbrevs are really duplicate abbrevs of the same sentence, and repeated
keys are really duplicate entries.

4

The aux2bib command line tool

aux2bib is a tool extracting the BibTeX references from a .aux le (as produced by LATEX) and
building the corresponding BibTeX le. It is invocated as

aux2bib le.aux
The BibTeX le is written on the standard output.

5

Frequently Asked Questions
1.

How may I tell bibtex2html to expand cross-references?
By default, all entries of the input BibTeX le are translated into HTML, including crossreferences. Since the latter are there, bibtex will never expand them. If you want them to
be expanded, you have to tell bibtex2html that crossref entries need not be in the resulting
le. To do that you have to use the option

-citefile

to give the exact list of entries you

want to see. If a cross-reference is not in that list, then its elds will be expanded into
all entries that cross-refers to it. (Technically, this work because bibtex2html calls bibtex
with option
2.

-min-crossrefs=1000

by default.)

When running
bib2bib -oc knuth-citations -ob knuth.bib -c 'author : "Knuth"' biblio.bib

I get "Lexical error in condition: Unterminated string". What's going wrong?
You are probably running

bib2bib

under Microsoft Windows, hence you should permute

the use of single quotes and double quotes, as explained in Section 3.2:

bib2bib -oc knuth-citations -ob knuth.bib -c "author : 'Knuth'" biblio.bib
12



Source Exif Data:
File Type                       : PDF
File Type Extension             : pdf
MIME Type                       : application/pdf
PDF Version                     : 1.5
Linearized                      : No
Page Count                      : 12
Page Mode                       : UseOutlines
Author                          : 
Title                           : 
Subject                         : 
Creator                         : LaTeX with hyperref package
Producer                        : pdfTeX-1.40.17
Create Date                     : 2018:03:23 09:08:08+01:00
Modify Date                     : 2018:03:23 09:08:08+01:00
Trapped                         : False
PTEX Fullbanner                 : This is pdfTeX, Version 3.14159265-2.6-1.40.17 (TeX Live 2016/Debian) kpathsea version 6.2.2
EXIF Metadata provided by EXIF.tools

Navigation menu