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

Skip to content

Backport latexpdf fixes to v3.3.3-doc #19137

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Dec 17, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 33 additions & 22 deletions doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion tutorials/text/mathtext.py
Original file line number Diff line number Diff line change
Expand Up @@ -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::

Expand Down