joouha / euporie

Jupyter notebooks in the terminal
https://euporie.readthedocs.io
MIT License
1.54k stars 36 forks source link

Latex printing from sympy shows `\displaystyle` and doesn't print using graphics #106

Open IndianBoy42 opened 2 months ago

IndianBoy42 commented 2 months ago
pipx install euporie
pipx inject euporie timg cairosvg mtable flatlatex ipython                      
euporie console
from sympy import init_sessions
x*x
\displaystylex² 
joouha commented 2 months ago

Hi,

This appears to be because sympy uses the \displaystyle latex command in it's latex output, and flatlatex (the default latex renderer used in euporie) does not support this command.

I've made a few changes in the dev branch which hopefully help with this issue:

  1. I configure flatlatex to strip various latex style commands from the output (added here)
  2. I've added utftex as a terminal latex renderer - this produces much more advanced output than flatlatex: image
  3. Other terminal latex renderers will now take priority over flatlatex if installed (you can now install utftex or pylatexenc and they will be used instead.

Also, if your terminal supports terminal graphics, and you have a latex distribution with dvipng, or matplotlib, installed, then euporie will render and display latex graphically:

image

The changes I've mentioned will be included in the next releases - I hope this helps!