Beamer 的参考书目中垂直空间过多,带有上标序数词和极小的字体

Beamer 的参考书目中垂直空间过多,带有上标序数词和极小的字体

我正在寻找以下问题的解决方案:

我使用 BibLaTeX 在 Beamer 演示文稿中打印参考书目。一些参考书目项目包含上标的序数(由加载选项的\nth{‹number›}包的命令生成)。nthsuper

所讨论的参考书目tiny对其项目使用字体大小(\renewcommand*{\bibfont}{\tiny})。

使用此字体大小,包含上标的参考书目行上方的垂直空间明显扩大。这可能是由于断言文本行两端之间的距离相等。

尽管如此,我还是希望参考书目文本的垂直间距相等。如何避免这些额外的垂直间距,同时保持所需的字体大小和上标序数?

梅威瑟:

\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}

结果:

结果

答案1

moewe 的评论我设法找到了一种可以在本地运行且不涉及修改 BIB 文件的解决方案。

关键部分是重新定义\nth{}使用\smash{}

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

在 Beamer 框架中使用时,该参数#1显然变为第二个参数嵌套级别,需要表示为####1

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

可以通过以下方式提供位置信息:

\begingroup
\endgroup

或者将两行包装成一个命令并提供第二行来撤销更改:

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

梅威瑟:

\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}

结果:

结果

相关内容