Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 2b212a0

Browse files
jfbuQuLogic
authored andcommitted
LaTeX: resolve "Too deeply nested" error without enumitem package
But removing enumitem package reveals a bug in expdlist. Import the fix from the SciPy and NumPy projects. numpy/numpy#15028 scipy/scipy@c881fde
1 parent 8b6e341 commit 2b212a0

1 file changed

Lines changed: 21 additions & 10 deletions

File tree

doc/conf.py

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -360,20 +360,31 @@ def _check_dependencies():
360360
% One line per author on title page
361361
\DeclareRobustCommand{\and}%
362362
{\end{tabular}\kern-\tabcolsep\\\begin{tabular}[t]{c}}%
363-
% In the parameters section, place a newline after the Parameters
364-
% header. (This is stolen directly from Numpy's conf.py, since it
365-
% affects Numpy-style docstrings).
366363
\usepackage{expdlist}
367364
\let\latexdescription=\description
368365
\def\description{\latexdescription{}{} \breaklabel}
369-
370-
% The enumitem package provides unlimited nesting of lists and
371-
% enums. Sphinx may use this in the future, in which case this can
372-
% be removed. See
373-
% https://bitbucket.org/birkenfeld/sphinx/issue/777/latex-output-too-deeply-nested
374-
\usepackage{enumitem}
375-
\setlistdepth{2048}
366+
% But expdlist old LaTeX package requires fixes:
367+
% 1) remove extra space
368+
\usepackage{etoolbox}
369+
\makeatletter
370+
\patchcmd\@item{{\@breaklabel} }{{\@breaklabel}}{}{}
371+
\makeatother
372+
% 2) fix bug in expdlist's way of breaking the line after long item label
373+
\makeatletter
374+
\def\breaklabel{%
375+
\def\@breaklabel{%
376+
\leavevmode\par
377+
% now a hack because Sphinx inserts \leavevmode after term node
378+
\def\leavevmode{\def\leavevmode{\unhbox\voidb@x}}%
379+
}%
380+
}
381+
\makeatother
376382
"""
383+
# Sphinx 1.5 provides this to avoid "too deeply nested" LaTeX error
384+
# and usage of "enumitem" LaTeX package is unneeded.
385+
# Value can be increased but do not set it to something such as 2048
386+
# which needlessly would trigger creation of thousands of TeX macros
387+
latex_elements['maxlistdepth'] = '10'
377388
latex_elements['pointsize'] = '11pt'
378389

379390
# Documents to append as an appendix to all manuals.

0 commit comments

Comments
 (0)