def visit_math(self, node, math_env=''):
tag = ('div', 'span')[math_env == '']
math_code = node.astext().translate(unichar2tex.uni2tex_table)
start_tag = self.starttag(node, tag, suffix='\n', CLASS='formula', ALT=math_code)
math2html.DocumentParameters.displaymode = (math_env != '')
math_code = math2html.math2html(math_code)
if self.math_output_options:
self.katex_url = self.math_output_options[0]
self.math_header = [
self.stylesheet_call(utils.find_file_in_dirs("math.css", self.settings.stylesheet_dirs)),
self.stylesheet_link % (self.katex_url + "katex.min.css"),
self.mathjax_script % (self.katex_url + "katex.min.js"),
self.script_call(utils.find_file_in_dirs("render.js", self.settings.stylesheet_dirs))
]
self.body.append(start_tag)
self.body.append(math_code)
if math_env:
self.body.append('\n')
self.body.append('</%s>\n' % tag)
raise nodes.SkipNode