In [ ]:
from ipypublish.scripts.ipynb_latex_setup import *

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


In [3]:
print("""
This is some printed text,
with a nicely formatted output.
""")


This is some printed text,
with a nicely formatted output.

Images and Figures


In [3]:
Image('example.jpg',height=400)


Out[3]:

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}).


In [9]:
plt.scatter(np.random.rand(10), np.random.rand(10), 
            label='data label')
plt.ylabel(r'a y label with latex $\alpha$')
plt.legend();


Tables (with pandas)

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


In [8]:
df = pd.DataFrame(np.random.rand(3,4),columns=['a','b','c','d'])
df.a = ['$\delta$','x','y']
df.b = ['l','m','n']
df.set_index(['a','b'])
df.round(3)


Out[8]:
a b c d
0 $\delta$ l 0.583 0.279
1 x m 0.914 0.021
2 y n 0.333 0.116

Equations (with ipython or sympy)


In [9]:
Latex('$$ a = b+c $$')


Out[9]:
$$ a = b+c $$

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


In [10]:
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])


Out[10]:
$$\left(\sqrt{5} i\right)^{\alpha} \left(\frac{1}{2} - \frac{2 i}{5} \sqrt{5}\right) + \left(- \sqrt{5} i\right)^{\alpha} \left(\frac{1}{2} + \frac{2 i}{5} \sqrt{5}\right)$$