0

I am looking for a solution for the following problem:

I use BibLaTeX to print bibliography in a Beamer presentation. Some of the bibliography items contain ordinals in superscript (generated by \nth{‹number›} command of package nth loaded with option super).

The bibliography in question uses font size tiny for its items (\renewcommand*{\bibfont}{\tiny}).

With this font size, vertical space above bibliography lines containing the superscripts are visibly extended. It is probably a result of asserting equal distances between the extremes of the text lines.

Nevertheless, I prefer to have equal vertical spacing in the bibliography text. How can I avoid these extra vertical spaces while maintaining desired font size and superscript ordinals?

MWE:

\documentclass{beamer}

\usepackage{biblatex}

\defbeamertemplate*{bibliography item}{my text}
{\hfill\insertbiblabel \hss}

%\usepackage{filecontents}% No longer needed on recent  distributions, as its functionality has been moved into LaTeX kernel.
%\begin{filecontents}[overwrite]{Bibliography.bib}
\begin{filecontents}{Bibliography.bib}
@InProceedings{JJ20,
    author          = {Doe, John John and Eod, John John},
    booktitle       = {Proceedings of~Test Book Title Abcd Efgh Test Title},
    date            = {2020-02-06},
    title           = {Test title abcd text test proceedings title title abcd text test proceedings title title abcd text},
    booksubtitle    = {14th~test subtitle},
    editor          = {Doe, John John and Eod, John John},
    eventdate       = {2020-02-06},
    eventtitle      = {Some~Test Meeting coinciding with~the~Other~Meeting in~This and~That Discipline with~a~Specified~Year},
    location        = {New~York},
}

@InProceedings{JJ20a,
    author          = {Doe, John John and Eod, John John},
    booktitle       = {Proceedings of~Test Book Title Abcd Efgh Test Title},
    date            = {2020-02-06},
    title           = {Test title abcd text test proceedings title title abcd text test proceedings title title abcd text},
    booksubtitle    = {\nth{14}~test subtitle},
    editor          = {Doe, John John and Eod, John John},
    eventdate       = {2020-02-06},
    eventtitle      = {Some~Test Meeting coinciding with~the~Other~Meeting in~This and~That Discipline with~a~Specified~Year},
    location        = {New~York},
}
\end{filecontents}

\addbibresource{Bibliography.bib}
\nocite{*}

\usepackage[super]{nth}%\usepackage{nth} %%

\begin{document}

    \renewcommand*{\bibfont}{\tiny} %%

    \begin{frame}{Bibliography}
        \printbibliography
    \end{frame}

\end{document}

Result:

Result

Peter
  • 998
  • 2
    You can smash the superscript: \smash{\nth{14}}. Possible alternative: https://tex.stackexchange.com/q/467140/35864 (the questions mentions \smash). Possibly interesting as well: https://tex.stackexchange.com/q/358448/35864 – moewe Feb 06 '20 at 07:13

1 Answers1

1

After moewe’s comment I managed to find a solution that works locally and does not involve modifying BIB files.

The key part is to redefine \nth{} to use \smash{}:

\let\orignth\nth
\renewcommand*{\nth}[1]{\smash{\orignth{#1}}}

When used within Beamer’s frame, the argument #1 apparently becomes on a second argument nesting level and needs denoted as ####1:

\let\orignth\nth
\renewcommand*{\nth}[1]{\smash{\orignth{####1}}}

The locality can be provided by:

\begingroup
    …
\endgroup

or by wrapping both lines into a command and providing a second one to revert the changes:

\newcommand*{\smashnth}{%
    \let\orignth\nth
    \renewcommand*{\nth}[1]{\smash{\orignth{##1}}}%
}
\newcommand*{\restorenth}{%
    \let\nth\orignth%
}

MWE:

\documentclass{beamer}

\usepackage{biblatex}

\defbeamertemplate*{bibliography item}{my text}
{\hfill\insertbiblabel \hss}

%\usepackage{filecontents}% No longer needed on recent  distributions, as its functionality has been moved into LaTeX kernel.
%\begin{filecontents}[overwrite]{Bibliography.bib}
\begin{filecontents}{Bibliography.bib}
@InProceedings{JJ20,
    author          = {Doe, John John and Eod, John John},
    booktitle       = {Proceedings of~Test Book Title Abcd Efgh Test Title},
    date            = {2020-02-06},
    title           = {Test title abcd text test proceedings title title abcd text test proceedings title title abcd text},
    booksubtitle    = {14th~test subtitle},
    editor          = {Doe, John John and Eod, John John},
    eventdate       = {2020-02-06},
    eventtitle      = {Some~Test Meeting coinciding with~the~Other~Meeting in~This and~That Discipline with~a~Specified~Year},
    location        = {New~York},
}

@InProceedings{JJ20a,
    author          = {Doe, John John and Eod, John John},
    booktitle       = {Proceedings of~Test Book Title Abcd Efgh Test Title},
    date            = {2020-02-06},
    title           = {Test title abcd text test proceedings title title abcd text test proceedings title title abcd text},
    booksubtitle    = {\nth{14}~test subtitle},
    editor          = {Doe, John John and Eod, John John},
    eventdate       = {2020-02-06},
    eventtitle      = {Some~Test Meeting coinciding with~the~Other~Meeting in~This and~That Discipline with~a~Specified~Year},
    location        = {New~York},
}
\end{filecontents}

\addbibresource{Bibliography.bib}
\nocite{*}

\usepackage[super]{nth}%\usepackage{nth} %%

\newcommand*{\smashnth}{%
    \let\orignth\nth
    \renewcommand*{\nth}[1]{\smash{\orignth{##1}}}%
}
\newcommand*{\restorenth}{%
    \let\nth\orignth%
}

\begin{document}

    \renewcommand*{\bibfont}{\tiny} %%

    \begin{frame}{Bibliography}
        \smashnth
        \printbibliography % With smashed ‘nth’s.
        \restorenth
        \printbibliography % Again with non-smashed ‘nth’s.
    \end{frame}

\end{document}

Result:

Result

Peter
  • 998