dcpurton / biblatex-sbl

Society of Biblical Literature (SBL) style files for biblatex
24 stars 5 forks source link

Comma placed before (Location: Publisher, Year) block in beamer #112

Closed jjmccollum closed 3 years ago

jjmccollum commented 3 years ago

I noticed a quirk in the citation of books with biblatex-sbl in the beamer document class. Consider the following minimal (non-)working .tex file:

\documentclass{beamer}
%Add the bibliography source file:
\begin{filecontents*}{bibliography.bib}
@book{
        Swanson.Luke,
    editor = {Reuben J. Swanson},
        title = {New Testament Greek Manuscripts: Variant Readings Arranged in Horizontal Lines against Codex Vaticanus. Luke},
    shorttitle = {New Testament Greek Manuscripts, Luke},
        location = {Sheffield},
        publisher = {Sheffield Academic Press},
        year = {1995}
}
\end{filecontents*}
\usepackage[american]{babel}
%Include support for SBL citation format:
\usepackage[style=sbl, backend=biber]{biblatex}
\addbibresource{./bibliography.bib}
\begin{document}
    \cite{Swanson.Luke}
\end{document}

I'm typesetting this with the version of XeLaTeX from the TeXLive 2020 distribution, using the biber backend for biblatex. When I typeset the above MWE, I get an erroneous comma before the (Location: Publisher, Year) portion of the citation. If I change the document class from beamer to article, then the citation is produced correctly, without the comma.

dcpurton commented 3 years ago

Interesting. This doesn't happen with the article style. I'll investigate and see what I can find.

dcpurton commented 3 years ago

This is basically the same problem as https://tex.stackexchange.com/questions/371340/punctuation-after-title-and-beamer.

And the fix is analogous to that given in the above question. Add this to your preamble:

\AtBeginDocument{%
  \renewbibmacro*{title}{%
    \usebeamercolor[fg]{bibliography entry title}%
    \ifciteseen
      {\usebibmacro{shorttitle}}
      {\iffieldundef{title}
         {}
         {\printtext[title]{%
            \printfield[titlecase]{title}%
            \setunit{\subtitlepunct}%
            \printfield[titlecase]{subtitle}}%
          \newunit
          \printfield{titleaddon}%
          \usebibmacro{language}%
          \usebeamercolor[fg]{bibliography entry note}}}}}

This isn't really a bug with biblatex-sbl, since it occurs because of how beamer patches my macro in an unfriendly way. The problem is that \newunitpunct (a comma) is always inserted no matter what. Normally you would use \setunit{\newunitpunct} to avoid this, but that messes up the colours in beamer.

The best option is just to put up with the incompatibility and redefine the title macro as I have done above.