Beamer 书目缩进错误

Beamer 书目缩进错误

在我的 Beamer 演示文稿中,参考书目项直到第 9 项都正确缩进。但从第 10 项开始的幻灯片看起来很奇怪。有趣的是,此后一切都很好。附有最少的代码和屏幕截图。

\documentclass[xcolor={dvipsnames,table},11pt]{beamer}
\setbeamertemplate{bibliography item}{[\theenumiv]}

\begin{document}
\begin{frame}
\begin{thebibliography}{\bibindent}
\bibitem{} This is the first line of item 1\\ and this is the second ine. \\ Both of them have the same indentation.
\bibitem{} The second item \\ also has the same pattern
\bibitem{} Everything is fine until item 9
\end{thebibliography}
\end{frame}

\begin{frame}
\begin{thebibliography}{\bibindent}
\setcounter{enumiv}{9}
\bibitem{} This is item 10, line one\\ and this is the second line.\\ As you can see, the indentations are not the same.
\bibitem{} The same is the case for all the \\remaining items in this page
\end{thebibliography}
\end{frame}

\begin{frame}
\begin{thebibliography}{\bibindent}
\setcounter{enumiv}{10}
\bibitem{} But everything comes fine after that\\ All the remaining pages are fine.
\end{thebibliography}
\end{frame}

\end{document}

直到第 9 项

包含第 10 项的幻灯片

在此处输入图片描述

任何有关此问题的建议都会有帮助。提前致谢。

答案1

解决方法:

您可以将标签放在固定宽度的盒子中,让 beamer 相信所有标签都具有相同的宽度:

\documentclass[xcolor={dvipsnames,table},11pt]{beamer}
\setbeamertemplate{bibliography item}{\makebox[1.5em]{[\theenumiv]\hfill}}


\begin{document}
\begin{frame}[allowframebreaks]
\begin{thebibliography}{}
\bibitem{} This is the first line of item 1\\ and this is the second ine. \\ Both of them have the same indentation.
\bibitem{} The second item \\ also has the same pattern
\bibitem{} Everything is fine until item 9
\bibitem{} This is item 10, line one\\ and this is the second line.\\ As you can see, the indentations are not the same.
\bibitem{} The same is the case for all the \\remaining items in this page
\bibitem{} But everything comes fine after that\\ All the remaining pages are fine.
\bibitem{} This is the first line of item 1\\ and this is the second ine. \\ Both of them have the same indentation.
\bibitem{} The second item \\ also has the same pattern
\bibitem{} Everything is fine until item 9
\bibitem{} This is item 10, line one\\ and this is the second line.\\ As you can see, the indentations are not the same.
\bibitem{} The same is the case for all the \\remaining items in this page
\bibitem{} But everything comes fine after that\\ All the remaining pages are fine.
\end{thebibliography}
\end{frame}

\end{document}

在此处输入图片描述


或者,为了使项目和文本之间的间距恒定,可以将标签右对齐。这样做可以防止文本对齐在 [9] 和 [10] 之间跳跃。

\documentclass[xcolor={dvipsnames,table},11pt]{beamer}
\setbeamertemplate{bibliography item}{\makebox[1.5em]{\hfill[\theenumiv]}}


\begin{document}
\begin{frame}[allowframebreaks]
\begin{thebibliography}{}
\bibitem{} This is the first line of item 1\\ and this is the second ine. \\ Both of them have the same indentation.
\bibitem{} The second item \\ also has the same pattern
\bibitem{} Everything is fine until item 9
\bibitem{} This is item 10, line one\\ and this is the second line.\\ As you can see, the indentations are not the same.
\bibitem{} The same is the case for all the \\remaining items in this page
\bibitem{} But everything comes fine after that\\ All the remaining pages are fine.
\bibitem{} This is the first line of item 1\\ and this is the second ine. \\ Both of them have the same indentation.
\bibitem{} The second item \\ also has the same pattern
\bibitem{} Everything is fine until item 9
\bibitem{} This is item 10, line one\\ and this is the second line.\\ As you can see, the indentations are not the same.
\bibitem{} The same is the case for all the \\remaining items in this page
\bibitem{} But everything comes fine after that\\ All the remaining pages are fine.
\end{thebibliography}
\end{frame}

\end{document}

在此处输入图片描述

答案2

修改你的序言如下:

%\setbeamertemplate{bibliography item}{[\theenumiv]} % D'oh!!!
\setbeamertemplate{bibliography item}[text]
\def\bibindent{99}

结果:

姆韦

但是如果你想要标签右对齐,请使用以下命令:

%\setbeamertemplate{bibliography item}{[\theenumiv]} % D'oh!!!
\setbeamertemplate{bibliography item}{\hfill\insertbiblabel}
\def\bibindent{99}

向此框架添加项目 9,结果是:

mwe2

在这种情况下,这与将 bib 项目定义为完全相同 \hfill[\theenumiv],但是使用书目样式,最好将标签保留为该样式的定义。

相关内容