Content

The content of a chapter of a book can be a standard Markdown file (.md) or a .nim file.

The nim file must be a nimib document and the default content (created by init command) is:

import nimib, nimibook

nbInit(theme = useNimibook)
nbText: "## Default Content"
nbSave

Latex

Latex is available through Katex as in Nimib. It is enabled on a specific document with the command

nb.useLatex

which adds the following content in the head of the document:

<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.12.0/dist/katex.min.css" integrity="sha384-AfEj0r4/OFrOo5t7NnNe46zW/tFgW6x/bCJG8FqQCEo3+Aro6EYUG4+cU+KJWu/X" crossorigin="anonymous">
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.12.0/dist/katex.min.js" integrity="sha384-g7c+Jr9ZivxKLnZTDUhnkOnsh30B4H0rpLUpJ4jAIKs4fnJI+sEnkvrMWph2EDg4" crossorigin="anonymous"></script>
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.12.0/dist/contrib/auto-render.min.js" integrity="sha384-mll67QQFJfxn0IYznZYonOWZ644AWYC+Pt2cHqMaRhXVrursRwvLnLaebdGIlYNa" crossorigin="anonymous" onload="renderMathInElement(document.body,{delimiters:[{left: '$$', right: '$$', display: true},{left: '$', right: '$', display: false}]});"></script>

Inline equations

Inline equations are obtained with delimiters $ ... $. The following inline paragraph:

Euler's identity is the equality $e^{i\pi} + 1 = 0$, where $e$ is the base of natural logarithms, $i$ is the imaginary unit, and $\pi$ is the ratio of circumference of a circle to its diameter.

...is created with the following source:

> Euler's identity is the equality
> $e^{i\pi} + 1 = 0$, where $e$ is the base of natural logarithms,
> $i$ is the imaginary unit, and $\pi$ is the ratio of circumference of a circle
> to its diameter.

Block equations

Block equations are obtained with delimiters $$ ... $$. The follwing block equation:

$$ f(x) = \frac{1}{\sigma\sqrt{2\pi}} \exp\left( -\frac{1}{2}\left(\frac{x-\mu}{\sigma}\right)^{!2},\right) $$

...is created with the following source:

$$ 
  f(x) = \frac{1}{\sigma\sqrt{2\pi}} 
  \exp\left( -\frac{1}{2}\left(\frac{x-\mu}{\sigma}\right)^{\!2}\,\right)
$$

MathJax support

As in the original mdbook, you can opt instead to activate MathJax support with:

nb.context["mathjax_support"] = true