-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathwriteup.jmd
More file actions
71 lines (49 loc) · 1.25 KB
/
writeup.jmd
File metadata and controls
71 lines (49 loc) · 1.25 KB
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
---
title : Literate Programming Example
author : My Name
date: 6th Janurary 2020
---
# Literate Programming
This is a fancy way to make writeups that include text, math, plots, and code.
It lets us avoid writing code in one file, evaluating it, and copying the output
into LaTeX.
The code that we are writing is evaluated in place.
## Text with Markdown
We can use standard markdown like **bold** and *italics*
* and
* make
* lists
## Code
For example
```julia
print("hello world")
```
Sometimes we'll want to share the code without showing the output
Use the standard `;` to supress output
```julia
1+1
```
```julia
1+1; #; supresses output
```
## Plots
Calling plot commands will output the plot directly in the file!
```julia; fig_cap="My Figure Caption"
using Plots
plot(-1:0.01:1,x->x^2)
```
We can make the file in Julia by running
## LaTeX Math
Get syntax highlighting with Atom `language-latex` package.
You can write inline math $x^2$ or block math like
$$
x^3
$$
# Compile the file into a pdf
I reccomend evaluating the julia code using `Shift+Enter` as usual.
But when you're ready to make your writeup you can run the following code!
```julia; eval=false
using Weave
weave("writeup.jmd", doctype = "md2pdf")
```
and opening up `writeup.pdf`!