Jupyter Book uses MathJax for typesetting math in your HTML book build.This allows you to have LaTeX-style mathematics in your online content.This page shows you a few ways to control this.
See also
For more information about equation numbering,see the MathJax equation numbering documentation.
Tip
By default MathJax version 2 is currently used.If you are using a lot of math, you may want to try using version 3, which claims to improve load speeds by 60 - 80%:
See the Sphinx documentation for details.
In-line math¶
To insert in-line math use the
$
symbol within a Markdown cell.For example, the text $this_{is}^{inline}$
will produce: (this_{is}^{inline}).I am using Jupyter for the first time. I am trying to download a notebook 'as PDF via LaTeX'. However, messages pop up indicating that the required files. Tex xelatex xetex-def xetex.def (part of the xetex-def package). Jupyter/base-notebook¶ Source on GitHub Dockerfile commit history Docker Hub image tags. Jupyter/base-notebook is a small image supporting the options common across all core stacks. It is the basis for all other stacks. Minimally-functional Jupyter Notebook server (e.g., no LaTeX support for saving notebooks as PDFs). Jupyter Notebook Users Manual¶ This page describes the functionality of the Jupyter electronic document system. Jupyter documents are called 'notebooks' and can be seen as many things at once. For example, notebooks allow: creation in a standard web browser; direct sharing. Why Jupyter’s method (pdflatex) didn’t work. By pdflatex, I mean using Jupyter Notebook’s method of converting '.ipynb files to PDFs. (File - Download as - PDF via LaTeX) It doesn’t convert HTML tables to LaTeX tables. Each of my table cells was translated into a new line. It threw errors at me because of # in my Raw cells.
Math blocks¶
You can also include math blocks for separate equations. This allows you to focus attentionon more complex or longer equations, as well as link to them in your pages. To use a blockequation, wrap the equation in either
$$
or begin
statements.For example,
results in:
[ int_0^infty frac{x^3}{e^x-1},dx = frac{pi^4}{15}]
Latex-style math¶
You can enable parsing LaTeX-style math blocks with the
amsmath
MyST extension. Enable it by adding the following to _config.yml
Once enabled, you can define math blocks like so:
which results in:
[begin{gather*}a_1=b_1+c_1a_2=b_2+c_2-d_2+e_2end{gather*}]
(2)¶[begin{align}a_{11}& =b_{11}& a_{12}& =b_{12}a_{21}& =b_{21}& a_{22}& =b_{22}+c_{22}end{align}]
See also
The MyST guides to dollar math syntax, LaTeX math syntax, and how MyST-Parser works with MathJax.
For advanced use, also see how to define MathJax TeX Macros.
Numbering equations¶
If you’d like to number equations so that you can refer to them later, use the math directive.It looks like this:
For example, the following code:
will generate
(3)¶[w_{t+1} = (1 + r_{t+1}) s(w_t) + y_{t+1}]
Alternatively you can use the dollar math syntax with a prefixed label:
which generates
Latex Table Jupyter Notebook
(4)¶[ w_{t+1} = (1 + r_{t+1}) s(w_t) + y_{t+1}]
Note
Labels cannot start with an integer, or they won’t be able to be referenced andwill throw a warning message if referenced. Kia niro awd mpg. For example,
:label:1
and :label:1eq
cannotbe referenced.Linking to equations¶
If you have created an equation with a label, you can link to it from within your text(and across pages!).
You can refer to the equation using the label that you’ve provided by usingthe
{eq}
role. For example:results in
- A link to an equation directive: (3)
- A link to a dollar math block: (4)
Note
Jupyter Notebook Markdown Cheat Sheet
labels
inside LaTeX environment are not currently identified, and so cannot be referenced.We hope to implement this in a future update (see executablebooks/MyST-Parser#202)!Latex Jupyter Notebook Example
Hello, I don't know exactly what's going on. This is cause by two
possible problems.
1. it took too long to create it. In that case just do F5 to reload
that download page again. I haven't figured out who times out too
early :-
2. There are problems with latex. jupyter is very optimistic and
assumes, that every latex code will always compile no matter what. On
the command line, you can try your luck with
jupyter-nbconvert --to=latex [filename].ipynb
and debug by hand, or also be optimistic by doing
jupyter-nbconvert --to=pdf [filename].ipynb
As a possible solution to all of this, maybe does anyone know a good
html to pdf converter? Because then, a third possibility would be to
first run
jupyter-nbconvert --to=html [filename].ipynb
which produces a single html file containing everything (and works all
the time, because hey, jupyter is html!), and then running such a html
to pdf converter to get the PDF. I think, firefox or some headless
chrome could do that, but then you have page folds and other extras
printed in the pages :-(
-- harald
> --
> You received this message because you are subscribed to the Google Groups
> 'sage-cloud' group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/sage-cloud/a497eb5c-d4c9-4cd6-96c3-e90ddf5afe93%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
possible problems.
1. it took too long to create it. In that case just do F5 to reload
that download page again. I haven't figured out who times out too
early :-
2. There are problems with latex. jupyter is very optimistic and
assumes, that every latex code will always compile no matter what. On
the command line, you can try your luck with
jupyter-nbconvert --to=latex [filename].ipynb
and debug by hand, or also be optimistic by doing
jupyter-nbconvert --to=pdf [filename].ipynb
As a possible solution to all of this, maybe does anyone know a good
html to pdf converter? Because then, a third possibility would be to
first run
jupyter-nbconvert --to=html [filename].ipynb
which produces a single html file containing everything (and works all
the time, because hey, jupyter is html!), and then running such a html
to pdf converter to get the PDF. I think, firefox or some headless
chrome could do that, but then you have page folds and other extras
printed in the pages :-(
-- harald
> --
> You received this message because you are subscribed to the Google Groups
> 'sage-cloud' group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/sage-cloud/a497eb5c-d4c9-4cd6-96c3-e90ddf5afe93%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.