{ "packages": ["whl/ziafont-0.4-py3-none-any.whl", "whl/ziamath-0.6-py3-none-any.whl", "latex2mathml"], "paths": ["fonts/Asana-Math.ttf", "fonts/Concrete-Math.otf", "fonts/DejaVuMathTeXGyre.ttf", "fonts/Erewhon-Math.otf", "fonts/FiraMath-Regular.otf", "fonts/Garamond-Math.otf", "fonts/LibertinusMath-Regular.otf"] }

Ziamath LaTeX Rendering Demo

Enter a LaTeX math expression







import asyncio from js import document, Object, window from pyodide.ffi import to_js, create_proxy import ziamath def getfont(): name = Element("mathfont").value return {'asana': 'Asana-Math.ttf', 'concrete': 'Concrete-Math.otf', 'dejavu': 'DejaVuMathTeXGyre.ttf', 'erewhon': 'Erewhon-Math.otf', 'fira': 'FiraMath-Regular.otf', 'garamond': 'Garamond-Math.otf', 'liber': 'LibertinusMath-Regular.otf' }.get(name, None) # stix is default/None async def drawit(): expr = Element("expression").value try: mathsvg = ziamath.Math.fromlatex(expr, font=getfont()).svg() except Exception as e: console.log('Math Exception: ' + str(e.args)) else: Element('mathout').write(mathsvg) async def file_save(): try: options = {"startIn": "downloads", "suggestedName": "math.svg"} fileHandle = await window.showSaveFilePicker(Object.fromEntries(to_js(options))) except Exception as e: console.log('Exception: ' + str(e.args)) return expr = Element("expression").value mathsvg = ziamath.Math.fromlatex(expr, font=getfont()).svg() file = await fileHandle.createWritable() await file.write(mathsvg) await file.close() return drawit()