u"""Match Latex syntax for unicode characters. This does both ``\\alp`` -> ``\\alpha`` and ``\\alpha`` -> ``α``
(self, text)
| 1696 | |
| 1697 | |
| 1698 | def latex_matches(self, text): |
| 1699 | u"""Match Latex syntax for unicode characters. |
| 1700 | |
| 1701 | This does both ``\\alp`` -> ``\\alpha`` and ``\\alpha`` -> ``α`` |
| 1702 | """ |
| 1703 | slashpos = text.rfind('\\') |
| 1704 | if slashpos > -1: |
| 1705 | s = text[slashpos:] |
| 1706 | if s in latex_symbols: |
| 1707 | # Try to complete a full latex symbol to unicode |
| 1708 | # \\alpha -> α |
| 1709 | return s, [latex_symbols[s]] |
| 1710 | else: |
| 1711 | # If a user has partially typed a latex symbol, give them |
| 1712 | # a full list of options \al -> [\aleph, \alpha] |
| 1713 | matches = [k for k in latex_symbols if k.startswith(s)] |
| 1714 | if matches: |
| 1715 | return s, matches |
| 1716 | return u'', [] |
| 1717 | |
| 1718 | def dispatch_custom_completer(self, text): |
| 1719 | if not self.custom_completers: |
no outgoing calls