plk / biblatex-apa

APA style for BibLaTeX
88 stars 48 forks source link

Missing space before title for @article in beamer #212

Open l1n00x opened 1 year ago

l1n00x commented 1 year ago

Hi,

somehow, when using @ article in a beamer presentation there is no space between the title entry and the dot separating the year entry and the title. This is not the case when not using beamer.

Consider

\begin{filecontents}{\jobname.bib}
    @article{test,
        author = {John Doe},
        title = {Test Title},
        pages = {229–243},
        volume = {77},
        number = {5},
        year = {2023},
        doi = {10.1348/xyz}
    }

\end{filecontents}

\documentclass{beamer}

\usepackage[
    style = apa
]{biblatex}
\addbibresource{\jobname.bib}

\setbeamercolor{bibliography entry author}{fg=black}
\setbeamercolor{bibliography entry title}{fg=black}
\setbeamercolor{bibliography entry note}{fg=black}

\begin{document}

\nocite{*}
\printbibliography

\end{document}

grafik

moewew commented 1 year ago

This is due to beamer's patches to the title bibmacro. In order to inject its block colours beamer patches some standard biblatex macros and applies some fairy dust. Unfortunately that fairy dust clashes with biblatex-apa in a visible way here.

The problem could be avoided if biblatex-apa were to use \printunit{\printdelim{nametitledelim} instead of a bare \printdelim{nametitledelim} in the bibdrivers. (Shown in the MWE for @article.)

\documentclass{beamer}

\usepackage[
  style = apa,
]{biblatex}

\DeclareBibliographyDriver{article}{%
  \usebibmacro{bibindex}%
  \usebibmacro{begentry}%
  \usebibmacro{author/editor}%
  \printunit{\printdelim{nametitledelim}}\newblock
  \usebibmacro{title}%
  \setunit{\addspace}\newblock
  \usebibmacro{apa:related}%
  \newunit\newblock
  \usebibmacro{journal+issuetitle}%
  \setunit{\bibpagespunct}%
  \printfield{pages}%
  \newunit\newblock
  \printfield{howpublished}%
  \newunit\newblock
  \usebibmacro{doi+url}%
  \newblock
  \usebibmacro{origyear}%
  \newunit\newblock
  \printfield{addendum}%
  \setunit{\addspace}\newblock
  \iftoggle{bbx:related}
    {\usebibmacro{related:init}%
     \usebibmacro{related}}
    {}%
  \usebibmacro{pageref}%
  \usebibmacro{annotation}%
  \usebibmacro{finentry}}

\setbeamercolor{bibliography entry author}{fg=black}
\setbeamercolor{bibliography entry title}{fg=black}
\setbeamercolor{bibliography entry note}{fg=black}

\begin{filecontents}{\jobname.bib}
@article{test,
  author = {John Doe},
  title  = {Test Title},
  pages  = {229–243},
  volume = {77},
  number = {5},
  year   = {2023},
  doi    = {10.1348/xyz},
}
\end{filecontents}
\addbibresource{\jobname.bib}

\begin{document}
\nocite{*}
\printbibliography
\end{document}

The original @article driver is

https://github.com/plk/biblatex-apa/blob/1d72b03a96f78304a81117a2c421c79d0b27adc5/tex/latex/biblatex-apa/bbx/apa.bbx#L1549-L1576

@plk I would expect \setunit or \printunit here. Is there any reason why the code just has neither?


But the beamer patches are overly reliant on biblatex's built-in punctuation tracking feature that tries to avoid double punctuation. As soon as that can no longer work, we get double the output we want.

@samcarter maybe you'd be interested in knowing about this. (I have no idea what to do about it, though.)

\documentclass{beamer}

\usepackage[
  style = authoryear,
]{biblatex}

\def\labelnamepunct{X}

\begin{filecontents}{\jobname.bib}
@article{test,
  author = {John Doe},
  title  = {Test Title},
  pages  = {229–243},
  volume = {77},
  number = {5},
  year   = {2023},
  doi    = {10.1348/xyz},
}
\end{filecontents}
\addbibresource{\jobname.bib}

\begin{document}
\nocite{*}
\printbibliography
\end{document}
samcarter commented 1 year ago

@moewew Thanks for the ping! There are a couple of other things with beamer's biblatex patches, which I'd like to fix, maybe I'll find some other approach how to sprinkle the fairy dust :)

As this looks like a bit bigger project, I don't know when I will have time to look into that, so no promises on a time line.

plk commented 10 months ago

Pure oversight on my part - will be fixed in next release.