On this page:
define-bibtex-cite
define-bibtex-cite*
bibdb
path->bibdb
bibtex-parse
9.1.0.1

4 BibTeX Bibliographies🔗ℹ

 (require scriblib/bibtex) package: scribble-lib

This library supports parsing BibTeX .bib files.

We support the 14 BibTeX entry types documented in the LaTeX book (1986) Appendix B.2: article, book, booklet, conference, inbook, incollection, inproceedings, manual, mastersthesis, misc, phdthesis, proceedings, techreport, and unpublished.

We support all the required and optional fields documented in the LaTeX book, with the following known limitations so far:
  • We enclose the string parsed from field title in "(elem #:style (make-style #f '(exact-chars)) title)", which will directly include its text in the output. This will presumably do the Right Thing™ when using the LaTeX backend, but the wrong thing in the HTML backend.

  • Other fields are just parsed as strings, and may appear as source code rather than as formatted code in both the LaTeX and HTML backends.

  • We fail to process month.

  • We only support pages fields that have decimal numbers separated by one or more dashes.

  • We fail to process the type optional field of incollection.

  • We do not at this time support the non-standard but often seen fields isbn, issn, nor any other non-standard field except those described below.

In addition to the old standard entries, we support the often seen online and webpage entry types, for which we support the fields url, title, author. Additionally online has field urldate for the day the site was visited, whereas webpage instead has field lastchecked.

Also, for every entry type, we support the extra optional fields note, url, doi. But mind that the doi field currently overrides the url in scriblib/autobib.

We do support the @string feature defined in the format of BibTeX.

Changed in version 1.61 of package scribble-lib: Support all standard entry types plus online and webpage, all fields but month (or type for incollection), and support note, url, doi on all entry types.

syntax

(define-bibtex-cite bib-pth ~cite-id citet-id generate-bibliography-id
  option ...)
Expands into:
(begin
  (define-cite autobib-cite autobib-citet generate-bibliography-id
     option ...)
  (define-bibtex-cite* bib-pth
    autobib-cite autobib-citet
    ~cite-id citet-id))

syntax

(define-bibtex-cite* bib-pth autobib-cite autobib-citet
                     ~cite-id citet-id)
Parses bib-pth as a BibTeX database, and augments autobib-cite and autobib-citet into ~cite-id and citet-id functions so that rather than accepting bib? structures, they accept citation key strings.

Each string is broken along spaces into citations keys that are looked up in the BibTeX database and turned into bib? structures.

struct

(struct bibdb (raw bibs))

  raw : (hash/c string? (hash/c string? string?))
  bibs : (hash/c string? bib?)
Represents a BibTeX database. The raw hash table maps the labels in the file to hash tables of the attributes and their values. The bibs hash table maps the same labels to Scribble data-structures representing the same information.

procedure

(path->bibdb path)  bibdb?

  path : path-string?
Parses a path into a BibTeX database.

procedure

(bibtex-parse ip)  bibdb?

  ip : input-port?
Parses an input port into a BibTeX database.