diff --git a/CHANGES b/CHANGES index 8f55ac090..6c0aee747 100644 --- a/CHANGES +++ b/CHANGES @@ -154,6 +154,8 @@ Bugs fixed * #2292: Fix some footnotes disappear from LaTeX output * #2287: ``sphinx.transforms.Locale`` always uses rst parser. Sphinx i18n feature should support parsers that specified source_parsers. +* #2290: Fix ``sphinx.ext.mathbase`` use of amsfonts may break user choice of math fonts +* #2324: Print a hint how to increase the recursion limit when it is hit. Release 1.3.5 (released Jan 24, 2016) diff --git a/sphinx/cmdline.py b/sphinx/cmdline.py index f5b141e8c..baa797fff 100644 --- a/sphinx/cmdline.py +++ b/sphinx/cmdline.py @@ -270,6 +270,14 @@ def main(argv): print(red('The full traceback has been saved in %s, if you want ' 'to report the issue to the developers.' % tbpath), file=error) + elif isinstance(err, RuntimeError) and 'recursion depth' in str(err): + print(red('Recursion error:'), file=error) + print(terminal_safe(text_type(err)), file=error) + print(file=error) + print('This can happen with very large or deeply nested source ' + 'files. You can carefully increase the default Python ' + 'recursion limit of 1000 in conf.py with e.g.:', file=error) + print(' import sys; sys.setrecursionlimit(1500)', file=error) else: print(red('Exception occurred:'), file=error) print(format_exception_cut_frames().rstrip(), file=error) diff --git a/sphinx/ext/mathbase.py b/sphinx/ext/mathbase.py index 8ede05b87..bd1e75214 100644 --- a/sphinx/ext/mathbase.py +++ b/sphinx/ext/mathbase.py @@ -214,6 +214,11 @@ def number_equations(app, doctree, docname): node[0] = nodes.Text(num, num) +def setup_amsfont(app): + # use amsfonts if users do not configure latex_elements['amsfonts'] + app.config.latex_elements.setdefault('amsfonts', r'\usepackage{amsfonts}') + + def setup_math(app, htmlinlinevisitors, htmldisplayvisitors): app.add_config_value('math_number_all', False, 'html') app.add_node(math, override=True, @@ -238,4 +243,4 @@ def setup_math(app, htmlinlinevisitors, htmldisplayvisitors): app.add_role('eq', eq_role) app.add_directive('math', MathDirective) app.connect('doctree-resolved', number_equations) - app.add_latex_package('amsfonts') + app.connect('builder-inited', setup_amsfont) diff --git a/sphinx/writers/latex.py b/sphinx/writers/latex.py index e4026d84b..ecca57352 100644 --- a/sphinx/writers/latex.py +++ b/sphinx/writers/latex.py @@ -38,6 +38,7 @@ HEADER = r'''%% Generated by Sphinx. %(utf8extra)s %(cmappkg)s %(fontenc)s +%(amsfonts)s %(babel)s %(fontpkg)s %(fncychap)s @@ -276,6 +277,7 @@ class LaTeXTranslator(nodes.NodeVisitor): '\\else\\fi'), 'cmappkg': '\\usepackage{cmap}', 'fontenc': '\\usepackage[T1]{fontenc}', + 'amsfonts': '', 'babel': '\\usepackage{babel}', 'fontpkg': '\\usepackage{times}', 'fncychap': '\\usepackage[Bjarne]{fncychap}',