%%latex
\begin{align}
a = \frac{1}{2}\\
\end{align}

"""
Explanation: 使用Jupyter制作Slides
王成军 
wangchengjun@nju.edu.cn
计算传播网 http://computational-communication.com
RISE: "Live" Reveal.js Jupyter/IPython Slideshow Extension
https://github.com/damianavila/RISE
Installation

Downnload from https://github.com/damianavila/RISE

open your teminal, cd to the RISE folder, e.g., 

cd  /github/RISE/



To install this nbextension, simply run 

python setup.py install



from the RISE repository.
In the notebook toolbar, a new button ("Enter/Exit Live Reveal Slideshow") will be available.
The notebook toolbar also contains a "Cell Toolbar" dropdown menu that gives you access to metadata for each cell. If you select the Slideshow preset, you will see in the right corner of each cell a little box where you can select the cell type (similar as for the static reveal slides with nbconvert).
将ipynb文件转为slides.html

download the reveal.js from Github https://github.com/hakimel/reveal.js
generate html using the following code
put the generated html into the reveal.js folder

open the html using chrome
chengjuns-MacBook-Pro:~ chengjun$ cd github/cjc2016/code/
chengjuns-MacBook-Pro:code chengjun$ jupyter nbconvert slides.ipynb --to slides --post serve


数学公式
$E = MC^2$
End of explanation
"""


print 'hello world'

for i in range(10):
    print i

# get a list of all the available magics

% lsmagic

% env
# to list your environment variables.

%prun

%time range(10)

%timeit range(100)

"""
Explanation: 程序代码
End of explanation
"""


! cd /Users/chengjun/github/

% matplotlib inline 
# to show matplotlib plots inline the notebook.
import matplotlib.pyplot as plt

plt.plot(range(10), range(10), 'r-o')
plt.show()

"""
Explanation: !: to run a shell command. E.g., ! pip freeze | grep pandas to see what version of pandas is installed.
End of explanation
"""


