Temp. erweitert
This commit is contained in:
+395
-12
@@ -37,24 +37,407 @@
|
||||
| `\varsigma` | $\varsigma$ | sigma.alt |
|
||||
| `\varphi` | $\varphi$ | phi |
|
||||
|
||||
Grosse griechische Buchstaben
|
||||
### Grosse griechische Buchstaben
|
||||
|
||||
| LaTeX | Vorschau | Typst |
|
||||
|:---------- | ---------- | ----------- |
|
||||
| `\Gamma` | $\alpha$ | alpha |
|
||||
| `\Delta` | $\beta$ | beta |
|
||||
| `\Theta` | $\gamma$ | gamma |
|
||||
| `\Lambda` | $\delta$ | delta |
|
||||
| `\Xi` | $\epsilon$ | epsilon.alt |
|
||||
| `\Pi` | $\zeta$ | zeta |
|
||||
| `\Sigma` | $\eta$ | eta |
|
||||
| `\Upsilon` | $\theta$ | theta |
|
||||
| `\Phi` | $\iota$ | iota |
|
||||
| :--------- | ---------- | ------- |
|
||||
| `\Gamma` | $\Gamma$ | Gamma |
|
||||
| `\Delta` | $\Delta$ | Delta |
|
||||
| `\Theta` | $\Theta$ | Theta |
|
||||
| `\Lambda` | $\Lambda$ | Lambda |
|
||||
| `\Xi` | $\Xi$ | Xi |
|
||||
| `\Pi` | $\Pi$ | Pi |
|
||||
| `\Sigma` | $\Sigma$ | Sigma |
|
||||
| `\Upsilon` | $\Upsilon$ | Upsilon |
|
||||
| `\Phi` | $\Phi$ | Phi |
|
||||
| `\Psi` | $\Psi$ | Psi |
|
||||
| `\Omega` | $\Omega$ | Omega |
|
||||
|
||||
### Integral
|
||||
|
||||
| LaTeX | Vorschau | Typst |
|
||||
| :--------- | ---------- | ------- |
|
||||
| `\int_a^b f(x) \mathrm{d} x` | $\int_a^b f(x) \mathrm{d} x$ | integral_a^b f(x) dif x |
|
||||
| `\int` | $\int$ | integral |
|
||||
| `\oint` | $\oint$ | integral.cont |
|
||||
| `\iint` | $\iint$ | integral.double |
|
||||
| `\oiint` | $\oiint$ | integral.surf |
|
||||
| `\iiint` | $\iiint$ | integral.triple |
|
||||
| `\oiiint` | $\oiiint$ | integral.vol |
|
||||
|
||||
### Fonts
|
||||
|
||||
| LaTeX | Vorschau | Typst |
|
||||
| :--------------- | ---------------- | ------- |
|
||||
| `\boldsymbol{A}` | $\boldsymbol{A}$ | bold(A) |
|
||||
| `\mathbb{A}` | $\mathbb{A}$ | AA |
|
||||
|
||||
# Temp
|
||||
|
||||
| `\mathbb{A}` | A | `AA` |
|
||||
| -------------- | ----- | ------------------ |
|
||||
| `\mathbf{A}` | **A** | `upright(bold(A))` |
|
||||
| `\mathcal{A}` | A | `cal(A)` |
|
||||
| `\mathscr{A}` | A | `scr(A)` |
|
||||
| `\mathit{A}` | *A* | `italic(A)` |
|
||||
| `\mathfrak{A}` | A | `frak(A)` |
|
||||
| `\mathrm{A}` | A | `upright(A)` |
|
||||
| `\mathsf{A}` | A | `sans(A)` |
|
||||
| `\mathtt{A}` | A | `mono(A)` |
|
||||
|
||||
## Arrows
|
||||
|
||||
| LaTeX | Preview | Typst (Textual) | Typst (Shorthand) |
|
||||
| --------------------- | ------- | ----------------------- | ----------------- |
|
||||
| `\leftarrow` | ← | `arrow.l` | `<-` |
|
||||
| `\gets` | ← | `arrow.l` | `<-` |
|
||||
| `\rightarrow` | → | `arrow.r` | `->` |
|
||||
| `\to` | → | `arrow.r` | `->` |
|
||||
| `\leftrightarrow` | ↔ | `arrow.l.r` | `<->` |
|
||||
| `\Leftarrow` | ⇐ | `arrow.l.double` | `` |
|
||||
| `\Rightarrow` | ⇒ | `arrow.r.double` | `=>` |
|
||||
| `\Leftrightarrow` | ⇔ | `arrow.l.r.double` | `<=>` |
|
||||
| `\mapsto` | ↦ | `arrow.r.bar` | `|->` |
|
||||
| `\hookleftarrow` | ↩ | `arrow.l.hook` | `` |
|
||||
| `\leftharpoonup` | ↼ | `harpoon.lt` | `` |
|
||||
| `\leftharpoondown` | ↽ | `harpoon.lb` | `` |
|
||||
| `\rightleftharpoons` | ⇌ | `harpoons.rtlb` | `` |
|
||||
| `\longleftarrow` | ⟵ | `arrow.l.long` | `<--` |
|
||||
| `\longrightarrow` | ⟶ | `arrow.r.long` | `-->` |
|
||||
| `\longleftrightarrow` | ⟷ | `arrow.l.r.long` | `<-->` |
|
||||
| `\Longleftarrow` | ⟸ | `arrow.l.double.long` | `<==` |
|
||||
| `\Longrightarrow` | ⟹ | `arrow.r.double.long` | `==>` |
|
||||
| `\Longleftrightarrow` | ⟺ | `arrow.l.r.double.long` | `<==>` |
|
||||
| `\longmapsto` | ⟼ | `arrow.r.long.bar` | `` |
|
||||
| `\hookrightarrow` | ↪ | `arrow.r.hook` | `` |
|
||||
| `\rightharpoonup` | ⇀ | `harpoon.rt` | `` |
|
||||
| `\rightharpoondown` | ⇁ | `harpoon.rb` | `` |
|
||||
| `\iff` | ⟺ | `arrow.l.r.double.long` | `<==>` |
|
||||
| `\implies` | ⟹ | `arrow.r.double.long` | `==>` |
|
||||
| `\uparrow` | ↑ | `arrow.t` | `` |
|
||||
| `\downarrow` | ↓ | `arrow.b` | `` |
|
||||
| `\updownarrow` | ↕ | `arrow.t.b` | `` |
|
||||
| `\Uparrow` | ⇑ | `arrow.t.double` | `` |
|
||||
| `\Downarrow` | ⇓ | `arrow.b.double` | `` |
|
||||
| `\Updownarrow` | ⇕ | `arrow.t.b.double` | `` |
|
||||
| `\nearrow` | ↗ | `arrow.tr` | `` |
|
||||
| `\searrow` | ↘ | `arrow.br` | `` |
|
||||
| `\swarrow` | ↙ | `arrow.bl` | `` |
|
||||
| `\nwarrow` | ↖ | `arrow.tl` | `` |
|
||||
| `\leadsto` | ⇝ | `arrow.r.squiggly` | `~>` |
|
||||
| `\leftleftarrows` | ⇇ | `arrows.ll` | `` |
|
||||
| `\rightrightarrows` | ⇉ | `arrows.rr` | |
|
||||
|
||||
|
||||
|
||||
## Set and Elements
|
||||
|
||||
| LaTeX | Preview | Typst |
|
||||
| ------------- | ------- | ----------- |
|
||||
| `\in` | ∈ | `in` |
|
||||
| `\subset` | ⊂ | `subset` |
|
||||
| `\subseteq` | ⊆ | `subset.eq` |
|
||||
| `\supset` | ⊃ | `supset` |
|
||||
| `\supseteq` | ⊇ | `supset.eq` |
|
||||
| `\varnothing` | ∅ | `diameter` |
|
||||
|
||||
## Non-mathematical Symbols
|
||||
|
||||
| LaTeX | Preview | Typst |
|
||||
| ------------ | ------- | ----------- |
|
||||
| `\$` | $ | `\$` |
|
||||
| `\pounds` | £ | `pound` |
|
||||
| `\yen` | ¥ | `yen` |
|
||||
| `\copyright` | c◯ | `copyright` |
|
||||
| `\S` | § | `section` |
|
||||
| `\P` | ¶ | `pilcrow` |
|
||||
|
||||
## Miscellaneous Symbols
|
||||
|
||||
| LaTeX | Preview | Typst (Textual) | Typst (Shorthand) |
|
||||
| -------------------- | ------- | ------------------ | ----------------- |
|
||||
| `\Cap` | ⋒ | `inter.double` | `` |
|
||||
| `\Cup` | ⋓ | `union.double` | `` |
|
||||
| `\Join` | ⋈ | `join` | `` |
|
||||
| `\aleph` | ℵ | `alef` | `` |
|
||||
| `\angle` | ∠ | `angle` | `` |
|
||||
| `\approx` | ≈ | `approx` | `` |
|
||||
| `\approxeq` | ≊ | `approx.eq` | `` |
|
||||
| `\ast` | ∗ | `ast` | `` |
|
||||
| `\bigcap` | ⋂ | `inter.big` | `` |
|
||||
| `\bigcirc` | ◯ | `circle.big` | `` |
|
||||
| `\bigcup` | ⋃ | `union.big` | `` |
|
||||
| `\bigodot` | ⨀ | `dot.o.big` | `` |
|
||||
| `\bigoplus` | ⨁ | `xor.big` | `` |
|
||||
| `\bigotimes` | ⨂ | `times.o.big` | `` |
|
||||
| `\bigsqcup` | ⨆ | `union.sq.big` | `` |
|
||||
| `\bigtriangledown` | ▽ | `triangle.b` | `` |
|
||||
| `\bigtriangleup` | △ | `triangle.t` | `` |
|
||||
| `\biguplus` | ⨄ | `union.plus.big` | `` |
|
||||
| `\bigvee` | ⋁ | `or.big` | `` |
|
||||
| `\bigwedge` | ⋀ | `and.big` | `` |
|
||||
| `\bullet` | ∙ | `bullet` | `` |
|
||||
| `\cap` | ∩ | `inter` | `` |
|
||||
| `\cdot` | ⋅ | `dot.op` | `` |
|
||||
| `\cdots` | ⋯ | `dots.c` | `` |
|
||||
| `\checkmark` | ✓ | `checkmark` | `` |
|
||||
| `\circ` | ∘ | `circle.small` | `` |
|
||||
| `\colon` | : | `colon` | `` |
|
||||
| `\cong` | ≅ | `tilde.equiv` | `` |
|
||||
| `\coprod` | ∐ | `product.co` | `` |
|
||||
| `\cup` | ∪ | `union` | `` |
|
||||
| `\curlyvee` | ⋎ | `or.curly` | `` |
|
||||
| `\curlywedge` | ⋏ | `and.curly` | `` |
|
||||
| `\dagger` | † | `dagger` | `` |
|
||||
| `\dashv` | ⊣ | `tack.l` | `` |
|
||||
| `\ddagger` | ‡ | `dagger.double` | `` |
|
||||
| `\ddots` | ⋱ | `dots.down` | `` |
|
||||
| `\diamond` | ⋄ | `diamond` | `` |
|
||||
| `\div` | ÷ | `div` | `` |
|
||||
| `\divideontimes` | ⋇ | `times.div` | `` |
|
||||
| `\dotplus` | ∔ | `plus.dot` | `` |
|
||||
| `\ell` | ℓ | `ell` | `` |
|
||||
| `\emptyset` | ∅ | `nothing` | `` |
|
||||
| `\equiv` | ≡ | `equiv` | `` |
|
||||
| `\exists` | ∃ | `exists` | `` |
|
||||
| `\forall` | ∀ | `forall` | `` |
|
||||
| `\ge` | ≥ | `gt.eq` | `>=` |
|
||||
| `\geq` | ≥ | `gt.eq` | `>=` |
|
||||
| `\geqslant` | ⩾ | `gt.eq.slant` | `` |
|
||||
| `\gg` | ≫ | `gt.double` | `>>` |
|
||||
| `\hbar` | ℏ | `planck` | `` |
|
||||
| `\imath` | ** | `dotless.i` | `` |
|
||||
| `\infty` | ∞ | `infinity` | `oo` |
|
||||
| `\intercal` | ⊺ | `top` | `` |
|
||||
| `\jmath` | ** | `dotless.j` | `` |
|
||||
| `\land` | ∧ | `and` | `` |
|
||||
| `\langle` | ⟨ | `chevron.l` | `` |
|
||||
| `\lbrace` | { | `brace.l` | `` |
|
||||
| `\lbrack` | [ | `bracket.l` | `` |
|
||||
| `\ldots` | … | `dots.l` | `` |
|
||||
| `\le` | ≤ | `lt.eq` | `<=` |
|
||||
| `\leftthreetimes` | ⋋ | `times.three.l` | `` |
|
||||
| `\leq` | ≤ | `lt.eq` | `<=` |
|
||||
| `\leqslant` | ⩽ | `lt.eq.slant` | `` |
|
||||
| `\lhd` | ⊲ | `triangle.l` | `` |
|
||||
| `\ll` | ≪ | `lt.double` | `<<` |
|
||||
| `\ltimes` | ⋉ | `times.l` | `` |
|
||||
| `\measuredangle` | ∡ | `angle.arc` | `` |
|
||||
| `\mid` | ∣ | `divides` | `` |
|
||||
| `\models` | ⊨ | `models` | `` |
|
||||
| `\mp` | ∓ | `minus.plus` | `` |
|
||||
| `\nRightarrow` | ⇏ | `arrow.double.not` | `` |
|
||||
| `\nabla` | ∇ | `nabla` | `` |
|
||||
| `\ncong` | ≆ | `tilde.nequiv` | `` |
|
||||
| `\ne` | = | `eq.not` | `!=` |
|
||||
| `\neg` | ¬ | `not` | `` |
|
||||
| `\neq` | = | `eq.not` | `!=` |
|
||||
| `\nexists` | ∄ | `exists.not` | `` |
|
||||
| `\ngeq` | ≱ | `gt.eq.not` | `` |
|
||||
| `\ni` | ∋ | `in.rev` | `` |
|
||||
| `\nleftarrow` | ↚ | `arrow.l.not` | `` |
|
||||
| `\nleq` | ≰ | `lt.eq.not` | `` |
|
||||
| `\nparallel` | ∦ | `parallel.not` | `` |
|
||||
| `\nmid` | ∤ | `divides.not` | `` |
|
||||
| `\notin` | ∈/ | `in.not` | `` |
|
||||
| `\nrightarrow` | ↛ | `arrow.not` | `` |
|
||||
| `\nsim` | ≁ | `tilde.not` | `` |
|
||||
| `\nsubseteq` | ⊈ | `subset.eq.not` | `` |
|
||||
| `\ntriangleleft` | ⋪ | `lt.tri.not` | `` |
|
||||
| `\ntriangleright` | ⋫ | `gt.tri.not` | `` |
|
||||
| `\odot` | ⊙ | `dot.o` | `` |
|
||||
| `\ominus` | ⊖ | `minus.o` | `` |
|
||||
| `\oplus` | ⊕ | `xor` | `` |
|
||||
| `\otimes` | ⊗ | `times.o` | `` |
|
||||
| `\parallel` | ∥ | `parallel` | `` |
|
||||
| `\partial` | ∂ | `partial` | `` |
|
||||
| `\perp` | ⊥ | `perp` | `` |
|
||||
| `\pm` | ± | `plus.minus` | `` |
|
||||
| `\prec` | ≺ | `prec` | `` |
|
||||
| `\preceq` | ⪯ | `prec.eq` | `` |
|
||||
| `\prime` | ′ | `prime` | `` |
|
||||
| `\prod` | ∏ | `product` | `` |
|
||||
| `\propto` | ∝ | `prop` | `` |
|
||||
| `\rangle` | ⟩ | `chevron.r` | `` |
|
||||
| `\rbrace` | } | `brace.r` | `` |
|
||||
| `\rbrack` | ] | `bracket.r` | `` |
|
||||
| `\rhd` | ⊳ | `triangle` | `` |
|
||||
| `\rightthreetimes` | ⋌ | `times.three.r` | `` |
|
||||
| `\rtimes` | ⋊ | `times.r` | `` |
|
||||
| `\setminus` | ∖ | `without` | `` |
|
||||
| `\sim` | ∼ | `tilde` | `` |
|
||||
| `\simeq` | ≃ | `tilde.eq` | `` |
|
||||
| `\smallsetminus` | ∖ | `without` | `` |
|
||||
| `\spadesuit` | ♠ | `suit.spade` | `` |
|
||||
| `\sqcap` | ⊓ | `inter.sq` | `` |
|
||||
| `\sqcup` | ⊔ | `union.sq` | `` |
|
||||
| `\sqsubseteq` | ⊑ | `subset.eq.sq` | `` |
|
||||
| `\sqsupseteq` | ⊒ | `supset.eq.sq` | `` |
|
||||
| `\star` | ⋆ | `star` | `` |
|
||||
| `\subsetneq` | ⊊ | `subset.neq` | `` |
|
||||
| `\succ` | ≻ | `succ` | `` |
|
||||
| `\succeq` | ⪰ | `succ.eq` | `` |
|
||||
| `\sum` | ∑ | `sum` | `` |
|
||||
| `\supsetneq` | ⊋ | `supset.neq` | `` |
|
||||
| `\times` | × | `times` | `` |
|
||||
| `\top` | ⊤ | `top` | `` |
|
||||
| `\triangle` | △ | `triangle.t` | `` |
|
||||
| `\triangledown` | ▽ | `triangle.b.small` | `` |
|
||||
| `\triangleleft` | ◃ | `triangle.l.small` | `` |
|
||||
| `\triangleright` | ▹ | `triangle.r.small` | `` |
|
||||
| `\twoheadrightarrow` | ↠ | `arrow.r.twohead` | `->>` |
|
||||
| `\upharpoonright` | ↾ | `harpoon.tr` | `` |
|
||||
| `\uplus` | ⊎ | `union.plus` | `` |
|
||||
| `\vdash` | ⊢ | `tack.r` | `` |
|
||||
| `\vdots` | ⋮ | `dots.v` | `` |
|
||||
| `\vee` | ∨ | `or` | `` |
|
||||
| `\wedge` | ∧ | `and` | `` |
|
||||
| `\wr` | ≀ | `wreath` | |
|
||||
|
||||
|
||||
|
||||
# Implementing LaTeX macros unsupported by Typst
|
||||
|
||||
## Background
|
||||
|
||||
There is not always a Typst equivalent for every LaTeX macro. This document provides a guide on how to implement unsupported LaTeX macros in Typst.
|
||||
|
||||
## The `\mathscr` macro
|
||||
|
||||
`scr` is natively supported in Typst since version 0.14.0! [[1\]](https://qwinsi.github.io/tex2typst-webapp/impl-in-typst.html#fn1)
|
||||
|
||||
## The `\LaTeX` and `\TeX` macro
|
||||
|
||||
LaTeX: `\LaTeX` and `\TeX`
|
||||
|
||||
Implementation in Typst [[2\]](https://qwinsi.github.io/tex2typst-webapp/impl-in-typst.html#fn2)
|
||||
|
||||
```
|
||||
#let TeX = context {
|
||||
set text(font: "New Computer Modern")
|
||||
let e = measure("E")
|
||||
let T = "T"
|
||||
let E = text(1em, baseline: e.height * 0.31, "E")
|
||||
let X = "X"
|
||||
box(T + h(-0.15em) + E + h(-0.125em) + X)
|
||||
}
|
||||
|
||||
#let LaTeX = context {
|
||||
set text(font: "New Computer Modern")
|
||||
let a-size = 0.66em
|
||||
let l = measure("L")
|
||||
let a = measure(text(a-size, "A"))
|
||||
let L = "L"
|
||||
let A = box(scale(x: 105%, text(a-size, baseline: a.height - l.height, "A")))
|
||||
box(L + h(-a.width * 0.67) + A + h(-a.width * 0.25) + TeX)
|
||||
}
|
||||
```
|
||||
|
||||
Usage example:
|
||||
|
||||
```
|
||||
You can use #LaTeX in text environments.
|
||||
You can use $#LaTeX$ in math environments as well.
|
||||
```
|
||||
|
||||
## Using the `op` function to define custom operators
|
||||
|
||||
For example, if you want to define a custom operator `\myopr`.
|
||||
|
||||
LaTeX: `\newcommand{\myopr}{\operatorname{myopr}}`
|
||||
|
||||
Equivalent in Typst:
|
||||
|
||||
```
|
||||
#let myopr = op("myopr");
|
||||
```
|
||||
|
||||
Usage example:
|
||||
|
||||
```
|
||||
$
|
||||
y = myopr x
|
||||
$
|
||||
```
|
||||
|
||||
## A vertical bar for evaluation
|
||||
|
||||
It's common to use a vertical bar to denote the evaluation of a function at a point. e.g.
|
||||
|
||||
|
||||
|
||||
➣ LaTeX:
|
||||
|
||||
```
|
||||
f(x) \bigg\rvert_{x = x_0}
|
||||
```
|
||||
|
||||
Where `\bigg\rvert` may be replaced with `\bigg\vert`, `\bigg|` etc.
|
||||
|
||||
➣ Walkaround in Typst:
|
||||
|
||||
```
|
||||
f(x) lr(| vec(delim: #none, , , x = x_0))
|
||||
```
|
||||
|
||||
Also it's common to use a vertical bar to denote the deference of function values at two points, especially when calculating definite integrals. e.g. [[3\]](https://qwinsi.github.io/tex2typst-webapp/impl-in-typst.html#fn3)
|
||||
|
||||
|
||||
|
||||
➣ LaTeX:
|
||||
|
||||
```
|
||||
F(x) \bigg\rvert_{a}^{b}
|
||||
```
|
||||
|
||||
Where `\bigg\rvert` may be replaced with `\bigg\vert` , `\bigg|` etc.
|
||||
|
||||
➣ Walkaround in Typst:
|
||||
|
||||
```
|
||||
F(x) lr(| vec(delim: #none, b, , a))
|
||||
```
|
||||
|
||||
## The `\cancelto` macro
|
||||
|
||||
`\cancelto{value}{expression}` is a LaTeX command provided by the `cancel` package. It is used to place an arrow through an expression and annotate it with a value to which the expression is be evaluated.
|
||||
|
||||
|
||||
|
||||
➣ LaTeX:
|
||||
|
||||
```
|
||||
\cancelto{0}{\frac{\partial^2 Q}{\partial r^2}}
|
||||
```
|
||||
|
||||
➣ Implementation in Typst (adapted from [[4\]](https://qwinsi.github.io/tex2typst-webapp/impl-in-typst.html#fn4) ):
|
||||
|
||||
```
|
||||
#let cancelto(to, body) = {
|
||||
let max(a, b) = if a > b { a } else { b };
|
||||
context {
|
||||
let m = measure(body)
|
||||
let (w, h) = (m.width, m.height * 2)
|
||||
let arrow = rotate(-55deg, math.stretch(sym.arrow.r, size: max(h*1.8, w*2.0)))
|
||||
set place(center + horizon)
|
||||
body
|
||||
place(dx: -w * 0.5, dy: -h * 0.1, arrow)
|
||||
place(dx: w * 0.3, dy: -h * 1.1, to)
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
➣ Usage example:
|
||||
|
||||
```
|
||||
$
|
||||
cancelto(0, (partial^2 Q)/(partial r^2))
|
||||
$
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
https://qwinsi.github.io/tex2typst-webapp/cheat-sheet.html
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user