pytexit icon indicating copy to clipboard operation
pytexit copied to clipboard

Display with dark themes

Open maillardj opened this issue 4 years ago • 11 comments

Hello! Thank you for the package!

In Dark Themes IPython the display output is hardly readable because the text colour is black.

image

Does anyone know :

  • how to fix it?
  • how to automatically adapt to the user theme?

maillardj avatar Apr 06 '21 14:04 maillardj

Looking into this. Has something to do with the IPython.core.display. Can you share the steps to recreate this issue? Were you just using Ipython in the console? My console is not showing any LaTex output with IPython.

sambiddledev avatar Apr 09 '21 23:04 sambiddledev

I also have it here. I simply run it from the IPython 7.20.0 embedded in Spyder 4.2.1, and I get the LaTeX output.

erwanp avatar Apr 09 '21 23:04 erwanp

If you manage to find out why it's not happening in your own iPython, it would be nice if we can set it by default : it's very convenient to check the equations in your code

erwanp avatar Apr 09 '21 23:04 erwanp

Awesome. Thanks for sharing that. I'm going to look into it a bit more closely. Tried to reproduce using Jupyter notebook with a theme and it looked fine, so we may need to get it to ignore the theme in certain cases: Jupyter Notebook Dark Mode Success

sambiddledev avatar Apr 09 '21 23:04 sambiddledev

@erwanp no equation displays when I use the IPython interpreter straight from my zsh terminal window on a mac. I'll look into that a bit more. Could be worthy of an issue as well?

sambiddledev avatar Apr 09 '21 23:04 sambiddledev

VS code seems to work without issue, also. So it appears to be interpreter specific. See example from Jupyter notebook embedded in vs code: VScode Dark Mode

sambiddledev avatar Apr 09 '21 23:04 sambiddledev

Nice! So we have so far :

  • jupyter notebook in VS code : ✔️
  • IPython in mac terminal : ❌ (nothing appears)
  • IPython in Spyder, Windows : ✅ (but wrong background)

@maillardj was it also in a Spyder IPython? Does it work in a IPython spawned from the console?

erwanp avatar Apr 10 '21 15:04 erwanp

Hello! Yes, it was in a spyder IPython. From gitbash console it doesn't print the equation!

maillardj avatar Apr 12 '21 05:04 maillardj

Extra search systematically pointed me to Jupyter Notebooks to render equations (which works well, as you showed @sambiddledev ) . IPython simply inherits the limitations of the console/terminal, which wasn't developed to show images.

I think we won't fix it !

erwanp avatar Apr 12 '21 17:04 erwanp

That makes sense. I wonder if some helper text just to indicate that if you want to see the equation we recommend viewing in xyz might be helpful. Just to provide a cue to the user

On Apr 12, 2021, at 10:24 AM, Erwan Pannier @.***> wrote:

 Extra search systematically pointed me to Jupyter Notebooks to render equations (which works well, as you showed @sambiddledev ) . IPython simply inherits the limitations of the console/terminal, which wasn't developed to show images.

I think we won't fix it !

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.

sambiddledev avatar Apr 12 '21 17:04 sambiddledev

Good idea, but the message shouldn't appear on a JupyterNotebook. Hard to know how which environment the line is executed.

Possible hack : what about subclassing the IPython.core.display.Latex name, which is shown here :

image

to something like pytexit.use_a_jupyter_notebook_to_view_latex_rendering

erwanp avatar Apr 12 '21 19:04 erwanp