Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to write LaTeX in IPython Notebook?

How can I display LaTeX code in a IPython Notebook?

like image 873
KostasA Avatar asked Nov 03 '12 10:11

KostasA


People also ask

How do you write LaTeX on a Jupyter Notebook?

One of the most popular is Jupyter Notebook that uses MathJax to render the Latex syntax inside the markdown/HTML. To use LaTeX in the Jupyter notebook, put the Latex math content inside the '$ … $' double '$$ … $$' symbols.

How do I write text in IPython notebook?

Simply Enter Esc and type m it will convert to text cell.

What is LaTeX Jupyter Notebook?

LaTeX is a typesetting language for producing scientific documents. We introduce a very small part of the language for writing mathematical notation. Jupyter notebook recognizes LaTeX code written in markdown cells and renders the symbols in the browser using the MathJax JavaScript library.

Can you use LaTeX in markdown?

Mathematical formulaWe can use LaTeX to write mathematical equations in Markdown. To write inline LaTeX formula use a single $ before and after the equation and use a double $ to display equations.


2 Answers

IPython notebook uses MathJax to render LaTeX inside html/markdown. Just put your LaTeX math inside $$.

$$c = \sqrt{a^2 + b^2}$$ 

sqrt

Or you can display LaTeX / Math output from Python, as seen towards the end of the notebook tour:

from IPython.display import display, Math, Latex display(Math(r'F(k) = \int_{-\infty}^{\infty} f(x) e^{2\pi i k} dx')) 

integral

like image 200
minrk Avatar answered Sep 29 '22 23:09

minrk


This came up in a search I was just doing, found a better solution with some more searching, IPython notebooks now have a %%latex magic that makes the whole cell Latex without the $$ wrapper for each line.

Refer notebook tour for Rich Display System

like image 36
hochopeper Avatar answered Sep 30 '22 00:09

hochopeper