# Supporting the qtconsole and notebook display system simultaneously

4 messages
Open this post in threaded view
|

## Supporting the qtconsole and notebook display system simultaneously

 SymPy has a comprehensive printing system and we leverage IPython's qtconsole and notebook display abilities to show mathematics in unicode, mathjax, and png outputs. Typically all three of these are generated and the IPython frontend can choose what to display.We've hit a bug that we can't figure out how to fix though. Matplotlib has a minimal LaTeX implementation and can output PNGs. If a user doesn't have a full LaTeX suit installed we fall back to that. But since matplotlib doesn't handle LaTeX environments, it can't render things like matrices.Now if a qtconsole user tries to display a matrix, this fails if matplotlib is the only available renderer. But if the user is using the notebook then the matplotlib renderer will fail but mathjax will print properly. We'd like to fall back to unicode printing if matplotlib fails to print **only in the qtconsole**, but render with mathjax in the notebook.So, as far as we can tell, we need to know which frontend is trying to display our object so that we can handle errors properly. We haven't been able to think of a workaround that is agnostic of the frontend.There is some discussion in this PR: https://github.com/sympy/sympy/pull/9976 (among others).Any suggestions?Jasonmoorepants.info+01 530-601-9791 _______________________________________________ IPython-dev mailing list [hidden email] https://mail.scipy.org/mailman/listinfo/ipython-dev
Open this post in threaded view
|

## Re: Supporting the qtconsole and notebook display system simultaneously

 On Jan 6, 2016, at 06:13, Jason Moore <[hidden email]> wrote:SymPy has a comprehensive printing system and we leverage IPython's qtconsole and notebook display abilities to show mathematics in unicode, mathjax, and png outputs. Typically all three of these are generated and the IPython frontend can choose what to display.We've hit a bug that we can't figure out how to fix though. Matplotlib has a minimal LaTeX implementation and can output PNGs. If a user doesn't have a full LaTeX suit installed we fall back to that. But since matplotlib doesn't handle LaTeX environments, it can't render things like matrices.Now if a qtconsole user tries to display a matrix, this fails if matplotlib is the only available renderer. But if the user is using the notebook then the matplotlib renderer will fail but mathjax will print properly. We'd like to fall back to unicode printing if matplotlib fails to print **only in the qtconsole**, but render with mathjax in the notebook.Technically you can only distinguish a non-zmq from a ZMQ front-end, so **only** in qtconsole is not reliable.So, as far as we can tell, we need to know which frontend is trying to display our object so that we can handle errors properly. We haven't been able to think of a workaround that is agnostic of the frontend.Can’t you register 2 display formatter (tex and pretty unicode) so that it display correctly on both ?Though IIUC there might also be a bug where our Tex to Png that should not return empty PNG.-- MThere is some discussion in this PR: https://github.com/sympy/sympy/pull/9976 (among others).Any suggestions?Jasonmoorepants.info+01 530-601-9791 _______________________________________________IPython-dev mailing list[hidden email]https://mail.scipy.org/mailman/listinfo/ipython-dev_______________________________________________ IPython-dev mailing list [hidden email] https://mail.scipy.org/mailman/listinfo/ipython-dev
 In reply to this post by Jason Moore El 06/01/16 a las 00:13, Jason Moore escribió: SymPy has a comprehensive printing system and we leverage IPython's qtconsole and notebook display abilities to show mathematics in unicode, mathjax, and png outputs. Typically all three of these are generated and the IPython frontend can choose what to display. We've hit a bug that we can't figure out how to fix though. Matplotlib has a minimal LaTeX implementation and can output PNGs. If a user doesn't have a full LaTeX suit installed we fall back to that. But since matplotlib doesn't handle LaTeX environments, it can't render things like matrices. Now if a qtconsole user tries to display a matrix, this fails if matplotlib is the only available renderer. But if the user is using the notebook then the matplotlib renderer will fail but mathjax will print properly. We'd like to fall back to unicode printing if matplotlib fails to print **only in the qtconsole**, but render with mathjax in the notebook. There's already a pull request in qtconsole about this problem: https://github.com/jupyter/qtconsole/pull/65 Cheers, Carlos So, as far as we can tell, we need to know which frontend is trying to display our object so that we can handle errors properly. We haven't been able to think of a workaround that is agnostic of the frontend. There is some discussion in this PR: https://github.com/sympy/sympy/pull/9976 (among others). Any suggestions? Jason moorepants.info +01 530-601-9791 _______________________________________________ IPython-dev mailing list [hidden email] https://mail.scipy.org/mailman/listinfo/ipython-dev  _______________________________________________ IPython-dev mailing list [hidden email] https://mail.scipy.org/mailman/listinfo/ipython-dev
 I didn't know about that PR. Thanks for pointing it. That likely solves the issue that I've raised here. I'll try it out and discuss with Aaron.Jasonmoorepants.info+01 530-601-9791 On Thu, Jan 7, 2016 at 5:39 AM, Carlos Córdoba wrote: El 06/01/16 a las 00:13, Jason Moore escribió: SymPy has a comprehensive printing system and we leverage IPython's qtconsole and notebook display abilities to show mathematics in unicode, mathjax, and png outputs. Typically all three of these are generated and the IPython frontend can choose what to display. We've hit a bug that we can't figure out how to fix though. Matplotlib has a minimal LaTeX implementation and can output PNGs. If a user doesn't have a full LaTeX suit installed we fall back to that. But since matplotlib doesn't handle LaTeX environments, it can't render things like matrices. Now if a qtconsole user tries to display a matrix, this fails if matplotlib is the only available renderer. But if the user is using the notebook then the matplotlib renderer will fail but mathjax will print properly. We'd like to fall back to unicode printing if matplotlib fails to print **only in the qtconsole**, but render with mathjax in the notebook. There's already a pull request in qtconsole about this problem: https://github.com/jupyter/qtconsole/pull/65 Cheers, Carlos So, as far as we can tell, we need to know which frontend is trying to display our object so that we can handle errors properly. We haven't been able to think of a workaround that is agnostic of the frontend. There is some discussion in this PR: https://github.com/sympy/sympy/pull/9976 (among others). Any suggestions? Jason moorepants.info +01 530-601-9791 _______________________________________________ IPython-dev mailing list [hidden email] https://mail.scipy.org/mailman/listinfo/ipython-dev  _______________________________________________ IPython-dev mailing list [hidden email] https://mail.scipy.org/mailman/listinfo/ipython-dev _______________________________________________ IPython-dev mailing list [hidden email] https://mail.scipy.org/mailman/listinfo/ipython-dev