|
From: <mi...@us...> - 2021-05-20 12:22:07
|
Revision: 8747
http://sourceforge.net/p/docutils/code/8747
Author: milde
Date: 2021-05-20 12:22:05 +0000 (Thu, 20 May 2021)
Log Message:
-----------
MathML update: math alphabets, tex_token(), add documentation.
* math alphabets: Use token elements for single symbols or names.
* tex_token: skip whitespace after command names.
* comprehensive documentation/test document.
Modified Paths:
--------------
trunk/docutils/docutils/utils/math/latex2mathml.py
trunk/docutils/test/functional/expected/math_output_mathml.html
Added Paths:
-----------
trunk/docutils/test/functional/input/data/comprehensive-math-test.txt
Modified: trunk/docutils/docutils/utils/math/latex2mathml.py
===================================================================
--- trunk/docutils/docutils/utils/math/latex2mathml.py 2021-05-20 12:21:48 UTC (rev 8746)
+++ trunk/docutils/docutils/utils/math/latex2mathml.py 2021-05-20 12:22:05 UTC (rev 8747)
@@ -80,70 +80,7 @@
}
# blackboar bold (Greek characters not working with "mathvariant" (Firefox 78)
-mathbb = {
- '0': u'\U0001D7D8', # 𝟘
- '1': u'\U0001D7D9', # 𝟙
- '2': u'\U0001D7DA', # 𝟚
- '3': u'\U0001D7DB', # 𝟛
- '4': u'\U0001D7DC', # 𝟜
- '5': u'\U0001D7DD', # 𝟝
- '6': u'\U0001D7DE', # 𝟞
- '7': u'\U0001D7DF', # 𝟟
- '8': u'\U0001D7E0', # 𝟠
- '9': u'\U0001D7E1', # 𝟡
- 'A': u'\U0001D538', # 𝔸
- 'B': u'\U0001D539', # 𝔹
- 'C': u'\u2102', # ℂ
- 'D': u'\U0001D53B', # 𝔻
- 'E': u'\U0001D53C', # 𝔼
- 'F': u'\U0001D53D', # 𝔽
- 'G': u'\U0001D53E', # 𝔾
- 'H': u'\u210D', # ℍ
- 'I': u'\U0001D540', # 𝕀
- 'J': u'\U0001D541', # 𝕁
- 'K': u'\U0001D542', # 𝕂
- 'L': u'\U0001D543', # 𝕃
- 'M': u'\U0001D544', # 𝕄
- 'N': u'\u2115', # ℕ
- 'O': u'\U0001D546', # 𝕆
- 'P': u'\u2119', # ℙ
- 'Q': u'\u211A', # ℚ
- 'R': u'\u211D', # ℝ
- 'S': u'\U0001D54A', # 𝕊
- 'T': u'\U0001D54B', # 𝕋
- 'U': u'\U0001D54C', # 𝕌
- 'V': u'\U0001D54D', # 𝕍
- 'W': u'\U0001D54E', # 𝕎
- 'X': u'\U0001D54F', # 𝕏
- 'Y': u'\U0001D550', # 𝕐
- 'Z': u'\u2124', # ℤ
- 'a': u'\U0001D552', # 𝕒
- 'b': u'\U0001D553', # 𝕓
- 'c': u'\U0001D554', # 𝕔
- 'd': u'\U0001D555', # 𝕕
- 'e': u'\U0001D556', # 𝕖
- 'f': u'\U0001D557', # 𝕗
- 'g': u'\U0001D558', # 𝕘
- 'h': u'\U0001D559', # 𝕙
- 'i': u'\U0001D55A', # 𝕚
- 'j': u'\U0001D55B', # 𝕛
- 'k': u'\U0001D55C', # 𝕜
- 'l': u'\U0001D55D', # 𝕝
- 'm': u'\U0001D55E', # 𝕞
- 'n': u'\U0001D55F', # 𝕟
- 'o': u'\U0001D560', # 𝕠
- 'p': u'\U0001D561', # 𝕡
- 'q': u'\U0001D562', # 𝕢
- 'r': u'\U0001D563', # 𝕣
- 's': u'\U0001D564', # 𝕤
- 't': u'\U0001D565', # 𝕥
- 'u': u'\U0001D566', # 𝕦
- 'v': u'\U0001D567', # 𝕧
- 'w': u'\U0001D568', # 𝕨
- 'x': u'\U0001D569', # 𝕩
- 'y': u'\U0001D56A', # 𝕪
- 'z': u'\U0001D56B', # 𝕫
- u'Γ': u'\u213E', # ℾ
+mathbb = {u'Γ': u'\u213E', # ℾ
u'Π': u'\u213F', # ℿ
u'Σ': u'\u2140', # ⅀
u'γ': u'\u213D', # ℽ
@@ -250,6 +187,18 @@
'vec': u'\u20D7'}
+# all supported math-characters:
+#mathcharacters = dict(letters)
+#mathcharacters.update(operators)
+#mathcharacters.update(tex2unichar.space)
+#
+## >>> l2m.mathcharacters['alpha']
+## 'α'
+## >>> l2m.mathcharacters['{']
+## '{'
+## >>> l2m.mathcharacters['pm']
+## '±'
+
# MathML element classes
# ----------------------
@@ -491,27 +440,39 @@
def tex_cmdname(string):
"""Return leading TeX command name from `string`.
- >>> l2m.tex_cmdname('name2') # first non-letter terminates
+ >>> l2m.tex_cmdname('name2') # up to first non-letter
('name', '2')
+ >>> l2m.tex_cmdname('name 2') # strip trailing whitespace
+ ('name', '2')
>>> l2m.tex_cmdname('_2') # single non-letter character
('_', '2')
"""
- cmdname = re.match(r'([a-zA-Z]+|.?)(.*)', string)
- return cmdname.group(1), cmdname.group(2)
+ m = re.match(r'([a-zA-Z]+) *(.*)', string)
+ if m is None:
+ m = re.match(r'(.?)(.*)', string)
+ return m.group(1), m.group(2)
# Test:
#
-# >>> l2m.tex_cmdname('name 2') # first non-letter terminates
-# ('name', ' 2')
# >>> l2m.tex_cmdname('name_2') # first non-letter terminates
# ('name', '_2')
-# >>> l2m.tex_cmdname(' 2') # leading whitespace is returned
-# (' ', '2')
+# >>> l2m.tex_cmdname(' next') # leading whitespace is returned
+# (' ', 'next')
+# >>> l2m.tex_cmdname('1 2') # whitespace after non-letter is kept
+# ('1', ' 2')
# >>> l2m.tex_cmdname('') # empty string
# ('', '')
+# TODO: check for Inferred <mrow>s:
+
+# The elements <msqrt>, <mstyle>, <merror>, <mpadded>, <mphantom>, <menclose>,
+# <mtd, mscarry>, and <math> treat their contents as a single inferred mrow
+# formed from all their children
+#
+# --- https://www.w3.org/TR/MathML3/chapter3.html#id.3.1.3.2
+
def tex_token(string):
"""Take first simple TeX token from `string`.
@@ -526,21 +487,22 @@
"""
m = re.match(r"""\s* # leading whitespace
- (?P<token>
- ({(\\}|[^{}]|\\{)*} # {group} without nested groups
- |\\([a-zA-Z]+|.) # \cmdname
- |.?) # first character or empty string
- )
+ {(?P<token>(\\}|[^{}]|\\{)*)} # {group} without nested groups
+ (?P<remainder>.*$)
+ """, string, re.VERBOSE)
+ if m is None:
+ m = re.match(r"""\s* # leading whitespace
+ (?P<token>\\([a-zA-Z]+))\s* # \cmdname
(?P<remainder>.*$)
""", string, re.VERBOSE)
+ if m is None:
+ m = re.match(r"""\s* # leading whitespace
+ (?P<token>.?) # first character or empty string
+ (?P<remainder>.*$)
+ """, string, re.VERBOSE)
- # strip {brackets}
- token = m.group('token')
- if token.startswith('{') and token.endswith('}'):
- token = token[1:-1]
+ return m.group('token'), m.group('remainder')
- return token, m.group('remainder')
-
# Test:
#
# >>> l2m.tex_token('{opening bracket of group with {nested group}}')
@@ -553,8 +515,8 @@
# ('skip leading whitespace', '')
# >>> l2m.tex_token(' \\skip{leading whitespace}')
# ('\\skip', '{leading whitespace}')
-# >>> l2m.tex_token('\\leave trailing whitespace')
-# ('\\leave', ' trailing whitespace')
+# >>> l2m.tex_token('\\skip whitespace after macro name')
+# ('\\skip', 'whitespace after macro name')
# >>> l2m.tex_token('') # empty string.
# ('', '')
@@ -689,34 +651,36 @@
node = node.append(mo('⁡')) # '\u2061'
return node, string
- if name == 'mathrm':
- # typically used for multi-character identifier ``s_\mathrm{out}``
- # https://www.w3.org/TR/MathML3/chapter3.html#presm.mi
- # TODO: too much space after d in ``\int f(x) \mathrm{d}x``.
- arg, string = tex_token(string)
- node = node.append(mi(arg, mathvariant='normal'))
- # node = node.append(mo(arg))
- return node, string
+ if name in math_alphabets:
+ arg, remainder = tex_token(string)
+ if arg[0] == '\\':
+ if name == 'mathbb':
+ # mathvariant="double-struck" is ignored for Greek letters
+ # (tested in Firefox 78). Use literal Unicode characters.
+ arg = mathbb.get(arg, arg)
+ # convert single letters (so they can be set with <mi>)
+ arg = letters.get(arg[1:], arg)
- if name == 'mathbb':
- arg, string = tex_token(string)
- chs = arg
- while chs:
- c, chs = tex_token(chs)
- try:
- node = node.append(mi(mathbb[c]))
- except KeyError:
- raise SyntaxError(u'Character "%s" not supported '
- u'in "\\mathbb{}"!' % chs)
- return node, string
+ if name == 'boldsymbol':
+ kwargs = {'style': 'font-weight: bold'}
+ else:
+ kwargs = {'mathvariant': math_alphabets[name]}
- if name in math_alphabets:
- # TODO: use <mi> if it applies to just 1 character
- # Wrap in <style> (implies <mgroup>)
- n_c = None if string.startswith('{') else 1
- style = mstyle(nchildren=n_c, mathvariant=math_alphabets[name])
+ # one symbol (single letter, name, or number)
+ if arg.isalpha():
+ node = node.append(mi(arg, **kwargs))
+ return node, remainder
+ if arg.replace('.', '').replace(',', '').isdigit():
+ node = node.append(mn(arg, **kwargs))
+ return node, remainder
+ if len(arg) == 1 and arg != '{':
+ node = node.append(mo(arg, **kwargs))
+ return node, remainder
+
+ # Wrap in <style>
+ style = mstyle(**kwargs)
node.append(style)
- return style, string[1:]
+ return style, string[1:] # take of the opening '{', <mrow> is inferred
# operator, fence, or separator -> <mo>
@@ -835,9 +799,9 @@
# >>> l2m.handle_keyword('left', l2m.math(), '. a)') # emtpy \left
# (mrow(), ' a)')
# >>> l2m.handle_keyword('left', l2m.math(), '\\uparrow a)') # cmd
-# (mrow(mo('↑')), ' a)')
+# (mrow(mo('↑')), 'a)')
# >>> l2m.handle_keyword('not', l2m.math(), '\\equiv \\alpha)') # cmd
-# (math(mo('≢')), ' \\alpha)')
+# (math(mo('≢')), '\\alpha)')
# >>> l2m.handle_keyword('text', l2m.math(), '{ for } i>0') # group
# (math(mtext(' for ')), ' i>0')
# >>> l2m.handle_keyword('text', l2m.math(), '{B}T') # group
@@ -852,8 +816,11 @@
# (math(mi('sin'), mo('⁡')), ' \\alpha')
# >>> l2m.handle_keyword('operatorname', l2m.math(), '{abs}(x)')
# (math(mi('abs', mathvariant='normal'), mo('⁡')), '(x)')
+# >>> l2m.handle_keyword('mathrm', l2m.math(), '\\alpha')
+# (math(mi('α', mathvariant='normal')), '')
+# >>> l2m.handle_keyword('mathrm', l2m.math(), '{out} = 3')
+# (math(mi('out', mathvariant='normal')), ' = 3')
-
def tex2mathml(tex_math, inline=True):
"""Return string with MathML code corresponding to `tex_math`.
Modified: trunk/docutils/test/functional/expected/math_output_mathml.html
===================================================================
--- trunk/docutils/test/functional/expected/math_output_mathml.html 2021-05-20 12:21:48 UTC (rev 8746)
+++ trunk/docutils/test/functional/expected/math_output_mathml.html 2021-05-20 12:22:05 UTC (rev 8747)
@@ -103,10 +103,7 @@
<mtable class="align" displaystyle="true">
<mtr>
<mtd>
- <mstyle mathvariant="bold">
- <mi>M</mi>
- </mstyle>
- <mo>=</mo>
+ <mi mathvariant="bold">M</mi><mo>=</mo>
<mrow>
<mo>(</mo>
<mtable>
@@ -136,11 +133,7 @@
</div>
<p>is <math xmlns="http://www.w3.org/1998/Math/MathML">
<mrow>
- <mo stretchy="false">|</mo>
- <mstyle mathvariant="bold">
- <mi>M</mi>
- </mstyle>
- <mo stretchy="false">|</mo><mo>=</mo><mi>a</mi><mi>d</mi><mo>-</mo><mi>b</mi><mi>c</mi>
+ <mo stretchy="false">|</mo><mi mathvariant="bold">M</mi><mo stretchy="false">|</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.
@@ -382,16 +375,10 @@
<mo>|</mo>
<mfrac>
<mrow>
- <mstyle mathvariant="script">
- <mi>F</mi>
- </mstyle>
- <mo>{</mo><mi>s</mi><mo stretchy="false">(</mo><mi>x</mi><mo stretchy="false">)</mo><mo>}</mo>
+ <mi mathvariant="script">F</mi><mo>{</mo><mi>s</mi><mo stretchy="false">(</mo><mi>x</mi><mo stretchy="false">)</mo><mo>}</mo>
</mrow>
<mrow>
- <mstyle mathvariant="script">
- <mi>F</mi>
- </mstyle>
- <mo>{</mo><mi>s</mi><mo stretchy="false">(</mo><mi>x</mi><mo stretchy="false">)</mo><mo>}</mo>
+ <mi mathvariant="script">F</mi><mo>{</mo><mi>s</mi><mo stretchy="false">(</mo><mi>x</mi><mo stretchy="false">)</mo><mo>}</mo>
<msub>
<mo stretchy="false">|</mo>
<mrow>
Added: trunk/docutils/test/functional/input/data/comprehensive-math-test.txt
===================================================================
--- trunk/docutils/test/functional/input/data/comprehensive-math-test.txt (rev 0)
+++ trunk/docutils/test/functional/input/data/comprehensive-math-test.txt 2021-05-20 12:22:05 UTC (rev 8747)
@@ -0,0 +1,462 @@
+==================================
+Using LaTeX syntax for mathematics
+==================================
+
+.. role:: m(math)
+.. default-role:: math
+.. |latex| replace:: L\ :sup:`A`\ T\ :sub:`E`\ X
+
+.. contents::
+
+
+Introduction
+============
+
+Since version 0.8, Docutils supports mathematical content with a `"math"
+directive`__ and `role`__.
+The input format is *LaTeX math syntax*\ [#math-syntax]_ with support for
+Unicode symbols.
+
+
+.. [#math-syntax] The supported LaTeX commands include AMS extensions
+ (see, e.g., the `Short Math Guide`_).
+
+ The support is limited to a subset of *LaTeX math* by the conversion
+ required for many output formats. For HTML, the `math_output`_
+ configuration setting (or the corresponding ``--math-output`` command
+ line option) select between alternative output formats with different
+ subsets of supported elements. If a writer does not support math
+ typesetting at all, the content is inserted verbatim.
+
+__ https://docutils.sourceforge.io/docs/ref/rst/directives.html#math
+__ https://docutils.sourceforge.io/docs/ref/rst/roles.html#math
+.. _Short Math Guide:
+ http://mirrors.ctan.org/info/short-math-guide/short-math-guide.pdf
+.. _math_output:
+ https://docutils.sourceforge.io/docs/user/config.html#math-output
+
+
+Role and directive
+==================
+
+The ``math`` role can be used for inline mathematical expressions:
+``:math:`\psi(r) = \exp(-2r)``` will produce :m:`\psi(r)=\exp(-2r)`.
+Inside the backtics you can write anything you would write between dollar
+signs in a LaTeX document.
+
+For producing displayed math (like an ``equation*`` environment in a
+LaTeX document) there is a ``math`` directive. If you write::
+
+ .. math:: \psi(r) = e^{-2r}
+
+you will get:
+
+.. math:: \psi(r) = e^{-2r}
+
+A more complex example is the definition of the Fourier transform
+
+.. math::
+
+ (\mathcal{F}f)(y) =
+ \frac{1}{\sqrt{2\pi}^{\ n}}
+ \int_{\mathbb{R}^n} f(x)\,e^{-\mathrm{i} y \cdot x} \,\mathrm{d} x.
+
+
+.. tip::
+
+ If you put ``.. default-role:: math`` at the top of your
+ document, then you can write ```x^2``` instead of the longer
+ version: ``:math:`x^2```. You can also introduce an
+ abreviation like this ``.. role:: m(math)``. That will allow
+ you to write ``:m:`x^2``` or ```x^2`:m:``.
+
+
+Not *all* math syntax constructs work with every output format, but basic
+everyday-math should work.
+
+If a command or a special symbol is not desribed in this document, then
+it is probably not implemented in the internal LaTeX -> MathML converter.
+
+
+Commands
+========
+
+
+.. class:: colwidths-auto
+
+ ===================== ============================== ============================
+ command example result
+ ===================== ============================== ============================
+ ``\sqrt`` ``\sqrt{x^2-1}`` `\sqrt{x^2-1}`
+ ``\frac`` ``\frac{1}{2}`` `\frac{1}{2}`
+ ``\left``, ``\right`` ``\left(\frac{1}{2}\right)^n`` `\left(\frac{1}{2}\right)^n`
+ ===================== ============================== ============================
+
+
+Environments
+============
+
+Displayed math can use ``\\`` and ``&`` for line shifts and alignments::
+
+ .. math::
+
+ a & = (x + y)^2 \\
+ & = x^2 + 2xy + y^2
+
+LaTeX output will wrap it in an ``align*`` environment.
+The result is:
+
+.. math::
+
+ a & = (x + y)^2 \\
+ & = x^2 + 2xy + y^2
+
+The ``matrix`` and ``cases`` environments can also contain ``\\`` and
+``&``::
+
+ .. math::
+
+ \left(\begin{matrix} a & b \\ c & d \end{matrix}\right)
+
+Result:
+
+.. math::
+
+ \left(\begin{matrix} a & b \\ c & d \end{matrix}\right)
+
+
+Mathematical symbols
+====================
+
+The following tables are adapted from the first edition of
+"The LaTeX Companion" (Goossens, Mittelbach, Samarin).
+
+Accents
+-------
+.. class:: colwidths-auto
+
+ =========== ============= =========== ============= ============== ================
+ `\acute{x}` ``\acute{x}`` `\dot{x}` ``\dot{x}`` `\hat{H}` ``\hat{H}``
+ `\bar{v}` ``\bar{v}`` `\ddot{x}` ``\ddot{x}`` `\mathring{x}` ``\mathring{x}``
+ `\breve{x}` ``\breve{x}`` `\dddot{x}` ``\dddot{x}`` `\tilde{n}` ``\tilde{n}``
+ `\check{x}` ``\check{x}`` `\grave{x}` ``\grave{x}`` `\vec{R}` ``\vec{R}``
+ =========== ============= =========== ============= ============== ================
+
+When adding an accent to an i or j in math, dotless variants can be
+obtained with ``\imath`` and ``\jmath``: `\bar \imath`, `\hat{\jmath}`
+
+alphabets
+---------
+.. class:: colwidths-auto
+
+ =============== ============================ ==========================
+ command example result
+ =============== ============================ ==========================
+ ``\boldsymbol`` ``\boldsymbol{\alpha + 3}`` `\boldsymbol{\alpha + 3}`
+ ``\mathbf`` ``\mathbf{r}^2=x^2+y^2+z^2`` `\mathbf{r}^2=x^2+y^2+z^2`
+ ``\mathbb`` ``\mathbb{R \subset C}`` `\mathbb{R \subset C}`
+ ``\mathcal`` ``\mathcal{F}f(x)`` `\mathcal{F}f(x)`
+ ``\mathfrak`` ``\mathfrak{a}`` `\mathfrak{a}`
+ ``\mathit`` ``\mathit{\Gamma}`` `\mathit{\Gamma}`
+ ``\mathrm`` ``s_\mathrm{out}`` `s_\mathrm{out}`
+ ``\mathsf`` ``\mathsf x`` `\mathsf x`
+ ``\mathtt`` ``\mathtt{0.12}`` `\mathtt{0.12}`
+ =============== ============================ ==========================
+
+.. with isomath:
+ 'mathbfit': 'bold-italic', # isomath
+ 'mathsfit': 'sans-serif-italic', # isomath
+ 'mathsfbfit': 'sans-serif-bold-italic', # isomath
+ with mathrsfs, ... 'mathscr'
+
+
+Arrows
+------
+.. class:: colwidths-auto
+
+ ===================== ======================= ===================== =======================
+ `\leftarrow` ``\leftarrow`` `\Leftarrow` ``\Leftarrow``
+ `\rightarrow` ``\rightarrow`` `\Rightarrow` ``\Rightarrow``
+ `\leftrightarrow` ``\leftrightarrow`` `\Leftrightarrow` ``\Leftrightarrow``
+ `\uparrow` ``\uparrow`` `\Uparrow` ``\Uparrow``
+ `\downarrow` ``\downarrow`` `\Downarrow` ``\Downarrow``
+ `\updownarrow` ``\updownarrow`` `\Updownarrow` ``\Updownarrow``
+
+ `\longleftarrow` ``\longleftarrow`` `\Longleftarrow` ``\Longleftarrow``
+ `\longrightarrow` ``\longrightarrow`` `\Longrightarrow` ``\Longrightarrow``
+ `\longleftrightarrow` ``\longleftrightarrow`` `\Longleftrightarrow` ``\Longleftrightarrow``
+
+ `\nearrow` ``\nearrow`` `\leftharpoonup` ``\leftharpoonup``
+ `\searrow` ``\searrow`` `\rightharpoonup` ``\rightharpoonup``
+ `\swarrow` ``\swarrow`` `\leftharpoondown` ``\leftharpoondown``
+ `\nwarrow` ``\nwarrow`` `\rightharpoondown` ``\rightharpoondown``
+
+ `\mapsto` ``\mapsto`` `\hookleftarrow` ``\hookleftarrow``
+ `\longmapsto` ``\longmapsto`` `\hookrightarrow` ``\hookrightarrow``
+ ===================== ======================= ===================== =======================
+
+
+Binary operators
+----------------
+.. class:: colwidths-auto
+
+ ================== ==================== ================= =================== ================== ====================
+ `*` ``*`` `\circledast` ``\circledast`` `\odot` ``\odot``
+ `+` ``+`` `\circledcirc` ``\circledcirc`` `\ominus` ``\ominus``
+ `-` ``-`` `\circleddash` ``\circleddash`` `\oplus` ``\oplus``
+ `:` ``:`` `\cup` ``\cup`` `\oslash` ``\oslash``
+ `\Cap` ``\Cap`` `\curlyvee` ``\curlyvee`` `\otimes` ``\otimes``
+ `\Cup` ``\Cup`` `\curlywedge` ``\curlywedge`` `\pm` ``\pm``
+ `\amalg` ``\amalg`` `\dagger` ``\dagger`` `\rightthreetimes` ``\rightthreetimes``
+ `\ast` ``\ast`` `\ddagger` ``\ddagger`` `\rtimes` ``\rtimes``
+ `\bigcirc` ``\bigcirc`` `\diamond` ``\diamond`` `\setminus` ``\setminus``
+ `\bigtriangledown` ``\bigtriangledown`` `\div` ``\div`` `\smallsetminus` ``\smallsetminus``
+ `\bigtriangleup` ``\bigtriangleup`` `\divideontimes` ``\divideontimes`` `\sqcap` ``\sqcap``
+ `\boxdot` ``\boxdot`` `\dotplus` ``\dotplus`` `\sqcup` ``\sqcup``
+ `\boxminus` ``\boxminus`` `\doublebarwedge` ``\doublebarwedge`` `\star` ``\star``
+ `\boxplus` ``\boxplus`` `\gtrdot` ``\gtrdot`` `\times` ``\times``
+ `\boxtimes` ``\boxtimes`` `\intercal` ``\intercal`` `\triangleleft` ``\triangleleft``
+ `\bullet` ``\bullet`` `\leftthreetimes` ``\leftthreetimes`` `\triangleright` ``\triangleright``
+ `\cap` ``\cap`` `\lessdot` ``\lessdot`` `\uplus` ``\uplus``
+ `\cdot` ``\cdot`` `\ltimes` ``\ltimes`` `\vee` ``\vee``
+ `\centerdot` ``\centerdot`` `\mp` ``\mp`` `\veebar` ``\veebar``
+ `\circ` ``\circ`` `\wedge` ``\wedge``
+ .. `\wr` ``\wr``
+ ================== ==================== ================= =================== ================== ====================
+
+
+Braces
+------
+.. class:: colwidths-auto
+
+ ============ ============ ============ ============== ========================
+ `(` ``(`` `[` ``[`` `|` ``|`` `\{` ``\{`` `\langle` ``\langle``
+ `)` ``)`` `]` ``]`` `|` ``|`` `\}` ``\}`` `\rangle` ``\rangle``
+ ============ ============ ============ ============== ========================
+
+
+Greek letters
+-------------
+.. class:: colwidths-auto
+
+ ========== ============ ========== ============ ========== ============ ============== ===============
+ `\Gamma` ``\Gamma`` `\alpha` ``\alpha`` `\mu` ``\mu`` `\omega` ``\omega``
+ `\Delta` ``\Delta`` `\beta` ``\beta`` `\nu` ``\nu`` `\backepsilon` ``\backepsilon``
+ `\Lambda` ``\Lambda`` `\gamma` ``\gamma`` `\xi` ``\xi`` `\digamma` ``\digamma``
+ `\Omega` ``\Omega`` `\delta` ``\delta`` `\pi` ``\pi`` `\varepsilon` ``\varepsilon``
+ `\Phi` ``\Phi`` `\epsilon` ``\epsilon`` `\rho` ``\rho`` `\varkappa` ``\varkappa``
+ `\Pi` ``\Pi`` `\zeta` ``\zeta`` `\sigma` ``\sigma`` `\varphi` ``\varphi``
+ `\Psi` ``\Psi`` `\eta` ``\eta`` `\tau` ``\tau`` `\varpi` ``\varpi``
+ `\Sigma` ``\Sigma`` `\theta` ``\theta`` `\upsilon` ``\upsilon`` `\varrho` ``\varrho``
+ `\Theta` ``\Theta`` `\iota` ``\iota`` `\phi` ``\phi`` `\varsigma` ``\varsigma``
+ `\Upsilon` ``\Upsilon`` `\kappa` ``\kappa`` `\chi` ``\chi`` `\vartheta` ``\vartheta``
+ `\Xi` ``\Xi`` `\lambda` ``\lambda`` `\psi` ``\psi``
+ ========== ============ ========== ============ ========== ============ ============== ===============
+
+
+Letterlike symbols
+------------------
+.. class:: colwidths-auto
+
+======= ========== ============= =============== ========= =========== ========== ============
+`\Im` ``\Im`` `\forall` ``\forall`` `\aleph` ``\aleph`` `\eth` ``\eth``
+`\Re` ``\Re`` `\exists` ``\exists`` `\beth` ``\beth`` `\hbar` ``\hbar``
+`\mho` ``\mho`` `\complement` ``\complement`` `\gimel` ``\gimel`` `\hslash` ``\hslash``
+`\Bbbk` ``\Bbbk`` `\Finv` ``\Finv`` `\daleth` ``\daleth`` `\imath` ``\imath``
+`\ell` ``\ell`` `\Game` ``\Game`` `\nabla` ``\nabla`` `\partial` ``\partial``
+`\wp` ``\wp``
+======= ========== ============= =============== ========= =========== ========== ============
+
+
+Miscellaneous symbols
+---------------------
+.. class:: colwidths-auto
+
+======== =============== =========== ============= ============== ================ ========== ============
+`\angle` ``\angle`` `\emptyset` ``\emptyset`` `\clubsuit` ``\clubsuit`` `\flat` ``\flat``
+`\colon` ``\colon`` [#]_ `\infty` ``\infty`` `\diamondsuit` ``\diamondsuit`` `\natural` ``\natural``
+`\cdots` ``\cdots`` `\neg` ``\neg`` `\heartsuit` ``\heartsuit`` `\sharp` ``\sharp``
+`\ddots` ``\ddots`` `\bot` ``\bot`` `\spadesuit` ``\spadesuit``
+`\ddots` ``\ddots`` `\top` ``\top``
+======== =============== =========== ============= ============== ================ ========== ============
+
+.. [#] Punctuation (not ratio):
+ Compare spacing in `a\colon b\to c` and `a:b = c`.
+
+
+Named operators
+---------------
+.. class:: colwidths-auto
+
+ ========= =========== ====== ======== ====== ======== ======= =========
+ `\arccos` ``\arccos`` `\csc` ``\csc`` `\ker` ``\ker`` `\sec` ``\sec``
+ `\arcsin` ``\arcsin`` `\deg` ``\deg`` `\lg` ``\lg`` `\sin` ``\sin``
+ `\arctan` ``\arctan`` `\det` ``\det`` `\lim` ``\lim`` `\sinh` ``\sinh``
+ `\arg` ``\arg`` `\dim` ``\dim`` `\ln` ``\ln`` `\sup` ``\sup``
+ `\cos` ``\cos`` `\exp` ``\exp`` `\log` ``\log`` `\tan` ``\tan``
+ `\cosh` ``\cosh`` `\gcd` ``\gcd`` `\max` ``\max`` `\tanh` ``\tanh``
+ `\cot` ``\cot`` `\hom` ``\hom`` `\min` ``\min``
+ `\coth` ``\coth`` `\inf` ``\inf`` `\Pr` ``\Pr``
+ ========= =========== ====== ======== ====== ======== ======= =========
+
+Named operators outside the above list can be typeset with
+``\operatorname{name}``, e.g. `\operatorname{sgn}(-3) = -1`.
+
+
+Relation symbols
+----------------
+.. class:: colwidths-auto
+
+ ================================ ================================ ================================ ================================
+ `\Join` ``\Join`` `\approx` ``\approx`` `\asymp` ``\asymp`` `\bowtie` ``\bowtie``
+ `\cong` ``\cong`` `\dashv` ``\dashv`` `\doteq` ``\doteq`` `\equiv` ``\equiv``
+ `\frown` ``\frown`` `\ge` ``\ge`` `\geq` ``\geq`` `\gg` ``\gg``
+ `\in` ``\in`` `\le` ``\le`` `\leq` ``\leq`` `\ll` ``\ll``
+ `\mid` ``\mid`` `\models` ``\models`` `\neq` ``\neq`` `\ni` ``\ni``
+ `\parallel` ``\parallel`` `\perp` ``\perp`` `\prec` ``\prec`` `\precsim` ``\precsim``
+ `\propto` ``\propto`` `\sim` ``\sim`` `\simeq` ``\simeq`` `\smile` ``\smile``
+ `\sqsubset` ``\sqsubset`` `\sqsubseteq` ``\sqsubseteq`` `\sqsupset` ``\sqsupset`` `\sqsupseteq` ``\sqsupseteq``
+ `\subset` ``\subset`` `\subseteq` ``\subseteq`` `\succ` ``\succ`` `\succsim` ``\succsim``
+ `\supset` ``\supset`` `\supseteq` ``\supseteq`` `\vdash` ``\vdash``
+ ================================ ================================ ================================ ================================
+
+negated relations
+.. class:: colwidths-auto
+
+ ============================= ===================
+ `\not\in` ``\not\in`` `\not =` ``\not =``
+ `\not \equiv` ``\not \equiv``
+ ============================= ===================
+
+
+Variable-sized symbols
+----------------------
+.. class:: colwidths-auto
+
+ ================= =========================== ========================= ========================= =====================
+ `\sum` ``\sum`` `\bigodot` ``\bigodot`` `\bigcap` ``\bigcap`` `\bigwedge` ``\bigwedge`` `\prod` ``\prod``
+ `\int` ``\int`` `\bigoplus` ``\bigoplus`` `\bigcup` ``\bigcup`` `\bigvee` ``\bigvee`` `\coprod` ``\coprod``
+ `\oint` ``\oint`` `\bigotimes` ``\bigotimes`` `\biguplus` ``\biguplus``
+ ================= =========================== ========================= ========================= =====================
+
+Larger symbols are used in displayed formulas:
+
+.. math::
+
+ \sum\ \int\ \oint \bigcap \prod \ldots
+
+Extensible delimiters
+---------------------
+Unless you indicate otherwise, delimiters in math formulas remain at the
+standard size regardless of the height of the enclosed material. To get
+adaptable sizes, use ``\left`` and ``\right`` prefixes.
+
+.. math::
+
+ g(A,B,Y) = f \left(A,B,X=h^{[X]}(Y)\right)
+
+Use ``.`` for "empty" delimiters:
+
+.. math::
+
+ A = \left . \frac{1}{1-n}\, \right |_{n=0}^\infty
+
+
+Top and bottom embellishments
+-----------------------------
+
+TODO
+
+Extensible arrows
+-----------------
+
+TODO
+
+
+Text
+====
+
+The main use of the command ``\text`` is for words or phrases in a
+display. It is similar to ``\mbox`` in its effects but, unlike ``\mbox``,
+automatically produces subscript-size text if used in a subscript,
+``k_{\text{B}}T`` becomes `k_{\text{B}}T`.
+
+Whitespace is kept inside the argument:
+
+.. Math:: f_{[x_{i-1},x_i]} \text{ is monotonic for } i = 1,\,…,\,c+1
+
+
+Currently, math in text is not supported by LaTeX2MathML.
+
+Horizontal space
+================
+
+.. class:: colwidths-auto
+
+ ================= ================== =============
+ :m:`|\qquad|` ``|\qquad|`` 2 em
+ :m:`|\quad|` ``|\quad|`` 1 em
+ :m:`|\;|` ``|\;|`` thick
+ :m:`|\ |` ``|\ |`` standard
+ :m:`|\:|` ``|\:|`` medium
+ :m:`|\,|` ``|\,|`` thin
+ :m:`| |` ``| |`` none
+ :m:`|\!|` ``|\!|`` thin negative
+ `|\hspace{1ex}|` ``|\hspace{1ex}|`` custom
+ ================= ================== =============
+
+ToDo
+====
+
+internal LaTeX2MathML
+
+* Math inside text: ``n - 1 \text{if $n$ is odd}``.
+* Remove circular refs.
+* Decimal numbers.
+
+* Shorthands for combined named operators
+
+ =============== =================
+ `\liminf` ``\liminf``
+ `\limsup` ``\limsup``
+ `\injlim` ``\injlim``
+ `\projlim` ``\projlim``
+ `\varinjlim` ``\varinjlim``
+ `\varliminf` ``\varliminf``
+ `\varlimsup` ``\varlimsup``
+ `\varprojlim` ``\varprojlim``
+ =============== =================
+
+* Implement ``\circledS``? (in short-math-guide.pdf but not in mathematical Unicode characters)
+
+ ``\widetilde{xxx}``
+ ``\widehat{xxx}``
+
+
+Tests
+==========
+
+
+LICR macros in different alphabets:
+
+.. math::
+
+ \text{normal: } &
+ abs(x) \pm \alpha \approx \Gamma \forall x \in R \bigstar \\
+ \text{mathrm: } &
+ \mathrm{abs(x) \pm \alpha \approx \Gamma \forall x \in R \bigstar} \\
+ \text{mathit: } &
+ \mathit{abs(x) \pm \alpha \approx \Gamma \forall x \in R \bigstar} \\
+ \text{mathsf: } &
+ \mathsf{abs(x) \pm \alpha \approx \Gamma \forall x \in R \bigstar} \\
+ \text{mathbb: } &
+ \mathbb{abs(x) \pm \alpha \approx \Gamma \forall x \in R \bigstar} \\
+ \text{mathbf: } &
+ \mathbf{abs(x) \pm \alpha \approx \Gamma \forall x \in R \bigstar} \\
+ \text{boldsymbol: } &
+ \boldsymbol{abs(x) \pm \alpha \approx \Gamma \forall x \in R \bigstar}
+
+All blackboard-bold characters:
+`\mathbb{a \ldots z A \ldots Z 0 \ldots 9
+\mathbb\Gamma \mathbb{\Pi} \mathbb {\Sigma}\mathbb\gamma \mathbb\pi}`.
+
Property changes on: trunk/docutils/test/functional/input/data/comprehensive-math-test.txt
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Author Date Id Revision
\ No newline at end of property
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|