|
From: <mi...@us...> - 2021-05-20 12:19:42
|
Revision: 8739
http://sourceforge.net/p/docutils/code/8739
Author: milde
Date: 2021-05-20 12:19:35 +0000 (Thu, 20 May 2021)
Log Message:
-----------
MathML: pretty print XML.
Add newlines and indentation around non-token MathML tags.
Modified Paths:
--------------
trunk/docutils/docutils/utils/math/latex2mathml.py
trunk/docutils/test/functional/expected/math_output_mathml.html
Modified: trunk/docutils/docutils/utils/math/latex2mathml.py
===================================================================
--- trunk/docutils/docutils/utils/math/latex2mathml.py 2021-05-20 12:19:23 UTC (rev 8738)
+++ trunk/docutils/docutils/utils/math/latex2mathml.py 2021-05-20 12:19:35 UTC (rev 8739)
@@ -213,6 +213,7 @@
nchildren = 1000000
"""Required number of children"""
+ _level = 0 # indentation level (static class variable)
def __init__(self, children=None, inline=None, **kwargs):
"""math([children]) -> MathML element
@@ -291,61 +292,68 @@
return self.xml_start() + self.xml_body() + self.xml_end()
def xml_start(self):
- # MathML uses only lowercase attributes, allow CLASS for class (Python keyword)
+ # Use k.lower() to allow argument `CLASS` for attribute `class`
+ # (Python keyword). MathML uses only lowercase attributes.
attrs = ['%s="%s"'%(k.lower(), v) for k, v
in getattr(self, 'attributes', {}).items()]
+ if not isinstance(self, mx): # token elements
+ math._level += 1
return ['<%s>' % ' '.join([self.__class__.__name__] + attrs)]
def xml_end(self):
- return ['</%s>' % self.__class__.__name__]
+ xml = []
+ if not isinstance(self, mx): # except token elements
+ math._level -= 1
+ xml.append('\n' + ' ' * math._level)
+ xml.append('</%s>' % self.__class__.__name__)
+ return xml
def xml_body(self):
xml = []
+ last_child = None
for child in self.children:
+ if not (isinstance(last_child, mx) and isinstance(child, mx)):
+ xml.append('\n' + ' ' * math._level)
xml.extend(child.xml())
+ last_child = child
return xml
# >>> l2m.math(l2m.mn(2))
# math(mn(2))
# >>> l2m.math(l2m.mn(2)).xml()
-# ['<math>', '<mn>', 2, '</mn>', '</math>']
+# ['<math>', '\n ', '<mn>', '2', '</mn>', '\n', '</math>']
#
# >>> l2m.math(id='eq3')
# math(id='eq3')
# >>> l2m.math(id='eq3').xml()
-# ['<math id="eq3">', '</math>']
+# ['<math id="eq3">', '\n', '</math>']
#
# use CLASS to get "class" in XML
# >>> l2m.math(CLASS='test')
# math(CLASS='test')
# >>> l2m.math(CLASS='test').xml()
-# ['<math class="test">', '</math>']
+# ['<math class="test">', '\n', '</math>']
# >>> l2m.math(inline=True)
# math(xmlns='http://www.w3.org/1998/Math/MathML')
# >>> l2m.math(inline=True).xml()
-# ['<math xmlns="http://www.w3.org/1998/Math/MathML">', '</math>']
+# ['<math xmlns="http://www.w3.org/1998/Math/MathML">', '\n', '</math>']
# >>> l2m.math(inline=False)
# math(xmlns='http://www.w3.org/1998/Math/MathML', display='block')
# >>> l2m.math(inline=False).xml()
-# ['<math xmlns="http://www.w3.org/1998/Math/MathML" display="block">', '</math>']
+# ['<math xmlns="http://www.w3.org/1998/Math/MathML" display="block">', '\n', '</math>']
-class mrow(math):
- def xml_start(self):
- return ['\n'] + super(mrow, self).xml_start()
+class mrow(math): pass
# >>> l2m.mrow(displaystyle='false')
# mrow(displaystyle='false')
-class mtable(math):
- def xml_start(self):
- return ['\n'] + super(mtable, self).xml_start()
+class mtable(math): pass
# >>> l2m.mtable(displaystyle='true')
# mtable(displaystyle='true')
# >>> l2m.math(l2m.mtable(displaystyle='true')).xml()
-# ['<math>', '\n', '<mtable displaystyle="true">', '</mtable>', '</math>']
-
+# ['<math>', '\n ', '<mtable displaystyle="true">', '\n ', '</mtable>', '\n', '</math>']
class mtr(mrow): pass
class mtd(mrow): pass
@@ -364,6 +372,7 @@
class mi(mx): pass
class mn(mx): pass
class mo(mx): pass
+class mtext(mx): pass
# >>> l2m.mo(u'<')
# mo(<)
@@ -393,10 +402,10 @@
def xml(self):
if self.reversed:
-## self.children[1:3] = self.children[2:0:-1]
+ ## self.children[1:3] = self.children[2:0:-1]
self.children[1:3] = [self.children[2], self.children[1]]
self.reversed = False
- return math.xml(self)
+ return super(msubsup, self).xml()
class mspace(math):
nchildren = 0
@@ -406,12 +415,8 @@
if nchildren is not None:
self.nchildren = nchildren
math.__init__(self, children)
- self.attrs = kwargs
+ self.attributes = kwargs
- def xml_start(self):
- return ['<mstyle '] + ['%s="%s"' % item
- for item in self.attrs.items()] + ['>']
-
class mover(math):
nchildren = 2
def __init__(self, children=None, reversed=False):
@@ -432,15 +437,6 @@
def __init__(self, children=None):
math.__init__(self, children)
-class mtext(math):
- nchildren = 0
- def __init__(self, text):
- self.text = text
-
- def xml_body(self):
- return [self.text]
-
-
# LaTeX to MathML translation
# ---------------------------
Modified: trunk/docutils/test/functional/expected/math_output_mathml.html
===================================================================
--- trunk/docutils/test/functional/expected/math_output_mathml.html 2021-05-20 12:19:23 UTC (rev 8738)
+++ trunk/docutils/test/functional/expected/math_output_mathml.html 2021-05-20 12:19:35 UTC (rev 8739)
@@ -14,30 +14,86 @@
<p>Docutils supports inline math with the prefix or postfix <span class="docutils literal">:math:</span>
role specificator, <math xmlns="http://www.w3.org/1998/Math/MathML">
-<mrow><mi>n</mi><mo>!</mo><mo>+</mo><mo>sin</mo><mo>(</mo><msubsup><mi>x</mi><mi>n</mi><mn>2</mn></msubsup><mo>)</mo></mrow></math> and <math xmlns="http://www.w3.org/1998/Math/MathML">
-<mrow><msub><mi>A</mi><mtext>c</mtext></msub><mo>=</mo><mfrac>
-<mrow><mi>π</mi></mrow>
-<mrow><mn>4</mn></mrow></mfrac><msup><mi>d</mi><mn>2</mn></msup></mrow></math>, as well as displayed math via the
+ <mrow>
+ <mi>n</mi><mo>!</mo><mo>+</mo><mo>sin</mo><mo>(</mo>
+ <msubsup>
+ <mi>x</mi><mi>n</mi><mn>2</mn>
+ </msubsup>
+ <mo>)</mo>
+ </mrow>
+</math> and <math xmlns="http://www.w3.org/1998/Math/MathML">
+ <mrow>
+ <msub>
+ <mi>A</mi><mtext>c</mtext>
+ </msub>
+ <mo>=</mo>
+ <mfrac>
+ <mrow>
+ <mi>π</mi>
+ </mrow>
+ <mrow>
+ <mn>4</mn>
+ </mrow>
+ </mfrac>
+ <msup>
+ <mi>d</mi><mn>2</mn>
+ </msup>
+ </mrow>
+</math>, as well as displayed math via the
<cite>math</cite> directive:</p>
<div>
<math xmlns="http://www.w3.org/1998/Math/MathML" display="block">
-<mtable class="align" displaystyle="true">
-<mtr>
-<mtd><mi>f</mi><mo>(</mo><mi>ϵ</mi><mo>)</mo><mo>=</mo><mfrac>
-<mrow><mn>1</mn></mrow>
-<mrow><mn>1</mn><mo>+</mo><mo>exp</mo>
-<mrow><mo>(</mo><mfrac>
-<mrow><mi>ε</mi></mrow>
-<mrow><msub><mi>k</mi><mtext>B</mtext></msub><mi>T</mi></mrow></mfrac><mo>)</mo></mrow></mrow></mfrac></mtd></mtr></mtable></math>
+ <mtable class="align" displaystyle="true">
+ <mtr>
+ <mtd>
+ <mi>f</mi><mo>(</mo><mi>ϵ</mi><mo>)</mo><mo>=</mo>
+ <mfrac>
+ <mrow>
+ <mn>1</mn>
+ </mrow>
+ <mrow>
+ <mn>1</mn><mo>+</mo><mo>exp</mo>
+ <mrow>
+ <mo>(</mo>
+ <mfrac>
+ <mrow>
+ <mi>ε</mi>
+ </mrow>
+ <mrow>
+ <msub>
+ <mi>k</mi><mtext>B</mtext>
+ </msub>
+ <mi>T</mi>
+ </mrow>
+ </mfrac>
+ <mo>)</mo>
+ </mrow>
+ </mrow>
+ </mfrac>
+ </mtd>
+ </mtr>
+ </mtable>
+</math>
</div>
<p>Content may start on the first line of the directive, e.g.</p>
<div>
<math xmlns="http://www.w3.org/1998/Math/MathML" display="block">
-<mtable class="align" displaystyle="true">
-<mtr>
-<mtd><mi>N</mi><mo>=</mo><mfrac>
-<mrow><mtext>number of apples</mtext></mrow>
-<mrow><mn>7</mn></mrow></mfrac></mtd></mtr></mtable></math>
+ <mtable class="align" displaystyle="true">
+ <mtr>
+ <mtd>
+ <mi>N</mi><mo>=</mo>
+ <mfrac>
+ <mrow>
+ <mtext>number of apples</mtext>
+ </mrow>
+ <mrow>
+ <mn>7</mn>
+ </mrow>
+ </mfrac>
+ </mtd>
+ </mtr>
+ </mtable>
+</math>
</div>
<p>Equations can be labeled with a reference name using the <span class="docutils literal">:name:</span> option.
See <a class="reference internal" href="#eq-m">eq:M</a> and <a class="reference internal" href="#eq-schrodinger">eq:schrödinger</a> below.</p>
@@ -44,40 +100,105 @@
<p>The determinant of the matrix</p>
<div id="eq-m">
<math xmlns="http://www.w3.org/1998/Math/MathML" display="block">
-<mtable class="align" displaystyle="true">
-<mtr>
-<mtd><mstyle mathvariant="bold">
-<mrow><mi>M</mi></mrow></mstyle><mo>=</mo>
-<mrow><mo>(</mo>
-<mtable>
-<mtr>
-<mtd><mi>a</mi></mtd>
-<mtd><mi>b</mi></mtd></mtr>
-<mtr>
-<mtd><mi>c</mi></mtd>
-<mtd><mi>d</mi></mtd></mtr></mtable><mo>)</mo></mrow></mtd></mtr></mtable></math>
+ <mtable class="align" displaystyle="true">
+ <mtr>
+ <mtd>
+ <mstyle mathvariant="bold">
+ <mrow>
+ <mi>M</mi>
+ </mrow>
+ </mstyle>
+ <mo>=</mo>
+ <mrow>
+ <mo>(</mo>
+ <mtable>
+ <mtr>
+ <mtd>
+ <mi>a</mi>
+ </mtd>
+ <mtd>
+ <mi>b</mi>
+ </mtd>
+ </mtr>
+ <mtr>
+ <mtd>
+ <mi>c</mi>
+ </mtd>
+ <mtd>
+ <mi>d</mi>
+ </mtd>
+ </mtr>
+ </mtable>
+ <mo>)</mo>
+ </mrow>
+ </mtd>
+ </mtr>
+ </mtable>
+</math>
</div>
<p>is <math xmlns="http://www.w3.org/1998/Math/MathML">
-<mrow><mo>|</mo><mstyle mathvariant="bold">
-<mrow><mi>M</mi></mrow></mstyle><mo>|</mo><mo>=</mo><mi>a</mi><mi>d</mi><mo>-</mo><mi>b</mi><mi>c</mi></mrow></math>.</p>
+ <mrow>
+ <mo>|</mo>
+ <mstyle mathvariant="bold">
+ <mrow>
+ <mi>M</mi>
+ </mrow>
+ </mstyle>
+ <mo>|</mo><mo>=</mo><mi>a</mi><mi>d</mi><mo>-</mo><mi>b</mi><mi>c</mi>
+ </mrow>
+</math>.</p>
<p>More than one display math block can be put in one math directive.
For example, the following sum and integral with limits:</p>
<div>
<math xmlns="http://www.w3.org/1998/Math/MathML" display="block">
-<mtable class="align" displaystyle="true">
-<mtr>
-<mtd><munderover><mo>∫</mo><mn>0</mn><mn>1</mn></munderover><msup><mi>x</mi><mi>n</mi></msup><mi>d</mi><mi>x</mi><mo>=</mo><mfrac>
-<mrow><mn>1</mn></mrow>
-<mrow><mi>n</mi><mo>+</mo><mn>1</mn></mrow></mfrac></mtd></mtr></mtable></math>
+ <mtable class="align" displaystyle="true">
+ <mtr>
+ <mtd>
+ <munderover>
+ <mo>∫</mo><mn>0</mn><mn>1</mn>
+ </munderover>
+ <msup>
+ <mi>x</mi><mi>n</mi>
+ </msup>
+ <mi>d</mi><mi>x</mi><mo>=</mo>
+ <mfrac>
+ <mrow>
+ <mn>1</mn>
+ </mrow>
+ <mrow>
+ <mi>n</mi><mo>+</mo><mn>1</mn>
+ </mrow>
+ </mfrac>
+ </mtd>
+ </mtr>
+ </mtable>
+</math>
</div>
<div>
<math xmlns="http://www.w3.org/1998/Math/MathML" display="block">
-<mtable class="align" displaystyle="true">
-<mtr>
-<mtd><munderover><mo>∑</mo>
-<mrow><mi>n</mi><mo>=</mo><mn>1</mn></mrow><mi>m</mi></munderover><mi>n</mi><mo>=</mo><mfrac>
-<mrow><mi>m</mi><mo>(</mo><mi>m</mi><mo>+</mo><mn>1</mn><mo>)</mo></mrow>
-<mrow><mn>2</mn></mrow></mfrac></mtd></mtr></mtable></math>
+ <mtable class="align" displaystyle="true">
+ <mtr>
+ <mtd>
+ <munderover>
+ <mo>∑</mo>
+ <mrow>
+ <mi>n</mi><mo>=</mo><mn>1</mn>
+ </mrow>
+ <mi>m</mi>
+ </munderover>
+ <mi>n</mi><mo>=</mo>
+ <mfrac>
+ <mrow>
+ <mi>m</mi><mo>(</mo><mi>m</mi><mo>+</mo><mn>1</mn><mo>)</mo>
+ </mrow>
+ <mrow>
+ <mn>2</mn>
+ </mrow>
+ </mfrac>
+ </mtd>
+ </mtr>
+ </mtable>
+</math>
</div>
<p>LaTeX-supported Unicode math symbols can be used in math roles and
directives:</p>
@@ -84,15 +205,36 @@
<p>The Schrödinger equation</p>
<div id="eq-schrodinger">
<math xmlns="http://www.w3.org/1998/Math/MathML" display="block">
-<mtable class="align" displaystyle="true">
-<mtr>
-<mtd><mi>i</mi><mi>ℏ</mi><mfrac>
-<mrow><mo>∂</mo></mrow>
-<mrow><mo>∂</mo><mi>t</mi></mrow></mfrac><mo>Ψ</mo><mo>=</mo><mover>
-<mrow><mi>H</mi></mrow><mo>^</mo></mover><mo>Ψ</mo><mo>,</mo></mtd></mtr></mtable></math>
+ <mtable class="align" displaystyle="true">
+ <mtr>
+ <mtd>
+ <mi>i</mi><mi>ℏ</mi>
+ <mfrac>
+ <mrow>
+ <mo>∂</mo>
+ </mrow>
+ <mrow>
+ <mo>∂</mo><mi>t</mi>
+ </mrow>
+ </mfrac>
+ <mo>Ψ</mo><mo>=</mo>
+ <mover>
+ <mrow>
+ <mi>H</mi>
+ </mrow>
+ <mo>^</mo>
+ </mover>
+ <mo>Ψ</mo><mo>,</mo>
+ </mtd>
+ </mtr>
+ </mtable>
+</math>
</div>
<p>with the <em>wave function</em> <math xmlns="http://www.w3.org/1998/Math/MathML">
-<mrow><mo>Ψ</mo></mrow></math>, describes how the quantum state of a
+ <mrow>
+ <mo>Ψ</mo>
+ </mrow>
+</math>, describes how the quantum state of a
physical system changes in time.</p>
<dl>
<dt>Math-Accents:</dt>
@@ -104,44 +246,128 @@
</colgroup>
<tbody>
<tr><td><p><math xmlns="http://www.w3.org/1998/Math/MathML">
-<mrow><mover>
-<mrow><mi>a</mi></mrow><mo>´</mo></mover></mrow></math> <span class="docutils literal">\acute{a}</span></p></td>
+ <mrow>
+ <mover>
+ <mrow>
+ <mi>a</mi>
+ </mrow>
+ <mo>´</mo>
+ </mover>
+ </mrow>
+</math> <span class="docutils literal">\acute{a}</span></p></td>
<td><p><math xmlns="http://www.w3.org/1998/Math/MathML">
-<mrow><mover>
-<mrow><mi>t</mi></mrow><mo>˙</mo></mover></mrow></math> <span class="docutils literal">\dot{t}</span></p></td>
+ <mrow>
+ <mover>
+ <mrow>
+ <mi>t</mi>
+ </mrow>
+ <mo>˙</mo>
+ </mover>
+ </mrow>
+</math> <span class="docutils literal">\dot{t}</span></p></td>
<td><p><math xmlns="http://www.w3.org/1998/Math/MathML">
-<mrow><mover>
-<mrow><mi>γ</mi></mrow><mo>^</mo></mover></mrow></math> <span class="docutils literal"><span class="pre">\hat{\gamma}</span></span></p></td>
+ <mrow>
+ <mover>
+ <mrow>
+ <mi>γ</mi>
+ </mrow>
+ <mo>^</mo>
+ </mover>
+ </mrow>
+</math> <span class="docutils literal"><span class="pre">\hat{\gamma}</span></span></p></td>
</tr>
<tr><td><p><math xmlns="http://www.w3.org/1998/Math/MathML">
-<mrow><mover>
-<mrow><mi>a</mi></mrow><mo>`</mo></mover></mrow></math> <span class="docutils literal">\grave{a}</span></p></td>
+ <mrow>
+ <mover>
+ <mrow>
+ <mi>a</mi>
+ </mrow>
+ <mo>`</mo>
+ </mover>
+ </mrow>
+</math> <span class="docutils literal">\grave{a}</span></p></td>
<td><p><math xmlns="http://www.w3.org/1998/Math/MathML">
-<mrow><mover>
-<mrow><mi>t</mi></mrow><mo>¨</mo></mover></mrow></math> <span class="docutils literal">\ddot{t}</span></p></td>
+ <mrow>
+ <mover>
+ <mrow>
+ <mi>t</mi>
+ </mrow>
+ <mo>¨</mo>
+ </mover>
+ </mrow>
+</math> <span class="docutils literal">\ddot{t}</span></p></td>
<td><p><math xmlns="http://www.w3.org/1998/Math/MathML">
-<mrow><mover>
-<mrow><mi>α</mi></mrow><mo>˜</mo></mover></mrow></math> <span class="docutils literal"><span class="pre">\tilde{\alpha}</span></span></p></td>
+ <mrow>
+ <mover>
+ <mrow>
+ <mi>α</mi>
+ </mrow>
+ <mo>˜</mo>
+ </mover>
+ </mrow>
+</math> <span class="docutils literal"><span class="pre">\tilde{\alpha}</span></span></p></td>
</tr>
<tr><td><p><math xmlns="http://www.w3.org/1998/Math/MathML">
-<mrow><mover>
-<mrow><mi>x</mi></mrow><mo>˘</mo></mover></mrow></math> <span class="docutils literal">\breve{x}</span></p></td>
+ <mrow>
+ <mover>
+ <mrow>
+ <mi>x</mi>
+ </mrow>
+ <mo>˘</mo>
+ </mover>
+ </mrow>
+</math> <span class="docutils literal">\breve{x}</span></p></td>
<td><p><math xmlns="http://www.w3.org/1998/Math/MathML">
-<mrow><mover>
-<mrow><mi>t</mi></mrow><mo>⃛</mo></mover></mrow></math> <span class="docutils literal">\dddot{t}</span></p></td>
+ <mrow>
+ <mover>
+ <mrow>
+ <mi>t</mi>
+ </mrow>
+ <mo>⃛</mo>
+ </mover>
+ </mrow>
+</math> <span class="docutils literal">\dddot{t}</span></p></td>
<td><p><math xmlns="http://www.w3.org/1998/Math/MathML">
-<mrow><mover>
-<mrow><mi>ı</mi></mrow><mo>⃗</mo></mover></mrow></math> <span class="docutils literal"><span class="pre">\vec{\imath}</span></span></p></td>
+ <mrow>
+ <mover>
+ <mrow>
+ <mi>ı</mi>
+ </mrow>
+ <mo>⃗</mo>
+ </mover>
+ </mrow>
+</math> <span class="docutils literal"><span class="pre">\vec{\imath}</span></span></p></td>
</tr>
<tr><td><p><math xmlns="http://www.w3.org/1998/Math/MathML">
-<mrow><mover>
-<mrow><mi>a</mi></mrow><mo>ˇ</mo></mover></mrow></math> <span class="docutils literal">\check{a}</span></p></td>
+ <mrow>
+ <mover>
+ <mrow>
+ <mi>a</mi>
+ </mrow>
+ <mo>ˇ</mo>
+ </mover>
+ </mrow>
+</math> <span class="docutils literal">\check{a}</span></p></td>
<td><p><math xmlns="http://www.w3.org/1998/Math/MathML">
-<mrow><mover>
-<mrow><mi>a</mi></mrow><mo>¯</mo></mover></mrow></math> <span class="docutils literal">\bar{a}</span></p></td>
+ <mrow>
+ <mover>
+ <mrow>
+ <mi>a</mi>
+ </mrow>
+ <mo>¯</mo>
+ </mover>
+ </mrow>
+</math> <span class="docutils literal">\bar{a}</span></p></td>
<td><p><math xmlns="http://www.w3.org/1998/Math/MathML">
-<mrow><mover>
-<mrow><mi>R</mi></mrow><mo>⃗</mo></mover></mrow></math> <span class="docutils literal">\vec{R}</span></p></td>
+ <mrow>
+ <mover>
+ <mrow>
+ <mi>R</mi>
+ </mrow>
+ <mo>⃗</mo>
+ </mover>
+ </mrow>
+</math> <span class="docutils literal">\vec{R}</span></p></td>
</tr>
</tbody>
</table>
@@ -152,25 +378,90 @@
<p>Modulation Transfer Function:</p>
<div>
<math xmlns="http://www.w3.org/1998/Math/MathML" display="block">
-<mtable class="align" displaystyle="true">
-<mtr>
-<mtd><mtext>MTF</mtext><mo>=</mo>
-<mrow><mo>|</mo><mfrac>
-<mrow><mi>ℱ</mi><mo>{</mo><mi>s</mi><mo>(</mo><mi>x</mi><mo>)</mo><mo>}</mo></mrow>
-<mrow><mi>ℱ</mi><mo>{</mo><mi>s</mi><mo>(</mo><mi>x</mi><mo>)</mo><mo>}</mo><msub><mo>|</mo>
-<mrow><msub><mi>ω</mi>
-<mrow><mi>x</mi></mrow></msub><mo>=</mo><mn>0</mn></mrow></msub></mrow></mfrac><mo>|</mo></mrow><mo>=</mo><mtext>abs</mtext>
-<mrow><mo>(</mo><mfrac>
-<mrow><munderover><mo>∫</mo>
-<mrow><mo>-</mo><mo>∞</mo></mrow>
-<mrow><mo>∞</mo></mrow></munderover><mi>s</mi><mo>(</mo><mi>x</mi><mo>)</mo><msup><mtext>e</mtext>
-<mrow><mtext>i</mtext><msub><mi>ω</mi>
-<mrow><mi>x</mi></mrow></msub><mi>x</mi></mrow></msup><mtext>d</mtext>
-<mrow><mi>x</mi></mrow></mrow>
-<mrow><munderover><mo>∫</mo>
-<mrow><mo>-</mo><mo>∞</mo></mrow>
-<mrow><mo>∞</mo></mrow></munderover><mi>s</mi><mo>(</mo><mi>x</mi><mo>)</mo><mtext>d</mtext>
-<mrow><mi>x</mi></mrow></mrow></mfrac><mo>)</mo></mrow><mo>.</mo></mtd></mtr></mtable></math>
+ <mtable class="align" displaystyle="true">
+ <mtr>
+ <mtd>
+ <mtext>MTF</mtext><mo>=</mo>
+ <mrow>
+ <mo>|</mo>
+ <mfrac>
+ <mrow>
+ <mi>ℱ</mi><mo>{</mo><mi>s</mi><mo>(</mo><mi>x</mi><mo>)</mo><mo>}</mo>
+ </mrow>
+ <mrow>
+ <mi>ℱ</mi><mo>{</mo><mi>s</mi><mo>(</mo><mi>x</mi><mo>)</mo><mo>}</mo>
+ <msub>
+ <mo>|</mo>
+ <mrow>
+ <msub>
+ <mi>ω</mi>
+ <mrow>
+ <mi>x</mi>
+ </mrow>
+ </msub>
+ <mo>=</mo><mn>0</mn>
+ </mrow>
+ </msub>
+ </mrow>
+ </mfrac>
+ <mo>|</mo>
+ </mrow>
+ <mo>=</mo><mtext>abs</mtext>
+ <mrow>
+ <mo>(</mo>
+ <mfrac>
+ <mrow>
+ <munderover>
+ <mo>∫</mo>
+ <mrow>
+ <mo>-</mo><mo>∞</mo>
+ </mrow>
+ <mrow>
+ <mo>∞</mo>
+ </mrow>
+ </munderover>
+ <mi>s</mi><mo>(</mo><mi>x</mi><mo>)</mo>
+ <msup>
+ <mtext>e</mtext>
+ <mrow>
+ <mtext>i</mtext>
+ <msub>
+ <mi>ω</mi>
+ <mrow>
+ <mi>x</mi>
+ </mrow>
+ </msub>
+ <mi>x</mi>
+ </mrow>
+ </msup>
+ <mtext>d</mtext>
+ <mrow>
+ <mi>x</mi>
+ </mrow>
+ </mrow>
+ <mrow>
+ <munderover>
+ <mo>∫</mo>
+ <mrow>
+ <mo>-</mo><mo>∞</mo>
+ </mrow>
+ <mrow>
+ <mo>∞</mo>
+ </mrow>
+ </munderover>
+ <mi>s</mi><mo>(</mo><mi>x</mi><mo>)</mo><mtext>d</mtext>
+ <mrow>
+ <mi>x</mi>
+ </mrow>
+ </mrow>
+ </mfrac>
+ <mo>)</mo>
+ </mrow>
+ <mo>.</mo>
+ </mtd>
+ </mtr>
+ </mtable>
+</math>
</div>
<p>Math split over two lines: If a double backslash is detected outside a
<span class="docutils literal"><span class="pre">\begin{...}</span> <span class="pre">\end{...}</span></span> pair, the math code is wrapped in an <a class="reference external" href="ftp://ftp.ams.org/ams/doc/amsmath/short-math-guide.pdf">AMSmath</a>
@@ -177,31 +468,86 @@
<span class="docutils literal">align</span> environment:</p>
<div>
<math xmlns="http://www.w3.org/1998/Math/MathML" display="block">
-<mtable class="align" displaystyle="true">
-<mtr>
-<mtd><msub><mi>s</mi>
-<mrow><mtext>out</mtext></mrow></msub><mo>(</mo><mi>x</mi><mo>)</mo></mtd>
-<mtd><mo>=</mo><msub><mi>s</mi>
-<mrow><mtext>in</mtext></mrow></msub><mo>(</mo><mi>x</mi><mo>'</mo><mo>)</mo><mo>*</mo><msub><mi>s</mi><mi>δ</mi></msub><mo>(</mo><mi>x</mi><mo>-</mo><mi>x</mi><mo>'</mo><mo>)</mo></mtd></mtr>
-<mtr>
-<mtd></mtd>
-<mtd><mo>=</mo><mo>∫</mo><msub><mi>s</mi>
-<mrow><mtext>in</mtext></mrow></msub><mo>(</mo><mi>x</mi><mo>'</mo><mo>)</mo><msub><mi>s</mi><mi>δ</mi></msub><mo>(</mo><mi>x</mi><mo>-</mo><mi>x</mi><mo>'</mo><mo>)</mo><mtext>d</mtext><mi>x</mi><mo>'</mo></mtd></mtr></mtable></math>
+ <mtable class="align" displaystyle="true">
+ <mtr>
+ <mtd>
+ <msub>
+ <mi>s</mi>
+ <mrow>
+ <mtext>out</mtext>
+ </mrow>
+ </msub>
+ <mo>(</mo><mi>x</mi><mo>)</mo>
+ </mtd>
+ <mtd>
+ <mo>=</mo>
+ <msub>
+ <mi>s</mi>
+ <mrow>
+ <mtext>in</mtext>
+ </mrow>
+ </msub>
+ <mo>(</mo><mi>x</mi><mo>'</mo><mo>)</mo><mo>*</mo>
+ <msub>
+ <mi>s</mi><mi>δ</mi>
+ </msub>
+ <mo>(</mo><mi>x</mi><mo>-</mo><mi>x</mi><mo>'</mo><mo>)</mo>
+ </mtd>
+ </mtr>
+ <mtr>
+ <mtd>
+ </mtd>
+ <mtd>
+ <mo>=</mo><mo>∫</mo>
+ <msub>
+ <mi>s</mi>
+ <mrow>
+ <mtext>in</mtext>
+ </mrow>
+ </msub>
+ <mo>(</mo><mi>x</mi><mo>'</mo><mo>)</mo>
+ <msub>
+ <mi>s</mi><mi>δ</mi>
+ </msub>
+ <mo>(</mo><mi>x</mi><mo>-</mo><mi>x</mi><mo>'</mo><mo>)</mo><mtext>d</mtext><mi>x</mi><mo>'</mo>
+ </mtd>
+ </mtr>
+ </mtable>
+</math>
</div>
<p>Cases ("manually", with <span class="docutils literal">matrix</span> environment):</p>
<div>
<math xmlns="http://www.w3.org/1998/Math/MathML" display="block">
-<mtable class="align" displaystyle="true">
-<mtr>
-<mtd><mtext>sgn</mtext><mo>(</mo><mi>x</mi><mo>)</mo><mo>=</mo>
-<mrow><mo>{</mo>
-<mtable>
-<mtr>
-<mtd><mo>-</mo><mn>1</mn></mtd>
-<mtd><mi>x</mi><mo><</mo><mn>0</mn></mtd></mtr>
-<mtr>
-<mtd><mn>1</mn></mtd>
-<mtd><mi>x</mi><mo>></mo><mn>0</mn></mtd></mtr></mtable><mo></mo></mrow></mtd></mtr></mtable></math>
+ <mtable class="align" displaystyle="true">
+ <mtr>
+ <mtd>
+ <mtext>sgn</mtext><mo>(</mo><mi>x</mi><mo>)</mo><mo>=</mo>
+ <mrow>
+ <mo>{</mo>
+ <mtable>
+ <mtr>
+ <mtd>
+ <mo>-</mo><mn>1</mn>
+ </mtd>
+ <mtd>
+ <mi>x</mi><mo><</mo><mn>0</mn>
+ </mtd>
+ </mtr>
+ <mtr>
+ <mtd>
+ <mn>1</mn>
+ </mtd>
+ <mtd>
+ <mi>x</mi><mo>></mo><mn>0</mn>
+ </mtd>
+ </mtr>
+ </mtable>
+ <mo></mo>
+ </mrow>
+ </mtd>
+ </mtr>
+ </mtable>
+</math>
</div>
<p>Cases with the <a class="reference external" href="ftp://ftp.ams.org/ams/doc/amsmath/short-math-guide.pdf">AMSmath</a> <span class="docutils literal">cases</span> environment (not (yet) supported by
HTML writers with <span class="docutils literal"><span class="pre">--math-output=MathML</span></span>):</p>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|