mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Closes #1299: Make behavior of the :rst:dir:math directive more consistent and avoid producing empty environments in LaTeX output.
This commit is contained in:
3
CHANGES
3
CHANGES
@@ -85,6 +85,9 @@ Bugs fixed
|
||||
* #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
|
||||
-------------
|
||||
|
||||
|
||||
@@ -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}'
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user