forked from UCSBCarpentry/reproducible-publications-quarto
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathslideshow.qmd
158 lines (110 loc) · 3.7 KB
/
slideshow.qmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
---
title: "Reproducible Research in R with Quarto"
subtitle: "Some history and context"
format:
revealjs:
fontsize: "25px"
theme: "default"
---
##
- How can we make beautiful documents?
- Specifically, how would a programmer solve this problem?
<br>
<br>
- These slides will focus on open standards with open-source implementations.
- The input is always going to be a plain text document, with some special "markup".
## TeX and LaTeX
<style>
.reveal h2 { color: #0000ff; }
</style>
- 1978: In the beginning, Donald Knuth wanted to write some computer science textbooks, so he created TeX.
- 1980s: System further devloped into LaTeX.
- Write papers and books with beautiful text and mathematics.
- Output is usually PDF. <small>(see [XKCD 2304](https://xkcd.com/2304/))</small>
Looks like:
```
\section{Introduction}
In this paper we will consider $x$ and $y$.
\begin{itemize}
\item List item 1.
\item List item 2.
\end{itemize}
\begin{figure}
\includegraphics{graph1}
\caption{An example graph.}
\label{fig:graph1}
\end{figure}
```
## Documents on the World Wide Web
- 1990: Tim Berners-Lee invented the World Wide Web and HTML (HyperText Markup Language).
Looks like:
```
<h1>Introduction</h1>
<p>In this paper we will consider <i>x</i> and <i>y</i>.</p>
<ul>
<li>List item 1.</li>
<li>List item 2.</li>
</ul>
<img src="graph1.png">
```
## Markdown
- HTML is ok, but people wanted more concise formats.
- People wanted documents that looked *ok* in a plain text editor, and lovely in a web browser.
- A lot of different formats were proposed and used in blogging software, forum software, documentation systems, ...
- We have now more or less settled on "Markdown" (2004).
Looks like:
```
# Introduction
In this paper we will consider *x* and *y*.
- List item 1.
- List item 2.
![Some alt-text](graph1.png)
```
## Literate programming
Donald Knuth had another important idea, *literate programming*.
<small>(The idea has developed a bit since Knuth introduced it though.)</small>
<br>
<br>
From a source text file we will *weave* together a beautiful document:
* Nicely formatted text.
* Code, to precisely document what we did.
* Output from the code such as tables and plots.
<br>
<br>
We will also call this *knitting* or *rendering*.
## Quarto
* **Quarto** (2022) is the latest iteration of these ideas about creating documents by writing plain text, and literate programming.
* Builds on top of various older packages, so we will see reference to older `knitr` and `rmarkdown` packages.
* Allows literate programming in R, Python, other languages.
* Can output many formats, output different formats from same source.
* HTML document
* HTML website such as a book
* PDF (using LaTeX)
* Word Document
Quarto is developed by Posit (formerly known as RStudio).
<br><br>
<small>
Similar ideas: Jupyter Notebooks in Python, Observable in Javascript
</small>
## Structured data as text
```
<xml>
XML (1990s) is like HTML for data.
<item>Easily usable by both people and software!</item>
<item>People became very excited about XML for a while.</item>
<item>Turned out to actually be awful for both people and software.</item>
</xml>
{
"JSON" : "JSON (2000s) represents data as you would in Javascript.",
"items" : [
"Also very similar to how Python represents data, and lists in R.",
"JSON was better, but still a bit ugly.",
]
}
YAML: "YAML (2001) makes some JSON punctuation optional, uses indentation like Python."
items:
- YAML has some advanced features you can ignore.
- YAML is a popular configuration format.
- YAML is... fine.
- Quarto uses YAML for configuration, in the header of documents and in the _quarto.yml configuration file.
```