diff --git a/doc/conf.py b/doc/conf.py index 00eca945f82d..174c8935761b 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -320,31 +320,49 @@ def _check_dependencies(): # the title page. latex_logo = None +# Use Unicode aware LaTeX engine +latex_engine = 'xelatex' # or 'lualatex' + latex_elements = {} + +# Keep babel usage also with xelatex (Sphinx default is polyglossia) +# If this key is removed or changed, latex build directory must be cleaned +latex_elements['babel'] = r'\usepackage{babel}' + +# Font configuration +# Sphinx default since 2.x is GNU FreeFont +latex_elements['fontpkg'] = r'\setmainfont{DejaVu Serif}' + # Additional stuff for the LaTeX preamble. latex_elements['preamble'] = r""" % One line per author on title page \DeclareRobustCommand{\and}% {\end{tabular}\kern-\tabcolsep\\\begin{tabular}[t]{c}}% - % In the parameters section, place a newline after the Parameters - % header. (This is stolen directly from Numpy's conf.py, since it - % affects Numpy-style docstrings). \usepackage{expdlist} \let\latexdescription=\description \def\description{\latexdescription{}{} \breaklabel} - - \usepackage{amsmath} - \usepackage{amsfonts} - \usepackage{amssymb} - \usepackage{txfonts} - - % The enumitem package provides unlimited nesting of lists and - % enums. Sphinx may use this in the future, in which case this can - % be removed. See - % https://bitbucket.org/birkenfeld/sphinx/issue/777/latex-output-too-deeply-nested - \usepackage{enumitem} - \setlistdepth{2048} + % But expdlist old LaTeX package requires fixes: + % 1) remove extra space + \usepackage{etoolbox} + \makeatletter + \patchcmd\@item{{\@breaklabel} }{{\@breaklabel}}{}{} + \makeatother + % 2) fix bug in expdlist's way of breaking the line after long item label + \makeatletter + \def\breaklabel{% + \def\@breaklabel{% + \leavevmode\par + % now a hack because Sphinx inserts \leavevmode after term node + \def\leavevmode{\def\leavevmode{\unhbox\voidb@x}}% + }% + } + \makeatother """ +# Sphinx 1.5 provides this to avoid "too deeply nested" LaTeX error +# and usage of "enumitem" LaTeX package is unneeded. +# Value can be increased but do not set it to something such as 2048 +# which needlessly would trigger creation of thousands of TeX macros +latex_elements['maxlistdepth'] = '10' latex_elements['pointsize'] = '11pt' # Documents to append as an appendix to all manuals. @@ -371,13 +389,6 @@ def _check_dependencies(): numpydoc_show_class_members = False -latex_engine = 'xelatex' # or 'lualatex' - -latex_elements = { - 'babel': r'\usepackage{babel}', - 'fontpkg': r'\setmainfont{DejaVu Serif}', -} - html4_writer = True inheritance_node_attrs = dict(fontsize=16) diff --git a/tutorials/text/mathtext.py b/tutorials/text/mathtext.py index 709f1df4956b..655ceec6bbf1 100644 --- a/tutorials/text/mathtext.py +++ b/tutorials/text/mathtext.py @@ -97,7 +97,7 @@ .. math:: - \frac{3}{4} \binom{3}{4} \genfrac{}{}{0}{}{3}{4} + \frac{3}{4} \binom{3}{4} \genfrac{}{}{0pt}{}{3}{4} Fractions can be arbitrarily nested::