5

I recently switched from using natbib to biblatex and observed some strange behavior trying to print the bibliography in a presentation using latex beamer.

After experimenting quite a while I think I was able to narrow down the problem, but I got no idea how to solve it:

I am using biblatex with the alphabetic-style, but modified the appearance to show the name of the first author and the year. With this setup, the printed bibliography on the last slide seemed to have a very large margin:

margin example margin example

After experimenting a bit, I realised that in fact it doesn't seem to be a margin, but just the citation abbreviation not being rendered. If I exlude the citation of [Edelsbrunner 1983] on the first slide so that it doesn't appear in the bibliography, the margin is way smaller

-> I assume the whitespace should just contain the abbreviation [Edelsbrunner 1983] instead of plain whitespace (which would be totally fine to me, no need to prevent the margin, just do render the abbreviation).

Do you have any idea how this could be caused and what to do to fix it?

Thank you very much in advance, I hope I don't miss some dumb point here...

Code:

\documentclass[xcolor=dvipsnames]{beamer}
\usepackage[ngerman]{babel}
\usepackage[utf8]{inputenc}
\usetheme{Antibes}

\usepackage[style=alphabetic,maxalphanames=1,backend=biber]{biblatex}
\addbibresource{library.bib}

\renewcommand*{\labelalphaothers}{}

\DeclareLabelalphaTemplate{
  \labelelement{
    \field[final]{shorthand}
    \field{labelname}
    \field{label}
  }
  \labelelement{
    \literal{\addhighpenspace}
  }
  \labelelement{
    \field{year}
  }
}

\beamertemplatenavigationsymbolsempty
\setbeamertemplate{footline}[frame number]
\setbeamertemplate{bibliography item}[triangle]


\begin{document}

\begin{frame}
    \frametitle{Grundlagen}
    Aktuelles Vorgehen: \\
    \medskip
    \cite{edelsbrunner1983} \\
    \cite{efrat2004} \\
    \medskip
    Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut
    labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo 
    dolores et ea rebum.
\end{frame}

\begin{frame}[t,noframenumbering,allowframebreaks]
    \frametitle{Literatur}
    \printbibliography
\end{frame}

\end{document}

library.bib:

@article{efrat2004,
  title={Covering with ellipses},
  author={Efrat, Alon and Hoffmann, Frank and Knauer, Christian and Kriegel, Klaus and Rote, G{\"u}nter and Wenk, Caola},
  journal={Algorithmica},
  volume={38},
  number={1},
  pages={145--160},
  year={2004},
  publisher={Springer}
}

@ARTICLE{edelsbrunner1983, 
author={Edelsbrunner, H. and Kirkpatrick, D. and Seidel, R.}, 
journal={Information Theory, IEEE Transactions on}, 
title={On the shape of a set of points in the plane}, 
year={1983}, 
month={Jul}, 
volume={29}, 
number={4}, 
pages={551-559}, 
keywords={Geometry;Image analysis, shape;Image shape analysis;Computer science;Concrete;Helium;Logic;Nearest neighbor searches;Pattern recognition;Shape;Sorting;Terminology;Visualization}, 
doi={10.1109/TIT.1983.1056714}, 
ISSN={0018-9448},}
Beztix
  • 53
  • 4

1 Answers1

4

With \setbeamertemplate{bibliography item}[triangle] you are replacing the complete label by a triangle. You need some new template:

\documentclass[xcolor=dvipsnames]{beamer}
\usepackage[ngerman]{babel}
\usepackage[utf8]{inputenc}
%\usetheme{Antibes}

\usepackage[style=alphabetic,maxalphanames=1,backend=biber]{biblatex}
\addbibresource{biblatex-examples.bib}

\renewcommand*{\labelalphaothers}{}

\DeclareLabelalphaTemplate{
  \labelelement{
    \field[final]{shorthand}
    \field{labelname}
    \field{label}
  }
  \labelelement{
    \literal{\addhighpenspace}
  }
  \labelelement{
    \field{year}
  }
}

\beamertemplatenavigationsymbolsempty
\setbeamertemplate{footline}[frame number]
%\setbeamertemplate{bibliography item}[triangle]
%\setbeamertemplate{bibliography item}[text]

\defbeamertemplate*{bibliography item}{triangletext}
{\scriptsize\raise1.25pt\hbox{\donotcoloroutermaths$\blacktriangleright$} \insertbiblabel}



\begin{document}

\begin{frame}
    \frametitle{Grundlagen}
    Aktuelles Vorgehen: \\
    \medskip
    \cite{doody} \\
    \cite{herrmann} \\
    \medskip
    Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut
    labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo
    dolores et ea rebum.
\end{frame}

\begin{frame}[t,noframenumbering,allowframebreaks]
    \frametitle{Literatur}
    \printbibliography
\end{frame}

\end{document}

enter image description here

Ulrike Fischer
  • 327,261
  • Thank you very much, perfect solution!

    In my defence: I initially suspected the '\setbeamertemplate' to be part of the unexpected behaviour, but when removing it from the example, the whitespace still occured next to the default article-icon. With my limited knowledge I then had no idea what else to try ;)

    – Beztix Feb 05 '16 at 16:24
  • @Beztix: There is no need to defence yourself. You made a good question with a good minimal example. – Ulrike Fischer Feb 05 '16 at 16:28