8000 Fix mathtext tutorial for build with Sphinx 1.8. by anntzer · Pull Request #12570 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content

Fix mathtext tutorial for build with Sphinx 1.8. #12570

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 20, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
8000
Loading
Diff view
Diff view
19 changes: 16 additions & 3 deletions doc/sphinxext/math_symbol_table.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
from matplotlib import mathtext


symbols = [
["Lower-case Greek",
6,
Expand Down Expand Up @@ -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('')
< 8000 svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-fold-down"> Expand Down
6 changes: 5 additions & 1 deletion tutorials/text/mathtext.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand Down
0