1

I am using the hyperref package to highlight URLs, abbreviations, and shorthand in citations for convenience in a document, and I am using biblatex-sbl to get citations in SBL format. The hyperref package generally does a great job highlighting things like the shortjournal or shortseries fields in citations, but it seems to trip up when it tries to highlight the shorttitle field of an article citation: the opening quote of the short article title is highlighted with the rest of the title, but the close quote is not.

Minimal (non-)working example

For the sake of reproducibility, I've attached some code for a minimal (non-)working example, which consists of a bibliography file and a TeX file.

bibliography.bib

@article{
    MWE20,
    author = {Joey McCollum},
    title = {A Minimal (Non-)Working Example},
    shorttitle = {MWE},
    journal = {TeX Stack Exchange Quarterly},
    year = {2020},
    pages = {1--2}
}
mwe.tex

\documentclass[12pt]{article}
%Include support for hyperreferences:
\usepackage{hyperref}
%Include support for citation format:
\usepackage[style=sbl, ibidtracker=false, idemtracker=false, citepages=omit, backend=biber]{biblatex}
%Add the bibliography source file:
\addbibresource{./bibliography.bib}
\begin{document}
    This is a minimal (non-)working example.\footnote{\cite{MWE20}.} It is intended to illustrate unexpected behavior in \LaTeX.\footnote{\cite[2]{MWE20}.}
    \printbibliography
\end{document}

I typeset this using the TeXLive 2020 release of pdfLaTeX and the corresponding release of XeLaTeX; both engines will reproduce this behavior.

I imagine the issue has something to do with substitutions made by biblatex-sbl to ensure that a comma following a title in quotes is placed within the quotes (in accordance with American English style), but I can't say for sure. As it is, the current highlighting is a bit ugly. If there was a way to highlight the shortened title more consistently, either by including both the surrounding quotes and the comma or by highlighting only the title itself, without the surrounding quotes and the comma, that would be great. Is there any easy way to fix this, or is it a bug that will have to be fixed in one of the packages involved?

EDIT: As moewe has pointed out in the comments, this has been a known bug in biblatex for a few years now (https://github.com/plk/biblatex/issues/499), and it affects citation styles other than sbl (such as verbose-note).

6
  • 1
    I think this is basically this bug: github.com/plk/biblatex/issues/499
    – moewe
    Jun 24, 2020 at 19:43
  • Yes, that issue describes my problem exactly! Thanks for sharing this. It looks like this problem affects citation styles in biblatex other than SBL, too. Has it really been left unsolved since 2016? Jun 24, 2020 at 19:53
  • It affects all styles where a link is applied with a field format outside another field format with quotation marks. The issue only occurs with US-style punctuation moving shenannigans for quotation marks. That's also why it is so difficult to resolve. (I have looked into this once or twice in the last years, but I always came to the conclusion that it is too difficult for me.)
    – moewe
    Jun 24, 2020 at 19:59
  • @moewe can't you move the link inside the quote then? Jun 24, 2020 at 20:02
  • 1
    @UlrikeFischer In some (many?) instances you could swap the order of the formats, yes. E.g. \printtext[citetitle]{\printfield[bibhyperlink]{...}} instead of \printtext[bibhyperlink]{\printfield[citetitle]{...}} (for verbose-note as in the biblatex bug report). But of course that doesn't resolve the underlying problem. Or did you mean something else?
    – moewe
    Jun 24, 2020 at 20:06

1 Answer 1

1

Adapting @UlrikeFischer and @moewe's solution does appear to work:

Try this:

\documentclass[12pt]{article}
\begin{filecontents}[overwrite]{\jobname.bib}
@article{MWE20,
  author = {Joey McCollum},
  title = {A Minimal (Non-)Working Example},
  shorttitle = {MWE},
  journal = {TeX Stack Exchange Quarterly},
  year = {2020},
  pages = {1-2}
}
\end{filecontents}
\usepackage[colorlinks]{hyperref}
\usepackage[style=sbl, ibidtracker=false, idemtracker=false, citepages=omit, backend=biber]{biblatex}
\addbibresource{\jobname.bib}

\makeatletter
\renewbibmacro*{shorttitle}{%
  \iftoggle{blx@useshorttitle}
    {\iffieldundef{shorttitle}
       {\iffieldundef{title}
          {}
          {\ifbool{bbx@inset}
             {\printtext{\bibhyperlink{\strfield{setkey}}
                {\printtext[title]{\printfield[titlecase]{title}}}}}
             {\printtext[title]{%
                \printtext[bibhyperlink]{\printfield[titlecase]{title}}}}}}
       {\ifbool{bbx@inset}
          {\printtext{\bibhyperlink{\strfield{setkey}}
             {\printtext[title]{\printfield[titlecase]{shorttitle}}}}}
          {\printtext[title]{%
             \printtext[bibhyperlink]{\printfield[titlecase]{shorttitle}}}}}%
     \newunit}
    {}}
\makeatother

\begin{document}
\null\vfill
This is a minimal (non-)working example \autocite{MWE20}. It is intended to
illustrate unexpected behavior in \LaTeX \autocite[2]{MWE20}.
\printbibliography
\end{document}

MWE output

You must log in to answer this question.

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