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

Skip to content

Commit 76c34a6

Browse files
authored
Merge pull request #19137 from QuLogic/fix-latex-v3.3.x
Backport latexpdf fixes to v3.3.3-doc
2 parents 710ffd9 + 8d5a575 commit 76c34a6

File tree

2 files changed

+34
-23
lines changed

2 files changed

+34
-23
lines changed

doc/conf.py

Lines changed: 33 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -320,31 +320,49 @@ def _check_dependencies():
320320
# the title page.
321321
latex_logo = None
322322

323+
# Use Unicode aware LaTeX engine
324+
latex_engine = 'xelatex' # or 'lualatex'
325+
323326
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+
324336
# Additional stuff for the LaTeX preamble.
325337
latex_elements['preamble'] = r"""
326338
% One line per author on title page
327339
\DeclareRobustCommand{\and}%
328340
{\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).
332341
\usepackage{expdlist}
333342
\let\latexdescription=\description
334343
\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
347360
"""
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'
348366
latex_elements['pointsize'] = '11pt'
349367

350368
# Documents to append as an appendix to all manuals.
@@ -371,13 +389,6 @@ def _check_dependencies():
371389

372390
numpydoc_show_class_members = False
373391

374-
latex_engine = 'xelatex' # or 'lualatex'
375-
376-
latex_elements = {
377-
'babel': r'\usepackage{babel}',
378-
'fontpkg': r'\setmainfont{DejaVu Serif}',
379-
}
380-
381392
html4_writer = True
382393

383394
inheritance_node_attrs = dict(fontsize=16)

tutorials/text/mathtext.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@
9797
9898
.. math::
9999
100-
\frac{3}{4} \binom{3}{4} \genfrac{}{}{0}{}{3}{4}
100+
\frac{3}{4} \binom{3}{4} \genfrac{}{}{0pt}{}{3}{4}
101101
102102
Fractions can be arbitrarily nested::
103103

0 commit comments

Comments
 (0)