[IPython-dev] mimetypes from format()

Jason Moore moorepants at gmail.com
Sun Dec 29 14:04:59 EST 2013


Thanks. I just tried this:

In [16]: ip = get_ipython()

In [17]: inst = ip.instance()

In [18]: inst.display_formatter.formatters['text/latex'].enabled = True

In [19]: inst.display_formatter.format('1.0')
Out[19]: ({u'text/plain': "'1.0'"}, {})


And the plaint text representation is the only that that was returned. Am I
missing something else?


Jason
moorepants.info
+01 530-601-9791


On Sun, Dec 29, 2013 at 1:39 PM, MinRK <benjaminrk at gmail.com> wrote:

> If it's a plain terminal session, only the plaintext formatter is enabled
> by default, since no other formats are renderable. You probably just want
> to set `display_formatter.formatters['text/latex'].enabled = True`.
>
>
> On Sun, Dec 29, 2013 at 9:36 AM, Jason Moore <moorepants at gmail.com> wrote:
>
>> I'm having trouble figuring out how to get the DisplayFormatter to return
>> the latex representation, in particular the format function seems to be
>> able to return many mimetypes:
>> http://ipython.org/ipython-doc/dev/api/generated/IPython.core.formatters.html#IPython.core.formatters.DisplayFormatter.format
>>
>> I'm writing this test:
>>
>>
>> https://github.com/moorepants/sympy/blob/b748fae55c2cc3e973340b5e85cadd83a80f3405/sympy/interactive/tests/test_ipythonprinting.py#L59
>>
>> And want to verify that the 'text/plain' and 'text/latex' function as
>> expected after changing settings in SymPy. I can only get the 'text/plain'
>> to output from 'format()'.
>>
>> How do I output other mimetypes?
>> Jason
>> moorepants.info
>> +01 530-601-9791
>>
>> _______________________________________________
>> IPython-dev mailing list
>> IPython-dev at scipy.org
>> http://mail.scipy.org/mailman/listinfo/ipython-dev
>>
>>
>
> _______________________________________________
> IPython-dev mailing list
> IPython-dev at scipy.org
> http://mail.scipy.org/mailman/listinfo/ipython-dev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ipython-dev/attachments/20131229/dc8f7fb8/attachment.html>


More information about the IPython-dev mailing list