Switch branches/tags
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
72 lines (48 sloc) 2.54 KB

% Writing beautiful and reproducible slides quickly % Yihui Xie % 2012/04/30

# set global chunk options


  • after you finished typing \documentclass{beamer} and \title{}, I have finished my first slide with markdown
  • far fewer commands to remember, e.g. to write bullet points, just begin with a dash "-" instead of \begin{itemize} and \item; how things can be simpler?
  • I know you want math to show you are a statistician, e.g. $f(k)={n \choose k}p^{k}(1-p)^{n-k}$
  • you do not need to maintain output -- only maintain a source file
  • HTML5/CSS3 is much more fun than LaTeX

A bit R code


Graphics too

```{r graphics, message=FALSE, fig.cap='A scatterplot of cars', fig.width=11, fig.height=5} library(ggplot2) qplot(speed, dist, data = cars) + geom_smooth()

# How

- source editor: [RStudio]( (perfect integration with [**knitr**](; one-click compilation); currently you have to use the version >= 0.96.109
- HTML5 slides converter: [pandoc](; this document was generated by: `pandoc -s -S -i -t dzslides --mathjax -o knitr-slides.html`
- the file [``]( is the markdown output from its [source]( `library(knitr); knit('knitr-slides.Rmd')`
- or simple click the button `Knit HTML` in RStudio

# For ninjas

- you should tweak the default style; why not try some [Google web fonts]( (think how painful it is to wrestle with fonts in LaTeX)
- pandoc provides 3 types of HTML5 slides (dzslides is one of them)
- you can tweak the default template to get better appearances
- if you have come up with a better dzslides template, please let me know or contribute to pandoc directly (e.g. `pre` blocks should have `max-width` and `max-height`)

# For beamer lovers

- pandoc supports conversion to beamer as well. period.

# For Powerpoint lovers

- ...

# Reproducible research

It is good to include the session info, e.g. this document is produced with **knitr**. Here is my session info:

```{r session-info}
print(sessionInfo(), locale=FALSE)

Misc issues

  • the plots are too wide? use the chunk option out.width which will be used in <img width=... />, e.g. out.width=400px

Life is short

  • so keep your audience awake!