% Manage presentations like code with
Pandoc and Github
% Jim Baker
% jim.baker@{python.org, rackspace.com}
@jimbaker on Twitter
This presentation uses a variety of tools:
- Github
- Markdown, including code fragments
- Pandoc for translating to Beamer presentations
- Can use \LaTeX but just for bits like math
- Beamer templates and themes
Mark up of your presentation with Markdown is easy to use, as seen in the source for the previous slide:
Overview
========
This presentation uses a variety of tools:
* Github
* Markdown, including code fragments
* Pandoc for translating to Beamer presentations
* Can use \LaTeX but just for bits like math
* Beamer templates and themes
Pygments is built in, as seen in this code snippet from the
itertools
recipes:
def random_permutation(iterable, r=None):
"Random selection from itertools.permutations"
pool = tuple(iterable)
r = len(pool) if r is None else r
return tuple(random.sample(pool, r))
- You do need to figure out how to make it fit!
- Good practice to use defaults in terms of sizing, vs trying to figure out how to squeeze in more text
Source for the earlier fragment:
Pygments is built in, as seen in this code snippet
from the `itertools` recipes:
````python
def random_permutation(iterable, r=None):
"Random selection from itertools.permutations"
pool = tuple(iterable)
r = len(pool) if r is None else r
return tuple(random.sample(pool, r))
````
...
The usual invocations:
$ git add presentation-pipeline.md
$ git commit -m "Initial version"
$ git push
$ pandoc -f markdown -V theme:PaloAlto \
--write beamer --template lecture.beamer \
-o presentation-pipeline.pdf \
presentation-pipeline.md
- Or wrap in the script of your choice
- Add
-i
option for incremental bullets - Read the Pandoc docs for more options on producing presentations
- Use arbitrary math
- Such as getting
$O(n^2)$ just by writing$O(n^2)$
- Or use macro packages from stylesheets
All even natural numbers
- example axiom - no premise is of course used
\begin{mathpar} \inferrule{\hspace{5pt}} {0 \in E} \end{mathpar}
- example induction rule, such that the inductively-defined set
$E$ is the least set that is closed under such induction rules:
\begin{mathpar} \inferrule{n \in E} {n + 2 \in E} \end{mathpar}
Can use \LaTeX macros:
\begin{mathpar}
\inferrule{\hspace{5pt}}
{0 \in E}
\end{mathpar}
\begin{sequencediagram} \newthread{J}{Java} \newinst[1]{R}{Jython runtime} \newinst[1]{P}{Python} \begin{call}{J}{x.call()}{R}{return} \begin{call}{R}{ProxyMaker.findPython(this, "call")}{P}{return} \begin{callself}{P}{BarClamp.call}{} \end{callself} \end{call} \end{call} \end{sequencediagram}
Produced by this source text in \LaTeX:
\begin{sequencediagram}
\newthread{J}{Java}
\newinst[1]{R}{Jython runtime}
\newinst[1]{P}{Python}
\begin{call}{J}{x.call()}{R}{return}
\begin{call}{R}{ProxyMaker.findPython(this, "call")}{P}{return}
\begin{callself}{P}{BarClamp.call}{}
\end{callself}
\end{call}
\end{call}
\end{sequencediagram}
- Support for sequence diagrams, etc., requires importing the supporting Latex stylesheets
- Straightforward to import:
\usepackage{amssymb,amsmath,mathpartir}
\usepackage{longtable}
\usepackage{ifxetex,ifluatex}
\usepackage{fixltx2e} % provides \textsubscript
\usepackage{tikz}
\usepackage{tikz-qtree}
\usetikzlibrary{arrows,shadows}
\usepackage{pgf-umlsd}
\usepackage{smartdiagram}
\usesmartdiagramlibrary{additions}
PaloAlto
Berlin
- and other city names
- Latex does produce somewhat inscrutable errors
- Especially when combined with another tool like Pandoc
- Generate Latex source
- Go to the produced error
- Maybe that works
- Or comment out
Markdown simply uses standard HTML comments:
<!--- put your comments here
Such as commenting out this block
--->
You can include other HTML markup as well
Any questions?
Now or for later:
jim.baker@{python.org, rackspace.com}
@jimbaker
Talk available at github.com/jimbaker/talks