more stuff for typst
This commit is contained in:
parent
058a73b159
commit
b31851236c
5 changed files with 119 additions and 77 deletions
|
@ -22,7 +22,7 @@ author = "Erik"
|
|||
highlight_code = true
|
||||
smart_punctuation = true
|
||||
bottom_footnotes = true
|
||||
extra_syntaxes_and_themes = ["syntaxes/"]
|
||||
extra_syntaxes_and_themes = ["syntaxes/"] # for typst support
|
||||
|
||||
|
||||
[extra]
|
||||
|
@ -38,7 +38,7 @@ accent_color = "#ff7800"
|
|||
accent_color_dark = "#380891"
|
||||
|
||||
# Ditto but for the dark theme.
|
||||
fix_contrast_dark = true
|
||||
fix_contrast_dark = false
|
||||
|
||||
show_read_time = true
|
||||
|
||||
|
|
|
@ -1,75 +0,0 @@
|
|||
+++
|
||||
title = "Comparison of some formats"
|
||||
draft = true
|
||||
insert_anchor_links = "left"
|
||||
|
||||
[extra]
|
||||
hot = true
|
||||
katex = true
|
||||
+++
|
||||
|
||||
- [ ] comparison table
|
||||
- [ ] markdown
|
||||
- [ ] math
|
||||
- [ ] exportability
|
||||
- [ ] programmability
|
||||
- [ ] typst
|
||||
- [ ] math
|
||||
- [ ] exportability
|
||||
- [ ] programmability
|
||||
- [ ] latex
|
||||
- [ ] math
|
||||
- [ ] exportability
|
||||
- [ ] programmability
|
||||
|
||||
| | Markdown | Typst | Latex |
|
||||
| :--- | :---| :--- | :--- |
|
||||
| Math support | only using latex| great | great with an enormous community behind it
|
||||
| Exportability |
|
||||
| Programmability[^1]
|
||||
|
||||
[^1]: like plotting, etc.
|
||||
|
||||
## Markdown
|
||||
|
||||
## Typst
|
||||
|
||||
### Math support
|
||||
|
||||
<p>Typst</p>
|
||||
|
||||
In Typst we can plot using the `cetz` library like this:
|
||||
```typst
|
||||
#import "@preview/cetz:0.2.2"
|
||||
|
||||
#cetz.canvas({
|
||||
import cetz.draw: *
|
||||
import cetz.plot
|
||||
plot.plot(size: (10, 4), x-tick-step: 2, y-tick-step: 50,
|
||||
{
|
||||
plot.add(domain: (-4, 4),
|
||||
x => (x, calc.pow(x, 4) ),
|
||||
label: $f(x)=x^4$
|
||||
)
|
||||
plot.add(domain: (-5, 6.34),
|
||||
x => (x, calc.pow(x, 3)),
|
||||
label: $f(x)=x^3$
|
||||
)
|
||||
plot.add(domain: (-10, 10),
|
||||
x => (x, calc.pow(x, 2)),
|
||||
label: $f(x) = x^2$
|
||||
)
|
||||
})
|
||||
})
|
||||
```
|
||||
|
||||
Which leads to this:
|
||||
|
||||
<figure>
|
||||
{{image(url="https://files.catbox.moe/tplzsb.png")}}
|
||||
<!-- was generated using a bit from my `cetz.typ` out of my typst repo -->
|
||||
<figcaption>some standard functions</figcaption>
|
||||
</figure>
|
||||
|
||||
## Latex
|
||||
|
106
content/blog/format-comparison/index.md
Normal file
106
content/blog/format-comparison/index.md
Normal file
|
@ -0,0 +1,106 @@
|
|||
+++
|
||||
title = "Comparison of some formats"
|
||||
draft = true
|
||||
insert_anchor_links = "left"
|
||||
|
||||
[extra]
|
||||
hot = true
|
||||
katex = true
|
||||
+++
|
||||
|
||||
- [ ] comparison table
|
||||
- [ ] markdown
|
||||
- [ ] syntax
|
||||
- [ ] programmability
|
||||
- [ ] typst
|
||||
- [ ] syntax
|
||||
- [x] math
|
||||
- [ ] programmability
|
||||
- [ ] latex
|
||||
- [ ] syntax
|
||||
- [ ] math
|
||||
- [ ] programmability
|
||||
- [ ] tools
|
||||
- [ ] pandoc
|
||||
- [ ] excalidraw
|
||||
- [ ] diagrams.net
|
||||
|
||||
| | Markdown | Typst | Latex |
|
||||
| :--- | :---| :--- | :--- |
|
||||
| **Math support** | only using latex | great | great with an enormous community behind it
|
||||
| **Exportability**[^2] | only `html` is supported | `pdf`, `svg` and `png` are directly supported | `pdf` is supported
|
||||
| **Programmability**[^1] | can be programmed via `css`, `js` and `ts` | has many built in features a package store | has so many options, people are using it to write books!
|
||||
|
||||
[^1]: like plotting, etc.
|
||||
[^2]: many more are supported using pandoc
|
||||
|
||||
<!-- ## Markdown -->
|
||||
|
||||
## Typst
|
||||
|
||||
### Math support
|
||||
|
||||
Typst has pretty _neat_ Math support like this:
|
||||
|
||||
<figure>
|
||||
{{image(url="https://files.catbox.moe/ss9oo1.png")}}
|
||||
<!-- created using `math.typ` -->
|
||||
<figcaption>$f_a(x)=a \cdot x^2$ and it's derivatives</figcaption>
|
||||
</figure>
|
||||
using this code:
|
||||
|
||||
```typst , hide_lines=1-5
|
||||
#set page(
|
||||
height: auto,
|
||||
width: auto,
|
||||
)
|
||||
|
||||
$
|
||||
f_a (x)&=a dot x^2 \
|
||||
f_a ' (x)&=2a x\
|
||||
f_a '' (x)&=2a
|
||||
$
|
||||
```
|
||||
|
||||
<br>
|
||||
|
||||
In Typst we can plot using the `cetz` library like this:
|
||||
```typst
|
||||
#import "@preview/cetz:0.2.2"
|
||||
|
||||
#cetz.canvas({
|
||||
import cetz.draw: *
|
||||
import cetz.plot
|
||||
plot.plot(size: (10, 4), x-tick-step: 2, y-tick-step: 50,
|
||||
{
|
||||
plot.add(domain: (-4, 4),
|
||||
x => (x, calc.pow(x, 4) ),
|
||||
label: $f(x)=x^4$
|
||||
)
|
||||
plot.add(domain: (-5, 6.34),
|
||||
x => (x, calc.pow(x, 3)),
|
||||
label: $f(x)=x^3$
|
||||
)
|
||||
plot.add(domain: (-10, 10),
|
||||
x => (x, calc.pow(x, 2)),
|
||||
label: $f(x) = x^2$
|
||||
)
|
||||
})
|
||||
})
|
||||
```
|
||||
|
||||
Which leads to this:
|
||||
<figure>
|
||||
{{image(url="https://files.catbox.moe/tplzsb.png")}}
|
||||
<!-- using `cetz.typ` -->
|
||||
<figcaption>some standard functions</figcaption>
|
||||
</figure>
|
||||
|
||||
### Exportability
|
||||
|
||||
Typst can be exported to `pdf`, `svg` and `png` directly and many more using [pandoc](https://pandoc.org)
|
||||
|
||||
### Programmability
|
||||
|
||||
<!-- ## Latex -->
|
||||
|
11
content/blog/format-comparison/typst/math.typ
Normal file
11
content/blog/format-comparison/typst/math.typ
Normal file
|
@ -0,0 +1,11 @@
|
|||
#set page(
|
||||
height: auto,
|
||||
width: auto,
|
||||
margin: .5cm
|
||||
)
|
||||
|
||||
$
|
||||
f_a (x)&=a dot x^2 \
|
||||
f_a ' (x)&=2a x\
|
||||
f_a '' (x)&=2a
|
||||
$
|
Loading…
Reference in a new issue