jjmccollum / context-sbl

Society of Biblical Literature (SBL) style files for ConTeXt
2 stars 0 forks source link

Add shorthands to abbreviations list #6

Closed jjmccollum closed 2 years ago

jjmccollum commented 2 years ago

Anytime a shorthand is cited for the first time, it should be added to the abbreviations list, with the printed abbreviation retaining its formatting (e.g., journal shorthands should be italicized, while series shorthands should not) and the listsubcite rendering assigned as the full form of the abbreviation (something like \abbreviation[\btxflush{shorthand}]{\texdefinition{btx:sbl:cite:shorthand}}{\textcite[listsubcite][\btxflush{shorthand}]} should work for this). This may also necessitate handling certain examples (e.g., PGM) differently, as no two entries should have the same shorthand.

jjmccollum commented 2 years ago

Okay, I have this working using the following lines:

% Setup abbreviation settings
\definesynonyms[abbreviation][abbreviations][\infull][\inshort] % we need the \inshort command to access abbreviations by their entry tag

...

% Shorthand citation setup
\startsetups btx:sbl:cite:shorthand
  \begingroup
  \def\currentbtxcategory{\btxfield{category}}
  \texdefinition{btx:sbl:short:shorthand}
  \endgroup
  \removeunwantedspaces
  \removepunctuation
\stopsetups

...

% Short citations setup
\startsetups btx:sbl:cite:short
  ...
  % If this entry has its own shorthand, then add it to the abbreviations list,
  % associated with the listsubcite alternative of its citation
  \texdefinition{btx:sbl:doifownfield} {shorthand} {
    % NB: Alternate abbreviation lists (e.g., a separate one for the bibliography, or individual ones for journals, series, books, etc.)
    % could be used based on user settings if we replace "abbreviation" below with the appropriate name
    \expanded{\definesynonym[yes][abbreviation][\currentbtxtag]{\textcite[alternative=shorthand,lefttext=,righttext=][\currentbtxtag]}{\textcite[alternative=listsubcite,lefttext=,righttext=][\currentbtxtag]}}
  }
  ...
\stopsetups

My steps in getting here are detailed in the "Short forms and abbreviations in bibliography" thread in the ConTeXt mailing list.

As I mention in the note above, this setup should allow for future configurability if users want to specify a separate abbreviations list for bibliographic shorthands.

Now I just have to implement some of the finer details of how this works. I would have expected each entry in the abbreviations list to contain a full citation alongside the shorthand, but it looks like biblatex-sbl includes both a full citation in the abbreviations list and a full citation in the bibliographic list. This seems redundant to me, but if it's the best practice followed by biblatex, then I can reproduce it.

I also noticed that biblatex-sbl intelligently detects when a shorthand abbreviates the names of the authors (e.g., for works like BDAG, BDB, and BDF; see §7.1) and when it abbreviates the title (which is what happens in most cases, but see §§7.2 and 7.3 for specific examples) and typesets it accordingly:

As far as I can tell, the only check it needs to make to detect this is whether the entry's shorthand field matches its shorttitle field. I should be able to reproduce this with a few more changes.

jjmccollum commented 2 years ago

All right, the latest push includes code supporting shorthand biblists! I've included the following default options to \definebtx[sbl:\s!cite] to allow for future customizability, but presently, they do nothing:

synonym=\v!abbreviation, % TODO: this can determine which synonyms set we will use for shorthands
synonyms=\v!abbreviations, % TODO: this can determine which synonyms set we will use for shorthands

I'll probably need help dealing with some expansion-related issues to make these options functional, but that can be the subject of a separate issue. With the basic functionality implemented, I consider this issue closed.