sebastian barfort
NUMEDIG, april 2014
input
output
If only there were some program that could do all these things…
.tex to .html
pandoc -s paper.tex -o paper_tex.html
.tex to .docx
pandoc -s paper.tex -o paper_tex.docx
.tex to beamer slides
pandoc -t beamer slides.tex -o slides_tex.pdf
.tex to .html slides
pandoc -s –mathml -i -t dzslides slides.tex -o slides_tex.html
using the slidy framework
pandoc -s –webtex -i -t slidy slides.tex -o slides_tex.html
\documentclass{beamer}, \title{}, etcIf only there were ever some simpler program that could give us the same funtionality…
- writing should not be an alienating experience trapped in WYSIWYG editors
- a file should be readable intuitively and not be buried in markup
- markdown is a markup language, but one meant to be read by humans rather than machines
Suppose we want to create a nested list
\begin{itemize}
\item fruits
\begin{itemize}
\item apples
\begin{itemize}
\item macintosh
\item red delicious
\end{itemize}
\item pears
\item peaches
\end{itemize}
\item vegetables
\begin{itemize}
\item brocolli
\item chard
\end{itemize}
\end{itemize}
<ul>
<li>fruits
<ul>
<li>apples
<ul>
<li>macintosh</li>
<li>red delicious</li>
</ul></li>
<li>pears</li>
<li>peaches</li>
</ul></li>
<li>vegetables
<ul>
<li>brocolli</li>
<li>chard</li>
</ul></li>
</ul>
* fruits
- apples
- macintosh
- red delicious
- pears
- peaches
* vegetables
- broccoli
- chard
.md to .html
pandoc -s paper.md -o paper_md.html
.md to .pdf
pandoc -s paper.md -o paper_md.pdf
.md to beamer slides
pandoc -t beamer slides.md -o slides_md.pdf
using the slidy .html framework
pandoc -s –webtex -i -t slidy slides.md -o slides_md.html
library(stargazer)
linear.1 <- lm(rating ~ complaints + privileges + learning + raises + critical,
data=attitude)
linear.2 <- lm(rating ~ complaints + privileges + learning, data=attitude)
## create an indicator dependent variable, and run a probit model
attitude$high.rating <- (attitude$rating > 70)
probit.model <- glm(high.rating ~ learning + critical + advance, data=attitude,
family = binomial(link = "probit"))
| Dependent variable: | |||
| rating | high.rating | ||
| OLS | probit | ||
| (1) | (2) | (3) | |
| complaints | 0.692*** | 0.682*** | |
| (0.149) | (0.129) | ||
| privileges | -0.104 | -0.103 | |
| (0.135) | (0.129) | ||
| learning | 0.249 | 0.238* | 0.164*** |
| (0.160) | (0.139) | (0.053) | |
| raises | -0.033 | ||
| (0.202) | |||
| critical | 0.015 | -0.001 | |
| (0.147) | (0.044) | ||
| advance | -0.062 | ||
| (0.042) | |||
| Constant | 11.010 | 11.260 | -7.476** |
| (11.700) | (7.318) | (3.570) | |
| Observations | 30 | 30 | 30 |
| R2 | 0.715 | 0.715 | |
| Adjusted R2 | 0.656 | 0.682 | |
| Log Likelihood | -9.087 | ||
| Akaike Inf. Crit. | 26.180 | ||
| Residual Std. Error | 7.139 (df = 24) | 6.863 (df = 26) | |
| F Statistic | 12.060*** (df = 5; 24) | 21.740*** (df = 3; 26) | |
| Note: | *p<0.1; **p<0.05; ***p<0.01 | ||
R and is a project at GSOC 2014library(pander)
m <- mtcars[1:5, 1:3]
pandoc.table(m, style = "rmarkdown")
| | mpg | cyl | disp |
|:-----------------------:|:-----:|:-----:|:------:|
| **Mazda RX4** | 21 | 6 | 160 |
| **Mazda RX4 Wag** | 21 | 6 | 160 |
| **Datsun 710** | 22.8 | 4 | 108 |
| **Hornet 4 Drive** | 21.4 | 6 | 258 |
| **Hornet Sportabout** | 18.7 | 8 | 360 |
| mpg | cyl | disp | |
|---|---|---|---|
| Mazda RX4 | 21 | 6 | 160 |
| Mazda RX4 Wag | 21 | 6 | 160 |
| Datsun 710 | 22.8 | 4 | 108 |
| Hornet 4 Drive | 21.4 | 6 | 258 |
| Hornet Sportabout | 18.7 | 8 | 360 |