diff --git a/doc/sphinxext/math_symbol_table.py b/doc/sphinxext/math_symbol_table.py index 5e1969228e3f..a41b015ef2dc 100644 --- a/doc/sphinxext/math_symbol_table.py +++ b/doc/sphinxext/math_symbol_table.py @@ -1,3 +1,6 @@ +from matplotlib import mathtext + + symbols = [ ["Lower-case Greek", 6, @@ -112,9 +115,19 @@ def get_n(n, l): header = " " + (('=' * max_width) + ' ') * columns lines.append(header) for part in get_n(columns, syms): - line = " " + " ".join( - ":math:`{0}` ``{0}``".format(sym).rjust(max_width) - for sym in part) + line = ( + " " + + " ".join( + "{} ``{}``".format( + sym + if not sym.startswith("\\") + else sym[1:] + if (sym[1:] in mathtext.Parser._overunder_functions + or sym[1:] in mathtext.Parser._function_names) + else chr(mathtext.tex2uni[sym[1:]]), + sym) + .rjust(max_width) + for sym in part)) lines.append(line) lines.append(header) lines.append('') diff --git a/tutorials/text/mathtext.py b/tutorials/text/mathtext.py index 96a523f192cf..437a27456e33 100644 --- a/tutorials/text/mathtext.py +++ b/tutorials/text/mathtext.py @@ -179,9 +179,13 @@ r's(t) = \mathcal{A}\/\sin(2 \omega t)' +.. Here we cheat a bit: for HTML math rendering, Sphinx relies on MathJax which + doesn't actually support the italic correction (\/); instead, use a thin + space (\,) which is supported. + .. math:: - s(t) = \mathcal{A}\/\sin(2 \omega t) + s(t) = \mathcal{A}\,\sin(2 \omega t) The choices available with all fonts are: