我想bibentry
在 beamer 演示文稿中使用该包给出一些参考资料。但有时,例如,如果作者列表跨越多行,则输出中的垂直间距错误(见下图)。有没有办法调整错误的间距?
这里是相应的 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}
答案1
问题在于引用单元之间使用了beamer
的定义。其定义在 中以一些对于内联使用来说不必要的代码结尾。每当第一个新块(作者部分)之前的文本跨越多行时,就会出现奇怪的间距。\newblock
beamerbaselocalstructure.sty
因此,您需要制作一个提供\newblock
字体更改功能的版本beamer
,但不提供最终代码。这供正文使用。当您进入参考书目时,您应该恢复原始beamer
定义,即\beamer@newblock
。
\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}
更新这可以被打包为一个环境,供在体内使用,同时保持局部变化,如下所示:
\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}