Returns a cleaned string and a boolean flag. The flag indicates if the given string *s* contains any mathtext, determined by counting unescaped dollar signs. If no mathtext is present, the cleaned string has its dollar signs unescaped. If usetex is on, the fl
(s, usetex=None)
| 1194 | |
| 1195 | @staticmethod |
| 1196 | def is_math_text(s, usetex=None): |
| 1197 | """ |
| 1198 | Returns a cleaned string and a boolean flag. |
| 1199 | The flag indicates if the given string *s* contains any mathtext, |
| 1200 | determined by counting unescaped dollar signs. If no mathtext |
| 1201 | is present, the cleaned string has its dollar signs unescaped. |
| 1202 | If usetex is on, the flag always has the value "TeX". |
| 1203 | """ |
| 1204 | # Did we find an even number of non-escaped dollar signs? |
| 1205 | # If so, treat is as math text. |
| 1206 | if usetex is None: |
| 1207 | usetex = rcParams['text.usetex'] |
| 1208 | if usetex: |
| 1209 | if s == ' ': |
| 1210 | s = r'\ ' |
| 1211 | return s, 'TeX' |
| 1212 | |
| 1213 | if cbook.is_math_text(s): |
| 1214 | return s, True |
| 1215 | else: |
| 1216 | return s.replace(r'\$', '$'), False |
| 1217 | |
| 1218 | def set_fontproperties(self, fp): |
| 1219 | """ |
no test coverage detected