1

I would like to give some references using the bibentry package in a beamer presentation. But sometimes, e.g. if the list of authors spans over multiple lines, there is a wrong vertical space in the output (see Image below). Is there a way to adjust the wrong spacing? enter image description here

Here the corresponding MWE:

\documentclass{beamer}

\usepackage{filecontents}
    \begin{filecontents}{\jobname.bib} 
    @article{RefA, 
        author  = {AFirstName ALastName}, 
        title   = {Title A}, 
        journal = {Journal A}, 
        volume  = {1},
        pages   = {345--678},
        year    = {9999}, 
    } 
    @article{RefB, 
        author  = {BFirstName BLastName}, 
        title   = {Title B}, 
        journal = {Journal B}, 
        volume  = {1},
        pages   = {345--678},
        year    = {9999}, 
    } 
    @article{Problem, 
        author  = {ProblemFirstName ProblemLastName and NoSolutionFirstName NoSolutionLastName}, 
        title   = {Title Problem}, 
        journal = {Journal Problem}, 
        volume  = {1},
        pages   = {345--678},
        year    = {9999}, 
    }  
\end{filecontents}

\usepackage{bibentry}
\nobibliography*

\begin{document}

\begin{frame}
    \frametitle{Bibentry -- Spacing Problem}
    \begin{itemize}
        \item \bibentry{RefA}
        \item \bibentry{RefB}
        \item \bibentry{Problem}
    \end{itemize}
\end{frame}

\begin{frame}
    \frametitle{Bibliography -- No Problem}
    \bibliographystyle{plain}
    \bibliography{\jobname.bib}
\end{frame}

\end{document}
2

The problem is beamers definition of \newblock which is used between units of the citation. Its definition, in beamerbaselocalstructure.sty, ends with some code that is unnecessary for your inline use. The strange spacing occurs whenever the text before the first new block (the author part) spans more than one line.

Therefore you need to make a version of \newblock that does the font changing beamer provides, but without the final code. This is for use in the main text. When you get to the bibliography you should restore the original beamer definition which is in \beamer@newblock.

Sample output

\documentclass{beamer}

\usepackage{filecontents}
    \begin{filecontents}{\jobname.bib} 
    @article{RefA, 
        author  = {AFirstName ALastName}, 
        title   = {Title A}, 
        journal = {Journal A}, 
        volume  = {1},
        pages   = {345--678},
        year    = {9999}, 
    } 
    @article{RefB, 
        author  = {BFirstName BLastName}, 
        title   = {Title B}, 
        journal = {Journal B}, 
        volume  = {1},
        pages   = {345--678},
        year    = {9999}, 
    } 
    @article{Problem, 
        author  = {ProblemFirstName ProblemLastName and NoSolutionFirstName NoSolutionLastName}, 
        title   = {Title Problem}, 
        journal = {Journal Problem}, 
        volume  = {1},
        pages   = {345--678},
        year    = {9999}, 
    }  
\end{filecontents}

\usepackage{bibentry}
\nobibliography*

\def\mybeamernewblock{%
  \usebeamercolor[fg]{bibliography entry author}%
  \usebeamerfont{bibliography entry author}%
  \usebeamertemplate{bibliography entry author}%
  \def\newblock{%
    \usebeamercolor[fg]{bibliography entry title}%
    \usebeamerfont{bibliography entry title}%
    \usebeamertemplate{bibliography entry title}%
    \def\newblock{%
      \usebeamercolor[fg]{bibliography entry location}%
      \usebeamerfont{bibliography entry location}%
      \usebeamertemplate{bibliography entry location}%
      \def\newblock{%
        \usebeamercolor[fg]{bibliography entry note}%
        \usebeamerfont{bibliography entry note}%
        \usebeamertemplate{bibliography entry note}}}}%
  \leavevmode
}

\begin{document}

\let\newblock\mybeamernewblock
\begin{frame}
    \frametitle{Bibentry -- Spacing Problem}
    \begin{itemize}
        \item \bibentry{RefA}
        \item \bibentry{RefB}
        \item \bibentry{Problem}
    \end{itemize}
\end{frame}

\makeatletter
\let\newblock\beamer@newblock
\makeatother
\begin{frame}
    \frametitle{Bibliography -- No Problem}
    \bibliographystyle{plain}
    \bibliography{\jobname.bib}
\end{frame}

\end{document}

Update This may be packaged as an environment for use in the body keeping the change local as follows:

\documentclass{beamer}

\usepackage{filecontents}
    \begin{filecontents}{\jobname.bib} 
    @article{RefA, 
        author  = {AFirstName ALastName}, 
        title   = {Title A}, 
        journal = {Journal A}, 
        volume  = {1},
        pages   = {345--678},
        year    = {9999}, 
    } 
    @article{RefB, 
        author  = {BFirstName BLastName}, 
        title   = {Title B}, 
        journal = {Journal B}, 
        volume  = {1},
        pages   = {345--678},
        year    = {9999}, 
    } 
    @article{Problem, 
        author  = {ProblemFirstName ProblemLastName and NoSolutionFirstName NoSolutionLastName}, 
        title   = {Title Problem}, 
        journal = {Journal Problem}, 
        volume  = {1},
        pages   = {345--678},
        year    = {9999}, 
    }  
\end{filecontents}

\usepackage{bibentry}
\nobibliography*

\def\mybeamernewblock{%
  \usebeamercolor[fg]{bibliography entry author}%
  \usebeamerfont{bibliography entry author}%
  \usebeamertemplate{bibliography entry author}%
  \def\newblock{%
    \usebeamercolor[fg]{bibliography entry title}%
    \usebeamerfont{bibliography entry title}%
    \usebeamertemplate{bibliography entry title}%
    \def\newblock{%
      \usebeamercolor[fg]{bibliography entry location}%
      \usebeamerfont{bibliography entry location}%
      \usebeamertemplate{bibliography entry location}%
      \def\newblock{%
        \usebeamercolor[fg]{bibliography entry note}%
        \usebeamerfont{bibliography entry note}%
        \usebeamertemplate{bibliography entry note}}}}%
  \leavevmode
}

\newenvironment{references}{\begin{itemize}\let\newblock\mybeamernewblock}{\end{itemize}}

\begin{document}

\begin{frame}
    \frametitle{Bibentry -- Spacing Problem}
    \begin{references}
        \item \bibentry{RefA}
        \item \bibentry{RefB}
        \item \bibentry{Problem}
    \end{references}
\end{frame}

\begin{frame}
    \frametitle{Bibliography -- No Problem}
    \bibliographystyle{plain}
    \bibliography{\jobname.bib}
\end{frame}

\end{document}
2
  • Can these be made into an environment, so I can just do \begin{references} \bibentry{bla} \end{references}? I tried, modifying the code in this question, but failed miserably... Right now I'm going for a modification of my bst file, according to this question. – rubenvb Jun 30 '15 at 9:10
  • @rubenvb No problem - I have added a version doing this to my solution. – Andrew Swann Jun 30 '15 at 9:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.