# Beamer bibliograbhy has wrong indentation

In my beamer presentation, the bibliography items are correctly indented until item 9. But the slide which starts item 10 has a weired look. Interestingly, everything is fine after that. The minimal code and screen-shots are attached with this.

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


Workaround:

You could make beamer believe all the labels are of the same width by putting them in a box of fixed width:

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


Or to get a constant spacing between the items and the text, one could right align the labels. Doing this will prevent jumping of the text alignment between [9] and [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}


• Thank you very much Sam. This is an acceptable solution, but a small drawback is - items 1 to 9 have more spacing between the numbering and the content. Because of the beamer template ( a custom made one) I use, this difference is easily noticeable. – Ashok Oct 22 '16 at 17:11
• @Ashok Is my edit nearer to what you are looking for? – user36296 Oct 22 '16 at 18:37

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


Result:

But if you want labels aligned to the right, use this:

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


Adding a item 9 to this frame the result is:

In this case, this is exactly the same that define the bib item as \hfill[\theenumiv], but using bibliography styles it could be better left the labels as defined for that styles.

• Thank you very much Fran. This is also an acceptable solution, but the drawback is - items 1 to 9 have more spacing between the numbering and the content. – Ashok Oct 23 '16 at 9:19
• @Ashok, See the edited answer. – Fran Oct 23 '16 at 9:58