def compile(self, ast): # Merge adjacent subscripts and superscripts. return re.sub(r'<(sup|sub)>(.+?)</\1><\1>(.+?)</\1>', r'<\1>\2\3</\1>', DisplayCompiler.compile(self, ast))
def compile(self, ast): return r'\ce{{{}}}'.format(DisplayCompiler.compile(self, ast))
def compile(self, ast): return re.sub(r'(\\ :(?:sub|sup):`)([^`]+?)`\\ \1([^`]+?)`\\ ', r'\1\2\3`\\ ', DisplayCompiler.compile(self, ast) ).replace(r'\ \ ', r'\ ').rstrip(r'\ ')
def compile(self, ast): # Merge adjacent subscripts, superscripts and \mathrms. return r'\({}\)'.format(re.sub( r'(_|\^|\\mathrm)\{([^{}]+?)\}(?:\{\})?(?:\1\{([^{}]+?)\})+', self._replace, DisplayCompiler.compile(self, ast)))