plk / biblatex

biblatex is a sophisticated bibliography system for LaTeX users. It has considerably more features than traditional bibtex and supports UTF-8
517 stars 118 forks source link

\uspunctuation, hyperref link quirk. #499

Open dcpurton opened 8 years ago

dcpurton commented 8 years ago

I notice that when \uspunctuation is active along with hyperref, the link for an enquoted field includes the beginning quotation mark, but not the ending quotation mark. It makes the output look a little odd, especially if links are coloured rather than boxed. e.g.,

\documentclass{article}
\usepackage[american]{babel}
\usepackage{csquotes}
\usepackage[style=verbose-note]{biblatex}
\usepackage[colorlinks]{hyperref}
\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@article{leyerle:1993,
  author = {Leyerle, Blake},
  title = {John Chrysostom on the Gaze},
  shorttitle = {Chrysostom},
  journaltitle = {Journal of Early Christian Studies},
  shortjournal = {JECS},
  volume = {1},
  date = {1993},
  pages = {159-174}
}
\end{filecontents}
\addbibresource{\jobname.bib}
\pagestyle{empty}
\begin{document}
\cite{leyerle:1993}.
\cite{leyerle:1993}.
\end{document}

test

plk commented 8 years ago

@josephwright - were you looking at something to do with this previously?

moewew commented 4 years ago

This came up today on TeX.SX https://tex.stackexchange.com/q/550991/35864

The cheap workaround is to swap the problematic field formats

\documentclass{article}
\usepackage[american]{babel}
\usepackage{csquotes}
\usepackage[style=verbose-note]{biblatex}
\usepackage[colorlinks]{hyperref}

\renewbibmacro*{cite:short}{%
  \printnames{labelname}%
  \setunit*{\printdelim{nametitledelim}}%
  \printtext[citetitle]{%
    \printfield[bibhyperlink]{labeltitle}}}

\addbibresource{biblatex-examples.bib}

\begin{document}
\cite{sigfridsson}.

\cite{sigfridsson}.
\end{document}

but that does not resolve the underlying issue.

And I'm not too enthusiastic about applying sweeping changes like this to the standard styles.

jjmccollum commented 4 years ago

The above workaround does not appear to improve the citation of the shorttitle field for biblatex with style=sbl. @dcpurton, do you know if a similar workaround would be possible with biblatex-sbl?

dcpurton commented 4 years ago

@jjmccollum, the workaround is likely a little more complicated for biblatex-sbl. I'll take a look.

dcpurton commented 4 years ago

I can't believe I didn't think of doing this myself…

@jjmccollum, try adding this to your preamble and see if it helps:

\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

I haven't tested it thoroughly yet.

jjmccollum commented 4 years ago

@dcpurton, this works perfectly! Thank you so much. And thanks to @moewew for looking into a workaround in response to my TeX Stack Exchange question!

dcpurton commented 4 years ago

@jjmccollum There are some other places that changes need to be made. The revdshorttitle macro also needs to be adjusted if you make use of the @review entry type. And there might be some other changes needed too.