module documentation

Render math in HTML via dvipng or dvisvgm.

Unknown Field: copyright
Copyright 2007-2022 by the Sphinx team, see AUTHORS.
Unknown Field: license
BSD, see LICENSE for details.
Constant SUPPORT​_FORMAT Undocumented
Variable depth​_re Undocumented
Variable depthsvg​_re Undocumented
Variable depthsvgcomment​_re Undocumented
Variable logger Undocumented
Variable templates​_path Undocumented
Class ​Invoke​Error errors on invoking converters.
Class ​Math​Ext​Error Undocumented
Function cleanup​_tempdir Undocumented
Function compile​_math Compile LaTeX macros for math to DVI.
Function convert​_dvi​_to​_image Convert DVI file to specific image format.
Function convert​_dvi​_to​_png Convert DVI file to PNG image.
Function convert​_dvi​_to​_svg Convert DVI file to SVG image.
Function ensure​_tempdir Create temporary directory.
Function generate​_latex​_macro Generate LaTeX macro.
Function get​_tooltip Undocumented
Function html​_visit​_displaymath Undocumented
Function html​_visit​_math Undocumented
Function read​_svg​_depth Read the depth from comment at last line of SVG file
Function render​_math Render the LaTeX math expression math using latex and dvipng or dvisvgm.
Function setup Undocumented
Function write​_svg​_depth Write the depth to SVG file as a comment at end of file
SUPPORT_FORMAT: tuple[str, ...] =

Undocumented

Value
('png', 'svg')
depth_re =

Undocumented

depthsvg_re =

Undocumented

depthsvgcomment_re =

Undocumented

logger =

Undocumented

templates_path =

Undocumented

def cleanup_tempdir(app, exc):

Undocumented

Parameters
app:SphinxUndocumented
exc:ExceptionUndocumented
def compile_math(latex, builder):
Compile LaTeX macros for math to DVI.
Parameters
latex:strUndocumented
builder:BuilderUndocumented
Returns
strUndocumented
def convert_dvi_to_image(command, name):
Convert DVI file to specific image format.
Parameters
command:List[str]Undocumented
name:strUndocumented
Returns
Tuple[str, str]Undocumented
def convert_dvi_to_png(dvipath, builder):
Convert DVI file to PNG image.
Parameters
dvipath:strUndocumented
builder:BuilderUndocumented
Returns
Tuple[str, int]Undocumented
def convert_dvi_to_svg(dvipath, builder):
Convert DVI file to SVG image.
Parameters
dvipath:strUndocumented
builder:BuilderUndocumented
Returns
Tuple[str, int]Undocumented
def ensure_tempdir(builder):

Create temporary directory.

use only one tempdir per build -- the use of a directory is cleaner than using temporary files, since we can clean up everything at once just removing the whole directory (see cleanup_tempdir)

Parameters
builder:BuilderUndocumented
Returns
strUndocumented
def generate_latex_macro(image_format, math, config, confdir=''):
Generate LaTeX macro.
Parameters
image​_format:strUndocumented
math:strUndocumented
config:ConfigUndocumented
confdir:strUndocumented
Returns
strUndocumented
def get_tooltip(self, node):

Undocumented

Parameters
node:ElementUndocumented
Returns
strUndocumented
def html_visit_displaymath(self, node):

Undocumented

Parameters
node:nodes.math_blockUndocumented
def html_visit_math(self, node):

Undocumented

Parameters
node:nodes.mathUndocumented
def read_svg_depth(filename):
Read the depth from comment at last line of SVG file
Parameters
filename:strUndocumented
Returns
intUndocumented
def render_math(self, math):

Render the LaTeX math expression math using latex and dvipng or dvisvgm.

Return the filename relative to the built document and the "depth", that is, the distance of image bottom and baseline in pixels, if the option to use preview_latex is switched on.

Error handling may seem strange, but follows a pattern: if LaTeX or dvipng (dvisvgm) aren't available, only a warning is generated (since that enables people on machines without these programs to at least build the rest of the docs successfully). If the programs are there, however, they may not fail since that indicates a problem in the math source.

Parameters
math:strUndocumented
Returns
Tuple[str, int]Undocumented
def setup(app):

Undocumented

Parameters
app:SphinxUndocumented
Returns
Dict[str, Any]Undocumented
def write_svg_depth(filename, depth):
Write the depth to SVG file as a comment at end of file
Parameters
filename:strUndocumented
depth:intUndocumented