@@ -320,31 +320,49 @@ def _check_dependencies():
320
320
# the title page.
321
321
latex_logo = None
322
322
323
+ # Use Unicode aware LaTeX engine
324
+ latex_engine = 'xelatex' # or 'lualatex'
325
+
323
326
latex_elements = {}
327
+
328
+ # Keep babel usage also with xelatex (Sphinx default is polyglossia)
329
+ # If this key is removed or changed, latex build directory must be cleaned
330
+ latex_elements ['babel' ] = r'\usepackage{babel}'
331
+
332
+ # Font configuration
333
+ # Sphinx default since 2.x is GNU FreeFont
334
+ latex_elements ['fontpkg' ] = r'\setmainfont{DejaVu Serif}'
335
+
324
336
# Additional stuff for the LaTeX preamble.
325
337
latex_elements ['preamble' ] = r"""
326
338
% One line per author on title page
327
339
\DeclareRobustCommand{\and}%
328
340
{\end{tabular}\kern-\tabcolsep\\\begin{tabular}[t]{c}}%
329
- % In the parameters section, place a newline after the Parameters
330
- % header. (This is stolen directly from Numpy's conf.py, since it
331
- % affects Numpy-style docstrings).
332
341
\usepackage{expdlist}
333
342
\let\latexdescription=\description
334
343
\def\description{\latexdescription{}{} \breaklabel}
335
-
336
- \usepackage{amsmath}
337
- \usepackage{amsfonts}
338
- \usepackage{amssymb}
339
- \usepackage{txfonts}
340
-
341
- % The enumitem package provides unlimited nesting of lists and
342
- % enums. Sphinx may use this in the future, in which case this can
343
- % be removed. See
344
- % https://bitbucket.org/birkenfeld/sphinx/issue/777/latex-output-too-deeply-nested
345
- \usepackage{enumitem}
346
- \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
347
360
"""
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'
348
366
latex_elements ['pointsize' ] = '11pt'
349
367
350
368
# Documents to append as an appendix to all manuals.
@@ -371,13 +389,6 @@ def _check_dependencies():
371
389
372
390
numpydoc_show_class_members = False
373
391
374
- latex_engine = 'xelatex' # or 'lualatex'
375
-
376
- latex_elements = {
377
- 'babel' : r'\usepackage{babel}' ,
378
- 'fontpkg' : r'\setmainfont{DejaVu Serif}' ,
379
- }
380
-
381
392
html4_writer = True
382
393
383
394
inheritance_node_attrs = dict (fontsize = 16 )
0 commit comments