[IPython-User] switching between display representations in the frontend
Sun Mar 3 12:51:03 CST 2013
On Sun, Mar 3, 2013 at 2:46 PM, Matthias BUSSONNIER
> Le 3 mars 2013 à 14:26, Thomas Hisch a écrit :
>> On Sun, Mar 3, 2013 at 12:11 PM, Matthias BUSSONNIER
>> <email@example.com> wrote:
>>> Le 3 mars 2013 à 08:41, Thomas Hisch a écrit :
>>>> the sympy printing extension configures formatters for rendering latex
>>>> expressions: image/png and text/latex. According to  all
>>>> representations of an object for which multiple formatters are
>>>> registers will be calculated and sent to the frontend but only one is
>>>> displayed in the frontend. Is there a way to switch the default
>>>> displayed repr in the frontend (without using display_xxx manually for
>>>> each obj)?
>>> Which default value is :
>>> It is not really supported yet, and have chance of not working at load time.
>> a fix for the 'display-order' problem should be integrated into the
>> sympy printing extension. I can think of disabling the latex_formatter
>> with latex_formatter.enabled=False in  and if mathjax rendered
>> output is desired then set 'enabled' to True.
> I think that it is what %load_ext sympyprinting does. It enables the Latex representation.
The sympy printing ext. is now hosted in the sympy repo and can be
loaded with %load_ext sympy.interactive.ipythonprinting. This does not
set up the formatter for 'text/latex' ! You have to call
sympy.interactive.init_printing(use_latex=True) to initialize the
extension. Once the latex repr is enabled one can't switch the output
to 'image/png' (due to the output order in the frontend) by calling
init_printing with a different set of options. This is what I need to
fix for my PR.
>> @sympy devs: is enabling and disabling the latex_formatter an option
>> to be able to switch between png output and mathjax output in the
>> notebook/qtconsole? (This problem is related to )
> I suppose the question of enabling/disabling the representation is a question of computation time,
> but otherwise, I suggest not to disable representations.
> Especially, it is not because a representation is not shown in one frontend that it is not stored in the notebook document.
> All the representation are computed, and store so that nbconvert can use it when converting for example.
> So it is **really** a question of frontend to know wether or not show latex or png or jpeg.
A function in IPython to change the 'output order' for specified
frontends would be ideal.
>>  https://github.com/sympy/sympy/blob/master/sympy/interactive/printing.py#L144
>>  https://github.com/sympy/sympy/pull/1776
>>>>  http://ipython.org/ipython-doc/dev/api/generated/IPython.core.display.html
>>>> IPython-User mailing list
>>> IPython-User mailing list
>> IPython-User mailing list
> IPython-User mailing list
More information about the IPython-User