Lecture 3: Literate Programming
Literate Programming
In class, I live-coded in Quarto to demonstrate Literate Programming. The homepage.qmd document and the lecture recording are available on Canvas.
Resources
Here are some useful resources that I referred to during the lecture or would like to make you aware of now.
- Quarto Website
- Quarto Cheatsheet
- Quarto HTML Basics (for a bunch of good ideas!)
- Quarto HTML Format Options
- TinyTeX (if you want to render to PDF)
- Markdown Wikipedia Page (in case you’re interested in the history)
- LaTeX Wikipedia Page (in case you’re interested in the history)
- Quarto LaTeX Equations (in case you want math in your document; see below)
- MathJax Quick Reference (for help writing equations)
Math
I forgot to mention this during the lecture, but easily including Greek letters, math symbols, or equations is also very easy in a Quarto document. By default, HTML pages render the math using MathJax.
Inline
You can include equations, like \(y = mx + b\), inline in your documents. You create an inline equation by wrapping the expression in $.
Chunks
You can also write math in chunks on their own line(s). You begin a chunk with $$, write the chunk, and end it with $$.
\[ \mu = \beta_0 + \beta_1 x \] \[ y \sim Normal(\mu, \sigma^2 ) \]