1

I have been learning how to customize biblatex styles. Some examples:

\DeclareFieldFormat{titlecase}{\MakeSentenceCase*{#1}}
\DeclareDelimFormat[bib]{nametitledelim}{\addspace}

What I find confusing is that the first one does not require [bib] but the second one does? How do you figure which ones require the optional argument and which ones don't?

Is checking the definition of every delim format in biblatex.def the only way? Or there is some rhyme or reason behind which ones require an optional argument like [bib], [biblist], [textcite] and which ones do not?

2
  • 2
    Optional arguments are not required. And my first step to find out what arguments a command accept is to look into the documentation. Jan 21, 2023 at 0:29
  • Hint: If you have never read texdoc biblatex before, in "3.12.2 Context-sensitive Delimiters" it says: "If the optional comma-separated list of <contexts> is given, declare <name> only for those contexts." (p 129). Your question is really about metadata. Time spent with the manual is an investment, not a luxury loss.
    – Cicada
    Jan 21, 2023 at 5:20

1 Answer 1

3

While both \DeclareFieldFormat and \DeclareDelimFormat have optional arguments, their meaning is different. The optional argument for \DeclareFieldFormat is a list of entry types. For \DeclareDelimFormat it is a list of delimiter contexts.

The behaviour of field formats and delimiter formats with respect to the optional argument is analogous, though. In both cases (i.e. when a field format is used or when a context-sensitive delimiter is printed), the current entry type/context is established. If there is a type/context-specific definition for the current type/context, it is used. If there is no such type/context-specific definition, the generic definition (that is given via \DeclareFieldFormat or \DeclareDelimFormat without an optional argument) is used. Examples for \DeclareFieldFormat can be found in Remove Quotation Marks from Style. A longer discussion for \DeclareDelimFormat is in Change/clean biber citestyle and extend hyperref box.

So yes, generally when you want to redefine field formats and context-sensitive delimiters, it is good to look up their original definitions as that makes it easier to figure out how to redefine them.

(In the case of nametitledelim you could even find that info in the biblatex documentation. But generally you cannot rely on the manual documenting every style aspect.)


On a purely syntactical TeXnical level, neither line in your example requires the optional argument (if an argument is required it should be a mandatory argument). But the lines will behave differently depending on whether or not an optional argument is present and they will do different things.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .