MCPcopy Index your code
hub / github.com/matplotlib/matplotlib / _preprocess_math

Method _preprocess_math

lib/matplotlib/text.py:1454–1476  ·  view source on GitHub ↗

Return the string *s* after mathtext preprocessing, and the kind of mathtext support needed. - If *self* is configured to use TeX, return *s* unchanged except that a single space gets escaped, and the flag "TeX". - Otherwise, if *s* is mathtext (has an eve

(self, s)

Source from the content-addressed store, hash-verified

1452 self.stale = True
1453
1454 def _preprocess_math(self, s):
1455 """
1456 Return the string *s* after mathtext preprocessing, and the kind of
1457 mathtext support needed.
1458
1459 - If *self* is configured to use TeX, return *s* unchanged except that
1460 a single space gets escaped, and the flag "TeX".
1461 - Otherwise, if *s* is mathtext (has an even number of unescaped dollar
1462 signs) and ``parse_math`` is not set to False, return *s* and the
1463 flag True.
1464 - Otherwise, return *s* with dollar signs unescaped, and the flag
1465 False.
1466 """
1467 if self.get_usetex():
1468 if s == " ":
1469 s = r"\ "
1470 return s, "TeX"
1471 elif not self.get_parse_math():
1472 return s, False
1473 elif cbook.is_math_text(s):
1474 return s, True
1475 else:
1476 return s.replace(r"\$", "$"), False
1477
1478 def set_fontproperties(self, fp):
1479 """

Callers 4

_get_layoutMethod · 0.95
drawMethod · 0.95
__init__Method · 0.80

Calls 2

get_usetexMethod · 0.95
get_parse_mathMethod · 0.95

Tested by

no test coverage detected