# Superflous leading dot in biblatex/numeric and beamer

The combination of beamer and biblatex with the numeric style leads to an undesired dot and space at the beginning of @MISC entries.

\begin{filecontents}{mybib.bib}
@MISC{www,
title={TeX.SX},
url={www.tex.stackexchange.com},
urldate={2012-02-02},
}
\end{filecontents}

\documentclass{beamer}

\usepackage[backend=biber,style=numeric]{biblatex}

\begin{document}
\frame{Test \cite{www}}

\frame{\printbibliography}
\end{document}


Since this only happens with beamer and not scrarticle I guess it’s a beamer problem/imcompability. Is it possible to fix it?

-
To anyone else with this issue: it has now been fixed in Beamer thanks to Audrey's code, so if you still encounter it, you should update your packages. – Alan Munn Mar 15 '12 at 0:25

This seems to be a bug in beamerbaselocalstructure.sty. You can temporarily fix it by adding

 \makeatletter
\patchcmd{\abx@macro@title}{\blx@unitpunct\blx@postpunct}{}{}
\makeatother


right after \begin{document} in your file.

The same problem will arise with an empty title field in an entry. This is not so easily fixed at the moment, however.

(IMO this is safer than making your own local copy of beamerbaselocalstructure.sty. In my experience, it's very easy to forget such local modifications and then be bitten down the road if the package is updated.)

-
This removes the first \blx@unitpunct\blx@postpunct from \abx@macro@title. Re-executing the exact same \patchcmd would remove the second such instance as well. Joseph suggests removal of both in his answer. What would be the difference in using either or? – Werner Mar 10 '12 at 18:12
@Werner See my comment to Joseph's answer. – Alan Munn Mar 10 '12 at 18:35
Your solution worked. Thanks! – Tobi Mar 10 '12 at 18:59
I don't think this will get the color of the unit punctuation following the label name right. – Audrey Mar 10 '12 at 22:48
@Audrey, yes, I think you're right. I thought I checked that, but it has the same problem. – Alan Munn Mar 10 '12 at 22:58

In beamerbaselocalstructure.sty you will find

\AtBeginDocument{
{
\apptocmd\blx@env@bibliography{\let\makelabel\beamer@biblabeltemplate}{}{}
\pretocmd{\abx@macro@author}{\usebeamercolor[fg]{bibliography entry author}}{}{}
\pretocmd{\abx@macro@editor}{\usebeamercolor[fg]{bibliography entry author}}{}{}
\pretocmd{\abx@macro@title}{\blx@unitpunct\blx@postpunct\newblock\usebeamercolor[fg]{bibliography entry title}}{}{}
\apptocmd{\abx@macro@title}{\blx@unitpunct\blx@postpunct\newblock\usebeamercolor[fg]{bibliography entry note}}{}{}
}
{}
}


The issue can be removed by using a modified version of this file which instead reads

\AtBeginDocument{
{
\apptocmd\blx@env@bibliography{\let\makelabel\beamer@biblabeltemplate}{}{}
\pretocmd{\abx@macro@author}{\usebeamercolor[fg]{bibliography entry author}}{}{}
\pretocmd{\abx@macro@editor}{\usebeamercolor[fg]{bibliography entry author}}{}{}
\pretocmd{\abx@macro@title}{\newblock\usebeamercolor[fg]{bibliography entry title}}{}{}
\apptocmd{\abx@macro@title}{\blx@unitpunct\blx@postpunct\newblock\usebeamercolor[fg]{bibliography entry note}}{}{}
}
{}
}


Looking at this again, I'm not sure why that extra punctuation is there at all: I will update beamer with this fix.

-
I've changed the fix to repeat the original \apptocmd, otherwise the formatting of the title punctuation is incorrect. This isn't the final solution, however, since if the title field is empty, spurious punctuation will arise again. – Alan Munn Mar 10 '12 at 18:28
If I copy the second code block to my document it doesn’t seem to change anything but Alan’s solution worked. BTW: Where can I find beamer’s change history? – Tobi Mar 10 '12 at 19:00
@Tobi No, as I said you would need to make a copy of beamerbaselocalstructure.sty and change the code there, say in your local texmf tree. The change history is available from the BitBucket site: bitbucket.org/rivanvx/beamer/wiki/Home – Joseph Wright Mar 10 '12 at 19:13
Ohhh … I overread this, but why doesn’t it work with copying to my preamble? – Tobi Mar 10 '12 at 22:22
@JosephWright: I made the update and the dot disappeared but it seems like there is still a superfluous space at the beginning of the entry … – Tobi Mar 11 '12 at 14:58

Patches to the low-level bibliography macros need to generate punctuation in some cases - otherwise the color of unit punctuation set outside the macros won't match the color of the preceding field. In this new hook the punctuation at the beginning of title is set if labelname is defined. The punctuation at the end is set if title is defined.

\AtBeginDocument{%
{\apptocmd\blx@env@bibliography{\let\makelabel\beamer@biblabeltemplate}{}{}
\apptocmd{\abx@macro@begentry}{\usebeamercolor[fg]{bibliography entry author}}{}{}
\pretocmd{\abx@macro@title}
{\ifcsundef{abx@name@labelname}{}{\blx@unitpunct\blx@postpunct}%
\newblock\usebeamercolor[fg]{bibliography entry title}}{}{}
\apptocmd{\abx@macro@title}
{\ifcsundef{abx@field@title}{}{\blx@unitpunct\blx@postpunct}%
\newblock\usebeamercolor[fg]{bibliography entry note}}{}{}}
{}}


I've also included a patch to begentry. Names from editor or translator form labelname when author undefined, but the original patches to the author and editor macros don't appear to handle this case properly.

The above hook should replace the one found in beamerbaselocalstructure.sty. Otherwise the original hook can be patched after \begin{document}. Here's an example.

\documentclass{beamer}
\usepackage[backend=biber,style=numeric]{biblatex}

\begin{filecontents}{\jobname.bib}
@MISC{www,
title={TeX.SX},
url={www.tex.stackexchange.com},
urldate={2012-02-02},}
@MISC{www2,
url={www.tex.stackexchange.com},
urldate={2012-02-02},}
\end{filecontents}

\begin{document}
\makeatletter
\apptocmd{\abx@macro@begentry}{\usebeamercolor[fg]{bibliography entry author}}{}{}
\patchcmd{\abx@macro@title}
{\blx@unitpunct\blx@postpunct\newblock\usebeamercolor[fg]{bibliography entry title}}
{\ifcsundef{abx@name@labelname}{}{\blx@unitpunct\blx@postpunct}%
\newblock\usebeamercolor[fg]{bibliography entry title}}{}{}
\patchcmd{\abx@macro@title}
{\blx@unitpunct\blx@postpunct\newblock\usebeamercolor[fg]{bibliography entry note}}
{\ifcsundef{abx@field@title}{}{\blx@unitpunct\blx@postpunct}%
\newblock\usebeamercolor[fg]{bibliography entry note}}{}{}
\makeatother
\frame{Test \cite{www,companion,www2,moraux,gaonkar}}
\frame{\printbibliography}
\end{document}

-
I have merged this code into beamer (thanks to @AlanMunn). It will appear in the release version next time I update CTAN with a beamer release. – Joseph Wright Mar 11 '12 at 8:22