on-internet
← Community

Capturing sympy math output in sphinx-gallery

Stack Overflow ·

I am trying to write an sphinx-gallery example for a module that uses sympy. I cannot find a way to get the output formatted like math. For example, in jupyter notebooks, the output of a sympy expression is rendered in mathmode. In an example rendered with sphinx using sphinx-gallery, just the string is shown. I tried using the functions in sympy.printing.mathml and monkey patching the expressions to show, e.g. #%% # Should show this # # .. math:: # \dot{x} = x y^2 - \frac{\sqrt{x}}{y} # from sympy.printing.mathml import mathml from sympy.core.evalf import EvalfMixin def print_html(expr): retu

Comments

Sign in or sign up to comment and upvote.

No comments yet.