1. Georg Brandl
  2. sphinx

Commits

Georg Brandl  committed 44414cf

Closes #1299: Make behavior of the :rst:dir:`math` directive more consistent and avoid producing empty environments in LaTeX output.

  • Participants
  • Parent commits 2ab23ec
  • Branches stable

Comments (0)

Files changed (2)

File CHANGES

View file
 * #1072: In the JS search, fix issues searching for upper-cased words by
   lowercasing words before stemming.
 
+* #1299: Make behavior of the :rst:dir:`math` directive more consistent and
+  avoid producing empty environments in LaTeX output.
+
 Documentation
 -------------
 

File sphinx/ext/mathbase.py

View file
     parts = math.split('\n\n')
     ret = []
     for i, part in enumerate(parts):
+        if not part.strip():
+            continue
         if label is not None and i == 0:
             ret.append('\\begin{split}%s\\end{split}' % part +
                        (label and '\\label{'+label+'}' or ''))
         else:
             ret.append('\\begin{split}%s\\end{split}\\notag' % part)
+    if not ret:
+        return ''
     return '\\begin{gather}\n' + '\\\\'.join(ret) + '\n\\end{gather}'