Commit 3efad3b
committed
Correctly end tokens in mathtext parsing.
This avoids parsing `\sinx` as `\sin x` (it now raises an error
instead), and removes the need for `accentprefixed` (because `\doteq`
is treated as a single token now, instead of `\dot{eq}`). This also
means that `\doteq` (and friends) are now correctly treated as relations
(per `_relation_symbols`, thus changing the spacing around them); hence
then change in baseline images. Adjust test strings accordingly to undo
the spacing, to avoid regen'ing baselines.
Also shaves ~2% off drawing all the current mathtext tests, i.e.
```
MPLBACKEND=agg python -c 'import time; from pylab import *; from matplotlib.tests.test_mathtext import math_tests; fig = figure(figsize=(3, 10)); fig.text(0, 0, "\n".join(filter(None, math_tests)), size=6); start = time.perf_counter(); [fig.canvas.draw() for _ in range(10)]; print((time.perf_counter() - start) / 10)'
```
(including adjustment for the removed test case), probably because
accentprefixed was previously extremely commonly checked, being at the
top of the placeable list; however, performance wasn't really the main
goal here.1 parent 56a5153 commit 3efad3b
File tree
17 files changed
+40
-1076
lines changed- lib/matplotlib
- tests
- baseline_images/test_mathtext
17 files changed
+40
-1076
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1718 | 1718 | | |
1719 | 1719 | | |
1720 | 1720 | | |
| 1721 | + | |
| 1722 | + | |
| 1723 | + | |
| 1724 | + | |
| 1725 | + | |
| 1726 | + | |
| 1727 | + | |
| 1728 | + | |
| 1729 | + | |
| 1730 | + | |
| 1731 | + | |
| 1732 | + | |
| 1733 | + | |
| 1734 | + | |
| 1735 | + | |
1721 | 1736 | | |
1722 | 1737 | | |
1723 | 1738 | | |
1724 | 1739 | | |
1725 | 1740 | | |
1726 | 1741 | | |
1727 | | - | |
1728 | 1742 | | |
1729 | 1743 | | |
1730 | 1744 | | |
| |||
1733 | 1747 | | |
1734 | 1748 | | |
1735 | 1749 | | |
1736 | | - | |
| 1750 | + | |
1737 | 1751 | | |
1738 | 1752 | | |
1739 | 1753 | | |
| |||
1770 | 1784 | | |
1771 | 1785 | | |
1772 | 1786 | | |
1773 | | - | |
1774 | | - | |
| 1787 | + | |
1775 | 1788 | | |
1776 | 1789 | | |
1777 | | - | |
| 1790 | + | |
1778 | 1791 | | |
1779 | 1792 | | |
1780 | 1793 | | |
| |||
1815 | 1828 | | |
1816 | 1829 | | |
1817 | 1830 | | |
1818 | | - | |
1819 | | - | |
1820 | | - | |
1821 | | - | |
| 1831 | + | |
| 1832 | + | |
1822 | 1833 | | |
1823 | 1834 | | |
1824 | 1835 | | |
| |||
2014 | 2025 | | |
2015 | 2026 | | |
2016 | 2027 | | |
2017 | | - | |
2018 | | - | |
2019 | 2028 | | |
2020 | 2029 | | |
2021 | 2030 | | |
| |||
2044 | 2053 | | |
2045 | 2054 | | |
2046 | 2055 | | |
2047 | | - | |
2048 | | - | |
2049 | | - | |
2050 | | - | |
2051 | | - | |
2052 | | - | |
2053 | 2056 | | |
2054 | 2057 | | |
2055 | 2058 | | |
| |||
Binary file not shown.
Binary file not shown.
Lines changed: 0 additions & 222 deletions
This file was deleted.
Binary file not shown.
Binary file not shown.
0 commit comments