# AUTHOR module – handling BibTeX authors

Author-string parsing and formatting

In BibTeX terms, an author string is the content of an `author` or `editor` field (or potentially other fields such as `translator` of course). That field consists of a sequence of names separated by the string `and`, where each name has one of the following structures:

- First Last (where `First` is a sequence of names).
- First von Last (where `von` is a particle such as `de`, or `von der`, etc).
- [von] Last, First (the `von` part is optional here).
- [von] Last, First, Jr (where `Jr` is a sequence of similar post-nominal clarifications).
- Last (a sole name is parsed as a ‘last name’, below).

Curly brackets override the parsing, so that `{Barnes and Noble, Inc}` and `Andreas {Thurn and Taxis}` are both single names, in the first case consisting of only a single ‘last’ name.

Beastie will parse such specifications, and make them available for processing. For fuller details, see standard BibTeX documentation, or consult the `btxdoc.pdf` file which is part of the BibTeX package on CTAN. Note that Beastie detects the `and` separator case-sensitively, as opposed to the BibTeX behaviour of matching it case-insensitively (which is bound to trip over someone surnamed ‘And’).

The name-formatting differs from BibTeX's in a couple of subtleties related to non-default inter-token separators when formatting peoples’ initials. There are some ambiguities in the BibTeX documentation which Beastie resolves in what seems like a sensible way, without necessarily deferring to ‘what bibtex-the-program does’ as a source of authority.

The `parse-author-list` function will take such an `and`-separated string, and produce a list of `author?` objects. You can pull apart the elements of this object with `author-first`, `author-last`, `author-von`, `author-junior`, or format it to a string using `format-name`.

## Functions

Index:

- author->list
- author-first
- author-junior
- author-last
- author-von
- author?
- format-name
- parse-author-list
- parse-fmtstring

### author->list

Show the contents of the author structure, for debugging

### author-first

`author-first : author? -> (listof ustring?)` : Returns the first names of the given author as a list of ustrings.

### author-junior

`author-junior : author? -> (listof ustring?)` : Returns the 'junior' components of the given author, as a list of ustrings.

### author-last

`author-last : author? -> (listof ustring?)` : Returns the last names of the given author, as a list of ustrings.

### author-von

`author-von : author? -> (listof ustring?)` : Returns the von-components of the given author, as a list of ustrings.

### author?

`author? : any -> boolean?` : Returns true if this is an author structure? An author structure contains a list of first names, surnames, von-particles and 'junior' particles, as described in the BibTeX documetnation.

See `parse-author-list`.

### format-name

`format-name : list? author? -> bstring?` : Format an author structure for display.

In `(format-name fmt name)`, `name` is an author structure. `fmt` is a list containing either strings or lists, such as

    '((von nbsp?) (last) (", " junior) (", " first/i) "?")

which corresponds to btxhak

    "{vv~}{ll}{, jj}{, f}?"

Strings 'format' to themselves, symbols format to a list of the elements of the corresponding name component.

The strings are copied to the output. The sub-lists contain either strings or symbols. The elements of the lists are separated by spaces, though this may be changed by including the keyword `sep` to indicate an alternative separator, thus `(first :sep ":")` would format a sequence of forenames as `Name1:Name2:...` if that were useful for some reason. When 'evaluating' the format sub-lists, the symbols are replaced with elements of the name, but if the name element is missing, then the list evaluates to #f, and is omitted from the result.

Note that this format specification permits eg `'((von last))`, with two format elements in an inner spec. This isn't countenanced by the .bst spec, and I'm not sure it makes sense.

Beastie respects the presence of ties – the tildes – in format specs, as described in the `btxhak.pdf` document. In there, we find that BibTeX will put in ties ‘if it thinks there’s a need for one’; Beastie respects that, but sometimes thinks differently.

The behaviour here is intended to closely match that of bibtex-the-program, while feeling free to make slightly different choices in certain edge-cases.

### parse-author-list

`parse-author-list string? -> (listof author?)` : parse a string to a list of `author?` objects

### parse-fmtstring

`parse-fmtstring : (or/c string? ustring?) -> list` : Parse a BibTeX-style name-formatting string.

The input string is that described in the BibTeX btxhak document. The format-spec is suitable for `format-name`.

This is primarily to service functions in bst.scm, but it is defined here because it might turn out that the BibTeX style syntax is a nicer way of creating format-strings than the one that format-name expects.

Note that the btxhak document is ambiguous about whether the brace-level-2 item is the last item in the spec or the first one after a `fvlj` token. The text suggests the latter, but the former also makes sense.

Norman
2026 August 02