[IPython-User] Notebook, mathjax, string substitution

Derek O'Connell doc@doconnel.f9.co...
Wed Oct 2 11:05:23 CDT 2013

On 02/10/13 16:58, Matthias BUSSONNIER wrote:
> Le 2 oct. 2013 à 17:47, Derek O'Connell a écrit :
>> I'm probably missing something obvious but since mathjax strings use
>> {}'s in their format how then do I substitute in my own values from
>> variables? I would normally use format() but maybe templates is a better
>> option in this case?
> Not sure I understand the question, but still :
> Triple bracket ?
>>>> print r'\foo_{{{ind}}}'.format(ind='xyx')
> \foo_{xyx}
> ?

Thanks for suggestion but format() appears to get confused with 
predefined constants already surrounded by {}'s. Example:

Math('F(k) = \int_{-\infty}^{\infty} f(x) e^{{{{myn}}}\pi i k} 

throws:  KeyError: '-\\infty'

More information about the IPython-User mailing list