]> git.scottworley.com Git - paperdoorknob/blobdiff - texfilter.py
Handle Unicode characters ≈ and ◁
[paperdoorknob] / texfilter.py
index 8103c19df2cef6475e1a9e9fb29ac637196a07ac..e215b185ff946dd1b849163dd0032094c61bfc3a 100644 (file)
@@ -11,8 +11,10 @@ from typing import Callable, List, Tuple
 
 TexFilters: List[Tuple[str, Callable[[bytes], bytes]]] = [
     # Work around `Extra }, or forgotten \endgroup.`
-    ("FixBareEmph", lambda x: re.sub(
-        b'(^|\n)(\\\\emph{)', b'\\1\\\\hspace{0pt}\\2', x)),
+    ("FixBareNesting", lambda x: re.sub(
+        b'(^|\n)(\\\\(emph|st){)', b'\\1\\\\hspace{0pt}\\2', x)),
+    ("UnicodeApprox", lambda x: re.sub('≈'.encode('utf-8'), b'$\\approx$', x)),
+    ("UnicodeTriangle", lambda x: re.sub('◁'.encode('utf-8'), b'$\\lhd$', x)),
 ]