Markdown

Notebooks use Markdown as the text format for text cells. This example notebook shows many features that you may find useful in your own notebooks.

Basic Writing

Paragraphs

Paragraphs are just lines of text that are not indented, followed by a blank line.

We have a habit in writing articles
published in scientific journals to
make the work as finished as possible,
to cover all the tracks, to not worry
about the blind alleys or to describe
how you had the wrong idea first, and
so on. So there isn't any place to
publish, in a dignified manner, what
you actually did in order to get to
do the work.

Richard Feynman, Nobel Lecture, 1965.

Headings

Headings are indicated with # symbols, followed by a space, followed by heading text. There are multiple levels of headings, from # down to #####.

# Title

## Second heading

### Smaller heading

Different levels of heading are equivalent to <h1> through <h5> tags.

Quotations

Quotations are indicated with > then the text to be quoted. Let's redo the Feynman quote.

> We have a habit in writing articles
> published in scientific journals to
> make the work as finished as possible,
> to cover all the tracks, to not worry
> about the blind alleys or to describe
> how you had the wrong idea first, and
> so on. So there isn't any place to
> publish, in a dignified manner, what
> you actually did in order to get to
> do the work.
> 
> Richard Feynman, Nobel Lecture, 1965.

That will look like this:

We have a habit in writing articles published in scientific journals to make the work as finished as possible, to cover all the tracks, to not worry about the blind alleys or to describe how you had the wrong idea first, and so on. So there isn't any place to publish, in a dignified manner, what you actually did in order to get to do the work.

Richard Feynman, Nobel Lecture, 1965.

Text Styles

Italic and bold

You can make text italic by placing _ before and after it. So _italic_ becomes italic.

You can make text bold by placing ** before and after it. So **bold** becomes bold.

If you want to go wild you can _**do both**_ and get bold italic.

Strikethrough

To show crossed-out text you use ~~ before and after.

I ~~hate~~love Python.

I hatelove Python.

Code Formatting

Inline

You can use a single backtick around text to treat inline text as code with no other special formatting. It looks like this then you put backticks around a word.

If you name your function `foo` then you
deserve what you get.

If you name your function foo then you deserve what you get.

Blocks

To typeset a block of code, start and end with a line of three backticks.

```
# Most useless function
def f(x):
   return x + 1
```

This will render as:

# Most useless function
def f(x):
   return x + 1

Syntax highlighting

You can also include a language for the code to turn on syntax highlighting.

```python
# Most useless function
def f(x):
   return x + 1
```

# Most useless function
def f(x):
   return x + 1

Some of the other choices for language include bash, html, css, javascript, markdown, python, ruby, perl, c++, java, R, Mathematica, Matlab.

For example, here is some meaningless R code. (Note: Pineapple currently only supports Python kernels so code cells must be in Python).

library(ggplot2)

myVar1
# Comment
"This is a string # still string"
plot(data, xlim=20)

Syntax highlighting is supplied by highlight.js.

The simplest way to put in a link to a webpage is to just paste in the full URL inside a paragraph. Full URLs are expanded to be clickable links.

Syntax highlighting is
supplied by https://highlightjs.org/.

Syntax highlighting is supplied by https://highlightjs.org/.

You can also create links by putting the anchor text inside [ ] followed by the URL inside ( ).

Syntax highlighting is
supplied by [highlight.js](https://highlightjs.org/).

Syntax highlighting is supplied by highlight.js.

Lists

Unordered lists are created by starting with a - or * with no indentation.

- First
- Second
- Third

  • First
  • Second
  • Third

Ordered lists are created by starting with a number and a period.

1. First
2. Second
3. Third

  1. First
  2. Second
  3. Third

You can nest lists using identation.

Unicode and Symbols

You can type unicode characters directly into notebooks. If you cannot type a character directly you can also enter its HTML code. Some unicode characters may not be available in your installed fonts but common symbols should always be available.

See https://en.wikipedia.org/wiki/List_of_Unicode_characters for codes.

The measurement took 3 µs.

The measurement took 3 µs.

The measurement took 3 µs.

The measurement took 3 µs.

The symbol ℝ is commonly used to denote the reals in mathematics.

The symbol ℝ is commonly used to denote the reals in mathematics.

My clarinet is tuned to B♭.

My clarinet is tuned to B♭.

LaTeX

Text cells can also contain mathematica formulas using LaTeX notation. Formulas render using MathJax.

Inline

Surround inline formulas or names with $.

The variable $x$ is in the bounds $0 \le x \le 1$.

The variable $x$ is in the bounds $0 \le x \le 1$.

With some work we get $\int_1^\infty x^{-2} dx = 1$.

With some work we get $\int_1^\infty x^{-2} dx = 1$.

Equations

To put equations on thier own line, surround them with $$.

$$\int_1^\infty \frac{1}{x^2} dx = 1$$

$$\int_1^\infty \frac{1}{x^2} dx = 1$$

Advanced LaTeX

You can do more advanced things inside formulas. Pineapple includes the base MathJax package which includes most Plain TeX math, most LaTeX macros and environments, AMS math, and AMS symbols. It does not include any other processor extensions or packages.

Maxwell's Equations

$$ \begin{aligned} \nabla \times \vec{\mathbf{B}} -\, \frac1c\, \frac{\partial\vec{\mathbf{E}}}{\partial t} & = \frac{4\pi}{c}\vec{\mathbf{j}} \\ \nabla \cdot \vec{\mathbf{E}} & = 4 \pi \rho \\ \nabla \times \vec{\mathbf{E}}\, +\, \frac1c\, \frac{\partial\vec{\mathbf{B}}}{\partial t} & = \vec{\mathbf{0}} \\ \nabla \cdot \vec{\mathbf{B}} & = 0 \end{aligned} $$

Substack (AMS math)

$$ \sum_{ \substack{ 1\lt i\lt 3 \\ 1\le j\lt 5 }} a_{ij} $$

Breaks and Rules

You can insert HTML spacing such as <br /> or &nbsp; as needed.

Mr. Jones should never<br />have his appelation
disassociated from his nominative.

Mr. Jones should never
have his appelation disassociated from his nominative.

You can create a rule with a single line of ---- with blank lines before and after.

----