Skip to content

Commit 25ce38c

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 c7c05d3 commit 25ce38c

File tree

1 file changed

+21
-10
lines changed

1 file changed

+21
-10
lines changed

doc/conf.py

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -338,20 +338,31 @@ def _check_dependencies():
338338
% One line per author on title page
339339
\DeclareRobustCommand{\and}%
340340
{\end{tabular}\kern-\tabcolsep\\\begin{tabular}[t]{c}}%
341-
% In the parameters section, place a newline after the Parameters
342-
% header. (This is stolen directly from Numpy's conf.py, since it
343-
% affects Numpy-style docstrings).
344341
\usepackage{expdlist}
345342
\let\latexdescription=\description
346343
\def\description{\latexdescription{}{} \breaklabel}
347-
348-
% The enumitem package provides unlimited nesting of lists and
349-
% enums. Sphinx may use this in the future, in which case this can
350-
% be removed. See
351-
% https://bitbucket.org/birkenfeld/sphinx/issue/777/latex-output-too-deeply-nested
352-
\usepackage{enumitem}
353-
\setlistdepth{2048}
344+
% But expdlist old LaTeX package requires fixes:
345+
% 1) remove extra space
346+
\usepackage{etoolbox}
347+
\makeatletter
348+
\patchcmd\@item{{\@breaklabel} }{{\@breaklabel}}{}{}
349+
\makeatother
350+
% 2) fix bug in expdlist's way of breaking the line after long item label
351+
\makeatletter
352+
\def\breaklabel{%
353+
\def\@breaklabel{%
354+
\leavevmode\par
355+
% now a hack because Sphinx inserts \leavevmode after term node
356+
\def\leavevmode{\def\leavevmode{\unhbox\voidb@x}}%
357+
}%
358+
}
359+
\makeatother
354360
"""
361+
# Sphinx 1.5 provides this to avoid "too deeply nested" LaTeX error
362+
# and usage of "enumitem" LaTeX package is unneeded.
363+
# Value can be increased but do not set it to something such as 2048
364+
# which needlessly would trigger creation of thousands of TeX macros
365+
latex_elements['maxlistdepth'] = '10'
355366
latex_elements['pointsize'] = '11pt'
356367

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

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy