5.4 Name formatting

Document: BTXHAK ["Designing BibTeX Styles" by Oren Patashnik]


next References
up 5 Bibliography-style hacking
gif 5.3 The built-in functions

5.4 Name formatting

What's in a name? Section 4 pretty much describes this. Each name consists of four parts: First, von, Last, and Jr; each consists of a list of name-tokens, and any list but Last's may be empty for a nonnull name. This subsection describes the format string you must supply to the built-in function format.name$.

Let's look at an example of a very long name. Suppose a database entry (de la Vallée Poussin n.d.) has the field

  author = "Charles Louis Xavier Joseph de la Vall{\'e}e Poussin"
and suppose you want this formatted ``last name comma initials''. If you use the format string
    "{vv~}{ll}{, jj}{, f}?"
will produce
    de~la Vall{\'e}e~Poussin, C.~L. X.~J?
as the formatted string.

Let's look at this example in detail. There are four brace-level 1 pieces to this format string, one for each part of a name. If the corresponding part of a name isn't present (the Jr part for this name), everything in that piece is ignored. Anything at brace-level 0 is output verbatim (the presumed typo `?' for this name is at brace-level 0), but you probably won't use this feature much.

Within each piece a double letter tells to use whole tokens, and a single letter, to abbreviate them (these letters must be at brace-level 1); everything else within the piece is used verbatim (well, almost everything - read on). The tie at the end of the von part (in {vv~}) is a discretionary tie - will output a tie at that point if it thinks there's a need for one; otherwise it will output a space. If you really, really, want a tie there, regardless of what thinks, use two of them (only one will be output); that is, use {vv~~}. A tie is discretionary only if it's the last character of the piece; anywhere else it's treated as an ordinary character.

puts default strings between tokens of a name part: For whole tokens it uses either a space or a tie, depending on which one it thinks is best, and for abbreviated tokens it uses a period followed by either a space or a tie. However it doesn't use this default string after the last token in a list; hence there's no period following the `J' for our example. You should have used

    "{vv~}{ll}{, jj}{, f.}"
to get to produce the same formatted string but with the question mark replaced by a period. Note that the period should go inside the First-name piece, rather than where the question mark was, in case a name has no First part.

If you want to override 's default between-token strings, you must explicitly specify a string. For example suppose you want a label to contain the first letter from each token in the von and Last parts, with no spaces; you should use the format string

    "{v{}}{l{}}"
so that will produce `dlVP' as the formatted string. You must give a string for each piece whose default you want overridden (the example here uses the null string for both pieces), and this string must immediately follow either the single or double letter for the piece. You may not have any other letters at brace-level 1 in the format string.

Document: BTXHAK ["Designing BibTeX Styles" by Oren Patashnik]


next References
up 5 Bibliography-style hacking
gif 5.3 The built-in functions



WebMaster@eeng.dcu.ie
Wed May 15 11:28:03 GMT 1996