If you are happy with writing the Latex string yourself, you can simply use
the latex display capability of Jupyter / IPython (combined with normal
python string formatting to include variable values etc), e.g. with

from IPython.display import Latex, display_latex
x = 3.65
display_latex("$x^2 = %g$"%x, raw=True)

or, equivalently, with

display(Latex("$x^2 = %g$"%x))

If the Latex object is the last line in your cell, it will be displayed
automatically. If you are not using ipython, but a different kernel, you
have to find out how to produce objects with a LaTeX representation (e.g.,
Julia has https://github.com/stevengj/LaTeXStrings.jl).

Best,
Johannes


On Mon, Oct 30, 2017 at 11:03 AM Sandor Szabo <[email protected]> wrote:

> Thanks for the suggestion. I try to find an alternate solution, maybe
> asking in other forum.
>
>
> On Sunday, 29 October 2017 09:11:59 UTC+1, Damon Allen wrote:
>>
>> There is the extension Py2Tex
>> <http://nbviewer.jupyter.org/urls/gist.github.com/raw/4040388/ee224a8e0875fad241cea4492b4408f1f72a1d8d/Example_py2tex.ipynb>,
>> but I don't know if it still works with the current Jupyter Notebooks since
>> it was last updated four years ago.  Repository for extension
>> <https://github.com/BekeJ/py2tex>.
>>
>> On Saturday, October 28, 2017 at 7:53:30 AM UTC-4, Sandor Szabo wrote:
>>>
>>> Hi,
>>>
>>> In Jupyter Notebook the code
>>>
>>> print( "f(x,x^2)=",  f(x, x**2) )
>>>
>>>
>>> gives the output
>>>
>>> f(x,x^2)= 1/2
>>>
>>>
>>> Instead of   f(x,x^2) I would like to obtain
>>>
>>>            2
>>>   f(x, x ).
>>>
>>> How does it possible to put LaTeX code into print command and print the
>>> nice
>>> output and the value of a calculated variable?
>>> I tried Eq( a, b), but I'm not satisfied with it.
>>>
>>> Sandor
>>>
>>>
>> --
> You received this message because you are subscribed to the Google Groups
> "Project Jupyter" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/jupyter/afb30055-4895-4fef-bbf1-db90a7b79ddf%40googlegroups.com
> <https://groups.google.com/d/msgid/jupyter/afb30055-4895-4fef-bbf1-db90a7b79ddf%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>
-- 

Johannes Feist
IFIMAC & Departamento de Física Teórica de la Materia Condensada
Universidad Autónoma de Madrid
[email protected]

-- 
You received this message because you are subscribed to the Google Groups 
"Project Jupyter" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jupyter/CAPERba2HpfpSinZ4b2Ypy62OBL3wMAOn8BEcasn7EYLFKN%3Dzuw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to