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)
| 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 | """ |
no test coverage detected