From b3e82fadc4da337e0b50d2b3b99f8eeaf2ab03bc Mon Sep 17 00:00:00 2001 From: Takeshi KOMIYA Date: Thu, 9 Jun 2016 12:00:07 +0900 Subject: [PATCH] Fix #2646: latex crashes if math contains twice empty lines --- CHANGES | 1 + sphinx/ext/mathbase.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGES b/CHANGES index 618114357..8a8271901 100644 --- a/CHANGES +++ b/CHANGES @@ -12,6 +12,7 @@ Bugs fixed * #2640: 1.4.2 LaTeX crashes if code-block inside warning directive * Let LaTeX use straight quotes also in inline code (ref #2627) * #2351: latex crashes if enumerated lists are placed on footnotes +* #2646: latex crashes if math contains twice empty lines Release 1.4.3 (released Jun 5, 2016) diff --git a/sphinx/ext/mathbase.py b/sphinx/ext/mathbase.py index 13a560c0a..ddcec492c 100644 --- a/sphinx/ext/mathbase.py +++ b/sphinx/ext/mathbase.py @@ -58,7 +58,7 @@ def wrap_displaymath(math, label, numbering): begin = r'\begin{align*}%s\!\begin{aligned}' % labeldef end = r'\end{aligned}\end{align*}' for part in parts: - equations.append('%s\\\\\n' % part) + equations.append('%s\\\\\n' % part.strip()) return '%s\n%s%s' % (begin, ''.join(equations), end)