beamer icon indicating copy to clipboard operation
beamer copied to clipboard

Missalignment of biblatex bibligraphy with sidebar outer theme

Open samcarter opened this issue 5 years ago • 7 comments

The sidebar outer theme contains \usebeamerfont{frametitle}, which leads to a misalignment of a biblatex bibliography:

\documentclass{beamer}

\useoutertheme{sidebar}

\usepackage[style=authortitle]{biblatex}
\addbibresource{biblatex-examples.bib}

\begin{document}

\begin{frame}
  \nocite{knuth:ct:a}
  \printbibliography
\end{frame}

\end{document}

Screen Shot 2020-11-30 at 13 17 06

samcarter avatar Nov 30 '20 12:11 samcarter

mmm, switching back to normal size seems to avoid the problem

\documentclass{beamer}

\usetheme{PaloAlto}
\normalsize

\usepackage[style=authortitle]{biblatex}
\addbibresource{biblatex-examples.bib}

\begin{document}

\begin{frame}
  \nocite{knuth:ct:a}
  \printbibliography
\end{frame}

\end{document}

samcarter avatar Nov 30 '20 12:11 samcarter

OK, so the problem is that Beamer uses a \parindent of zero. For this case biblatex sets the parindent to 1em at the time of package load and not at the time the bibliography is set. As the sidebar theme uses a bigger than normal font in the preamble this means that the indention is wrong, so the bibhang needs to be reset when the bibliography is actually used.

https://github.com/samcarter/beamer/commit/7df166c0332b70c4933fae7e85daffc5f4c448dc

samcarter avatar Dec 01 '20 15:12 samcarter

Wondering if this isn't actually a biblatex bug ....

samcarter avatar Dec 01 '20 15:12 samcarter

(maybe I need a second github account - all this talking to myself makes me sound crazy)

samcarter avatar Dec 01 '20 15:12 samcarter

I'm wondering if using a modified bibliography environment from the numeric style wouldn't be a better approach, e.g. https://github.com/samcarter/beamer/commit/66205aa0c07c682beaff6cbb32360beb233cc70e

@moewew What do you think?

samcarter avatar Dec 01 '20 15:12 samcarter

Given that beamer essentially turns the bibliography into an itemize with the little icons as bullets, the approach in https://github.com/samcarter/beamer/commit/66205aa0c07c682beaff6cbb32360beb233cc70e that makes this explicit by properly defining a list format that is suitable for that task (instead of trying to bend the lengths in the default bibliography list with hanging indent into a shape that sort of works) looks much better.

There is one thing I worry about, though: What if the user wants to get rid of the icons with the authoryear or authortitle style? Currently I can say \setbeamertemplate{bibliography item}{} and get back the normally indented bibliography (with hanging indent). I'm not sure how that would work if beamer overwrites the bibliography environment.

I don't think you want \newlength{\beamer@bibiconwidth} inside the bibliography environment. This could cause problems if people issue \printbibliography multiple times. It should be enough to declare the length once globally. Though I'm wondering if you need it at all. Can't you replace

          \newlength{\beamer@bibiconwidth}%
          \settowidth\beamer@bibiconwidth{\usebeamertemplate*{bibliography item}}%
          \setlength{\labelwidth}{\beamer@bibiconwidth}%

from https://github.com/samcarter/beamer/blob/66205aa0c07c682beaff6cbb32360beb233cc70e/base/beamerbaselocalstructure.sty#L510-L512 with

          \settowidth{\labelwidth}{\usebeamertemplate*{bibliography item}}%

moewew avatar Dec 02 '20 06:12 moewew

@moewew Thank you so much for your analysis and all this information!

samcarter avatar Dec 02 '20 16:12 samcarter