Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MathJax/Latex Output #142

Open
mlg556 opened this issue May 13, 2020 · 3 comments
Open

MathJax/Latex Output #142

mlg556 opened this issue May 13, 2020 · 3 comments

Comments

@mlg556
Copy link

mlg556 commented May 13, 2020

I was wondering if it was somehow possible to implement displaying the symbolic variables in the notebook environment like sympy does.

For clarification, this is the current situation:
Current situation:

How symbolic output is displayed in sympy:
Output in sympy

@blink1073
Copy link
Contributor

I don't believe so, the ipython kernel is doing some magic to generate display messages.

@cjwomack
Copy link

cjwomack commented Mar 15, 2024

Not quite what you want but you can generate a latex representation of the expression using
latex((a+5)/(a-3))

and copy the output between '' and paste the output between that into $$ either in markdown or in another cell using %%latex or %latex

I have noticed that fprintf("$%s$", latex((a+5)/(a-3))); gives a string close to the latex expression with text/latex
if _execute_sync doesn't print the output using self.Print and uses self.Display instead???

Maybe if a line magic was created %symlatex and the magic made the expression expr was bracketed by fprintf("$%s$", latex(expr));

Then one would need to search within the output for $... $ and then set this fragment to be a text/latex and use the Ipython.display maybe...

Anyway, this is a rough idea...

@cjwomack
Copy link

cjwomack commented Mar 15, 2024

On second thoughts, a line magic would be rather annoying and I'm not even sure existing metakernel code allows for the magic code to become normal code.

If one could invent ending line magic in this case this would be okay only if %symlatex or whatever name was; the last thing on the line with whitespace....

The delimiter to wrap around the latex expr generated by matlab maybe shouldn't be $ $, it could be something else.... but would need to be replaced to $ $ in the json

Anyway, I was investigating things re typing an maths assignment up....

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants