import matplotlib.pyplot as plt
import pandas as pd
import sympy as sym
sym.init_printing(use_latex=True)
import numpy as np
from IPython.display import Image, Latex

Markdown

General

Some markdown text.

A list:

  • something

  • something else

A numbered list

  1. something

  2. something else

non-ascii characters TODO

This is a long section of text, which we only want in a document (not a presentation) some text some more text some more text some more text some more text some more text some more text some more text some more text

This is an abbreviated section of the document text, which we only want in a presentation

  • summary of document text

References and Citations

References to \cref{fig:example}, \cref{tbl:example}, =@eqn:example_sympy and \cref{code:example_mpl}.

A latex citation.\cite{zelenyak_molecular_2016}

A html citation.(Kirkeminde, 2012)

Todo notes

\todo[inline]{an inline todo}

Some text.\todo{a todo in the margins}

Text Output

print("""
This is some printed text,
with a nicely formatted output.
""")
This is some printed text,
with a nicely formatted output.

Images and Figures

Image('example.jpg',height=400)

Displaying a plot with its code

A matplotlib figure, with the caption set in the markdowncell above the figure.

The plotting code for a matplotlib figure (\cref{fig:example_mpl}).

plt.scatter(np.random.rand(10), np.random.rand(10), 
            label='data label')
plt.ylabel(r'a y label with latex $\alpha$')
plt.legend();
_images/16832f45917c1c9862c50f0948f64a498402d6ccde1f3a291da17f240797b160.png

Tables (with pandas)

The plotting code for a pandas Dataframe table (\cref{tbl:example}).

df = pd.DataFrame(np.random.rand(3,4),columns=['a','b','c','d'])
df.a = [r'$\delta$','x','y']
df.b = ['l','m','n']
df.set_index(['a','b'])
df.round(3)
a b c d
0 $\delta$ l 0.391 0.607
1 x m 0.132 0.205
2 y n 0.969 0.726

Equations (with ipython or sympy)

Latex('$$ a = b+c $$')
\[ a = b+c \]

The plotting code for a sympy equation (=@eqn:example_sympy).

y = sym.Function('y')
n = sym.symbols(r'\alpha')
f = y(n)-2*y(n-1/sym.pi)-5*y(n-2)
sym.rsolve(f,y(n),[1,4])
_images/8c43e5c8cccf697754876b7fec1b0a9b731d7900bb585e775a5fa326b4de8c5a.png
from IPython.display import display, Markdown
display(Markdown('**_some_ markdown**'))

some markdown