Creating book content

The two kinds of files that contain course content are:

  • Jupyter Notebooks
  • Markdown files Each are contained in the content/ folder and referenced from _data/toc.yml.

If the file is markdown, it will be copied over with front-matter YAML added sothat Jekyll can parse it.

  1. print("Python (and any language-specific) code still works as expected")
  1. As does non-language code.

Page navigation Table of Contents

You may notice that there's a sidebar to the right (if your screen is wide enough).These are automatically generated from the headers that are present in your page.The sidebar will automatically capture all 2nd and 3rd level section headers.The best way to designate these headers is with # characters at the beginningof a line.

Here's a third-level header

This section is here purely to demonstrate the third-level header of therendered page in the sidebar!

Mathematics

Jupyter Book uses the excellent MathJax library,along with the default Jupyter Notebook configuration, for rendering mathematics fromlatex-style syntax. For example, here's a mathematical expression rendered with MathJax: \begin{align}P(A1 \cup A_2 \cup A_3) ~ = ~ P(B \cup A_3) &= ~ P(B) + P(A_3) - P(BA_3) \&= ~ P(A_1) + P(A_2) - P(A_1A_2) + P(A_3) - P(A_1A_3 \cup A_2A_3)\&= ~ \sum{i=1}^3 P(Ai) - \mathop{\sum \sum}{1 \le i < j \le 3} P(A_iA_j) + P(A_1A_2A_3)\end{align} And here is the code that was used to generate it:

  1. \begin{align*}
  2. P(A_1 \cup A_2 \cup A_3) ~ = ~ P(B \cup A_3) &= ~ P(B) + P(A_3) - P(BA_3) \\
  3. &= ~ P(A_1) + P(A_2) - P(A_1A_2) + P(A_3) - P(A_1A_3 \cup A_2A_3)\\
  4. &= ~ \sum_{i=1}^3 P(A_i) - \mathop{\sum \sum}_{1 \le i < j \le 3} P(A_iA_j) + P(A_1A_2A_3)
  5. \end{align*}

Note: If you print your page (using the print button), then mathematics may not showup properly in an output PDF. This is because MathJax isn't able to render the mathbefore converting to PDF. If you have a good idea for how to get around this, please doopen an issue!

Embedding media

Adding images

You can reference external media like images from your markdown file. If you userelative paths, then they will continue to work when the markdown files are copied over,so long as they point to a file that's inside of the repository.

Here's an image relative to the book content root

Markdown files - 图1

Adding movies

You can even embed references to movies on the web! For example, here's a little gif for you!

Markdown files - 图2

This will be included in your book when it is built.

Downloading and Printing pages

experimental

While interactivity is nice, sometimes you need a static version of your bookthat's suitable for printing. Currently, Jupyter Book uses a tool calledPrintJS to create rendered PDF versions of yourbook's content.

In the top of each page you'll find a "download" button. Hovering over this buttongives the reader an option to print to PDF. When clicked, PrintJS will convertonly the book's content (so no sidebar or in-page navigation) to PDF, and triggera print action. Note that results for this vary between devices or browsers, andPRs that improve this functionality are welcome!

This page was created by The Jupyter Book Community