[IPython-User] Printing a string and latex together in a notebook

Mike Witt msg2mw@gmail....
Sat Nov 17 17:40:51 CST 2012

In an ipython notebook, I'd like to do something like this:

   x = Symbol('x')
   print('The answer is: $%s$' %latex(x**2))

The closest I've figured out how to get is:

   print('The answer is:')

Or something equivalent to that. I'd like to mix the string
and the math output on the same line, but I can't figure
out the syntax.

Note that I'm in a code cell, not a markdown cell. I want to
calculate the answer and then print it with informative strings
intermixed with the math. Is this possible?


More information about the IPython-User mailing list