diff options
author | Georg Brandl <georg@python.org> | 2014-01-12 21:48:10 +0100 |
---|---|---|
committer | Georg Brandl <georg@python.org> | 2014-01-12 21:48:10 +0100 |
commit | b84de746ecbd3dee598aca90aadaf5de2a1d11d4 (patch) | |
tree | 5263bde57e1c66e6b0a03c8e05b4c8c0ef4bf39c /sphinx/ext | |
parent | 4839e9f558e6f918e4c2aaf724439eba9d9903b0 (diff) | |
download | sphinx-b84de746ecbd3dee598aca90aadaf5de2a1d11d4.tar.gz |
Closes #1299: Make behavior of the :rst:dir:`math` directive more consistent and avoid producing empty environments in LaTeX output.
Diffstat (limited to 'sphinx/ext')
-rw-r--r-- | sphinx/ext/mathbase.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/sphinx/ext/mathbase.py b/sphinx/ext/mathbase.py index b7d0d997..0c5eaf8b 100644 --- a/sphinx/ext/mathbase.py +++ b/sphinx/ext/mathbase.py @@ -30,11 +30,15 @@ def wrap_displaymath(math, label): 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}' |