0

I dont like the citations in moste presentations. If you wanna look up a special reference, you most likely forgot the number when de reference are shown at the end. Therefor i made a custom citation command \mycite, acting like cite, but adding some brief informations in the footnote (without footnote index). Sometimes i just want to add a reference to the whole frame, without any explicit reference in the text, therefor i made a second command \myframecite. But on the latter one i have some dificulties, because it adds some empty space in the text, while it should only operate on the footnote.

\documentclass{beamer}
\usetheme{Boadilla}

\usepackage{filecontents}
\begin{filecontents}{jobname.bib}
    @article{Doe2013,
        title   = {Lorem Ipsum},
        volume  = {1},
        journal = {J. Foo},
        author  = {J. Doe},
        year    = {2013},
        pages   = {1--10},
    }
    @article{Public2013,
        title   = {Dolor Sit Amet},
        volume  = {1},
        journal = {J. Foo},
        author  = {J. Q. Public},
        year    = {2013},
        pages   = {11--20},
    }
\end{filecontents}

\usepackage[backend=biber, style=numeric]{biblatex}
\addbibresource{jobname.bib}

\makeatletter
\newbibmacro*{myframecite}{%
  \renewcommand{\@makefntext}[1]{\noindent\scriptsize##1}%
  \footnotetext{%
    \blxmkbibnote{foot}{%
      \printtext[labelnumberwidth]{%
        \printfield{prefixnumber}%
        \printfield{labelnumber}}%
      \addspace%
      \printnames{author}%
      \setunit{\addcomma\addspace}%
      \printfield{title}%
      \setunit{\addcomma\addspace}%
      \printfield{year}%
}}}
\DeclareCiteCommand{\myframecite}%
  {}
  {\usebibmacro{myframecite}}
  {}
  {}
\makeatother

\newcommand{\mycite}[1]{\cite{#1} \myframecite{#1}}

\begin{document}
\begin{frame}
\begin{definition}test\end{definition}
\begin{definition}test\end{definition}
\mycite{Doe2013}
\begin{definition}test\end{definition}
\myframecite{Public2013}
\begin{definition}test\end{definition}
\end{frame}
\end{document}

The small example produces the following frame: output

I dont want the empty line between the third and fourth definition, but i have no clue how to get rid of it. Of course, i could put the \myframecite command at the end of the frame, where the emply line wouldn't be that disturbing. Nevertheless, the additional empty line results in an odd (asymmetric) spacing, which i would like to avoid.

1

Basically all \cite commands defined with \DeclareCiteCommand assume that they print something where they are used. So they issue a lot of \leavevmode commands in order to avoid messing with vertical space. Ironically, these prevention measures actually cause unwanted vertical space here.

The only way I could find to get rid of the unwanted space for good is via a short wrapper that simply removes the \leavevmodes that biblatex would normally issue. It's not pretty, but it works here.

\documentclass{beamer}
\usetheme{Boadilla}

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

\makeatletter
\newbibmacro*{myframecite}{%
  \renewcommand{\@makefntext}[1]{\noindent\scriptsize##1}%
  \mkbibfootnotetext{%
    \printtext[labelnumberwidth]{%
      \printfield{prefixnumber}%
      \printfield{labelnumber}}%
    \setunit{\addspace}%
    \printnames{author}%
    \setunit{\addcomma\addspace}%
    \printfield{title}%
    \setunit{\addcomma\addspace}%
    \printfield{year}}}

\DeclareCiteCommand{\myframecite@i}%
  {}
  {\usebibmacro{myframecite}}
  {}
  {}

\newcommand*{\myframecite}[1]{%
  \@bsphack
  \def\blx@leavevmode@cite{}%
  \def\blx@leavevmode{}%
  \myframecite@i{#1}%
  \@esphack}
\makeatother

\newcommand{\mycite}[1]{\cite{#1}\myframecite{#1}}


\addbibresource{biblatex-examples.bib}

\begin{document}
\begin{frame}
\begin{definition}test\end{definition}
\begin{definition}test\end{definition}
\mycite{sigfridsson}
\begin{definition}test\end{definition}
\myframecite{worman}
\begin{definition}test\end{definition}
\end{frame}
\end{document}

Slide without excessive vertical space.

| improve this answer | |
  • It works as intended, thank you! – moro11 Jul 10 at 16:18

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.