MCPcopy Create free account
hub / github.com/ipython/ipython / latex_matches

Method latex_matches

IPython/core/completer.py:1698–1716  ·  view source on GitHub ↗

u"""Match Latex syntax for unicode characters. This does both ``\\alp`` -> ``\\alpha`` and ``\\alpha`` -> ``α``

(self, text)

Source from the content-addressed store, hash-verified

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:

Callers 2

_completeMethod · 0.95
test_latex_no_resultsMethod · 0.80

Calls

no outgoing calls

Tested by 1

test_latex_no_resultsMethod · 0.64