diff --git a/sphinx/texinputs/sphinx.sty b/sphinx/texinputs/sphinx.sty index 86a30e70086..63d7bc4387f 100644 --- a/sphinx/texinputs/sphinx.sty +++ b/sphinx/texinputs/sphinx.sty @@ -1001,3 +1001,7 @@ \providecommand*{\sphinxtableofcontents}{\tableofcontents} \providecommand*{\sphinxthebibliography}{\thebibliography} \providecommand*{\sphinxtheindex}{\theindex} + +% will be used to accompany quote environment and help avoid "too deeply nested" +\newcommand*\SphinxDecreaseListDepth {\global\advance\@listdepth\m@ne} +\newcommand*\SphinxIncreaseListDepth {\global\advance\@listdepth\@ne} diff --git a/sphinx/writers/latex.py b/sphinx/writers/latex.py index b667c0c9a33..18b2d8c52cf 100644 --- a/sphinx/writers/latex.py +++ b/sphinx/writers/latex.py @@ -1304,12 +1304,14 @@ def depart_definition(self, node): self.body.append('\n') def visit_field_list(self, node): - self.body.append('\\begin{quote}\\begin{description}\n') + self.body.append('\\begin{quote}\\SphinxDecreaseListDepth' + '\\begin{description}\n') if self.table: self.table.has_problematic = True def depart_field_list(self, node): - self.body.append('\\end{description}\\end{quote}\n') + self.body.append('\\end{description}\\end{quote}' + '\\SphinxIncreaseListDepth\n') def visit_field(self, node): pass @@ -1960,7 +1962,7 @@ def visit_block_quote(self, node): isinstance(child, nodes.enumerated_list): done = 1 if not done: - self.body.append('\\begin{quote}\n') + self.body.append('\\begin{quote}\\SphinxDecreaseListDepth\n') if self.table: self.table.has_problematic = True @@ -1972,7 +1974,7 @@ def depart_block_quote(self, node): isinstance(child, nodes.enumerated_list): done = 1 if not done: - self.body.append('\\end{quote}\n') + self.body.append('\\end{quote}\\SphinxIncreaseListDepth\n') # option node handling copied from docutils' latex writer