Citation-label formatting

Currently, CSL assumes that citation-label is provided as flat text by the supplying client. For label citation styles, styles differ regarding their preferred citation label, however (e.g., see The main differences are whether to use 3 or 4 letters to define the label, whether to include a year, and how to handle disambiguation and items without authors.

Currently, citeproc-js has a hardcoded pattern: Aaaa00:AaAa00:AaAA00:AAAA00. Jursim has a preference to customize this pattern. Other clients could add similar preferences, but this seems like something that may best be handled by CSL rather than an ad-hoc solution determined by clients.

There was this discussion a while back when citeproc-js added its default format, but that discussion seemed to assume that citation-label referred to a BibTeX key, not a rendered citation label ala DIN 1505-2 or similar styles.

If this isn’t something we want to define in CSL, it seems like at least the processors might want to include a hook for generating or supplying citation-label, in the same way that citeproc-js does. @cormacrelf

If by client you mean processor, then I think I follow. The most obvious thing I can think of is a format string, not unlike formatting dates with “%Y” etc. Some more style guide requirements would help design one that can do them all.

citeproc-js uses the format Aaaa00:AaAa00:AaAA00:AAAA00

Is that a well-known format string that I’m just unfamiliar with? How does it work?

Sorry, it’s (Format for items with one author):(Formats for items with two authors):(Three authors):(Four or more authors). “A” indicates first letter of an author’s family name, “a” indicates subsequent letters of that author’s family name, “00” indicates the final two digits of the year. So “AaAa00” means “The first and second letter of each author’s name, followed by the last two digits of the date.”

Parsed and rendered. Generalises to more or fewer than the 1, 2, 3,or 4 names. No configuration API available for the processor yet, but that’s soon to change I think, and I would also be happy to make a feature flag for an attribute to configure it in CSL.

1 Like

There are at least a few variations on trigraph/label styles in use. I wonder whether it might be a good idea for CSL to provide a simple syntax for customizing them within a label style?

Seems like the only sane place would be here:

<style label-format="Aaaa00:AaAA00:...">

With this to activate it for now:

    <feature name="label-format" />

It strikes me that mine won’t interpret characters that aren’t A/a/0 as literals to get the space in ABC 00, etc. Maybe allow literal A/a/0 with a backslash. It will put a year-suffix on the end, not in the code linked there but a label is a “year” for that purpose. Do people want anything else? Maybe people want the actual citekeys that they use? Not sure I’d ever want that, also probably unlikely in the Zotero community as default is autogenerated only, but maybe people still writing BibTeX would. Maybe people want to pull the citation-label variable from the input references as an override. I have actually implemented that already, it rings a bell as being in the test suite. That’s all I can think of.

I would say that is this something that would probably be added as a new node type, like names, etc.

Just wondering what happened to this?

This is done schema/csl-citation-label-format.rnc at v1.1 · citation-style-language/schema · GitHub

1 Like