summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormilde <milde@929543f6-e4f2-0310-98a6-ba3bd3dd1d04>2023-04-08 21:08:47 +0000
committermilde <milde@929543f6-e4f2-0310-98a6-ba3bd3dd1d04>2023-04-08 21:08:47 +0000
commit2eb0cc5aba5d0fafae8b7c00822e6ccb7964714a (patch)
treefd550f759224ed375cea4b0939269c99ab5d3d5d
parent235e48713c4b575b3725744cf2143ab06360ba7b (diff)
downloaddocutils-2eb0cc5aba5d0fafae8b7c00822e6ccb7964714a.tar.gz
LaTeX to MathML: fix ``\mspace``.
LaTeX width unit "mu" (mathematical unit) must be converted for MathML. Typo in the code resulted in wrong "width" argument for `<mspace>`. git-svn-id: https://svn.code.sf.net/p/docutils/code/trunk@9338 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
-rw-r--r--docutils/docs/ref/rst/mathematics.txt2
-rw-r--r--docutils/docutils/utils/math/latex2mathml.py13
-rw-r--r--docutils/docutils/writers/html5_polyglot/plain.css3
-rw-r--r--docutils/docutils/writers/html5_polyglot/responsive.css7
4 files changed, 14 insertions, 11 deletions
diff --git a/docutils/docs/ref/rst/mathematics.txt b/docutils/docs/ref/rst/mathematics.txt
index 6d5086907..02ca5e532 100644
--- a/docutils/docs/ref/rst/mathematics.txt
+++ b/docutils/docs/ref/rst/mathematics.txt
@@ -652,7 +652,7 @@ commands:
====================== ======== ===================== ==================
.. [#] Whitespace characters are ignored in LaTeX math mode.
-.. [#] Unit must be 'mu' (1 mu = 1/18em).
+.. [#] In LaTeX, unit must be 'mu' (1 mu = 1/18em).
Negative spacing does not work with MathML (in Firefox 78).
diff --git a/docutils/docutils/utils/math/latex2mathml.py b/docutils/docutils/utils/math/latex2mathml.py
index 897ed24cd..6f3d4aac6 100644
--- a/docutils/docutils/utils/math/latex2mathml.py
+++ b/docutils/docutils/utils/math/latex2mathml.py
@@ -206,16 +206,16 @@ movablelimits = ('bigcap', 'bigcup', 'bigodot', 'bigoplus', 'bigotimes',
spaces = {'qquad': '2em', # two \quad
'quad': '1em', # 18 mu
'thickspace': '0.2778em', # 5mu = 5/18em
+ ';': '0.2778em', # 5mu thickspace
+ ' ': '0.25em', # inter word space
'medspace': '0.2222em', # 4mu = 2/9em
+ ':': '0.2222em', # 4mu medspace
'thinspace': '0.1667em', # 3mu = 1/6em
+ ',': '0.1667em', # 3mu thinspace
'negthinspace': '-0.1667em', # -3mu = -1/6em
+ '!': '-0.1667em', # negthinspace
'negmedspace': '-0.2222em', # -4mu = -2/9em
'negthickspace': '-0.2778em', # -5mu = -5/18em
- ' ': '0.25em', # inter word space
- ';': '0.2778em', # 5mu thickspace
- ':': '0.2222em', # 4mu medspace
- ',': '0.1667em', # 3mu thinspace
- '!': '-0.1667em', # negthinspace
}
# accents -> <mover stretchy="false">
@@ -1101,7 +1101,8 @@ def handle_cmd(name, node, string): # noqa: C901 TODO make this less complex
if name in ('hspace', 'mspace'):
arg, string = tex_group(string)
- if arg.endswith('m'):
+ if arg.endswith('mu'):
+ # unit "mu" (1mu=1/18em) not supported by MathML
arg = '%sem' % (float(arg[:-2])/18)
node = node.append(mspace(width='%s'%arg))
return node, string
diff --git a/docutils/docutils/writers/html5_polyglot/plain.css b/docutils/docutils/writers/html5_polyglot/plain.css
index c5aad5d7b..8c9883451 100644
--- a/docutils/docutils/writers/html5_polyglot/plain.css
+++ b/docutils/docutils/writers/html5_polyglot/plain.css
@@ -281,7 +281,8 @@ math .boldsymbol {
font-weight: bold;
}
mstyle.mathscr, mi.mathscr {
- font-family: STIX;
+ font-family: STIX, XITSMathJax_Script, rsfs10,
+ "Asana Math", Garamond, cursive;
}
/* Epigraph */
diff --git a/docutils/docutils/writers/html5_polyglot/responsive.css b/docutils/docutils/writers/html5_polyglot/responsive.css
index d54618239..af6303258 100644
--- a/docutils/docutils/writers/html5_polyglot/responsive.css
+++ b/docutils/docutils/writers/html5_polyglot/responsive.css
@@ -17,8 +17,8 @@
/* .. _2-Clause BSD license: http://www.spdx.org/licenses/BSD-2-Clause */
/* .. _CSS3: https://www.w3.org/Style/CSS/ */
-/* Note: */
-/* This style sheet is provisional: */
+/* Note: */
+/* This style sheet is provisional: */
/* the API is not settled and may change with any minor Docutils version. */
@@ -357,7 +357,8 @@ math .boldsymbol {
font-weight: bold;
}
mstyle.mathscr, mi.mathscr {
- font-family: STIX;
+ font-family: STIX, XITSMathJax_Script, rsfs10,
+ "Asana Math", Garamond, cursive;
}
/* Adaptive page layout */