From dc02f2535d7e92dfd1c2f7b9839e640ef499880c Mon Sep 17 00:00:00 2001 From: jfbu Date: Sun, 8 Jan 2017 11:50:50 +0100 Subject: [PATCH] Fix #3315: Bibliography crashes on latex build with docclass 'memoir' --- sphinx/texinputs/sphinx.sty | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/sphinx/texinputs/sphinx.sty b/sphinx/texinputs/sphinx.sty index f57283c19..8d43661ba 100644 --- a/sphinx/texinputs/sphinx.sty +++ b/sphinx/texinputs/sphinx.sty @@ -1090,8 +1090,14 @@ % make commands known to non-Sphinx document classes \providecommand*{\sphinxtableofcontents}{\tableofcontents} -\providecommand*{\sphinxthebibliography}{\thebibliography} -\providecommand*{\sphinxtheindex}{\theindex} +\spx@ifundefined{sphinxthebibliography} + {\newenvironment + {sphinxthebibliography}{\begin{thebibliography}}{\end{thebibliography}}% + } + {}% else clause of ifundefined +\spx@ifundefined{sphinxtheindex} + {\newenvironment{sphinxtheindex}{\begin{theindex}}{\end{theindex}}}% + {}% else clause of ifundefined % remove LaTeX's cap on nesting depth if 'maxlistdepth' key used. % This is a hack, which works with the standard classes: it assumes \@toodeep