Skip to content

Commit

Permalink
Touch up differentials; touch up docs
Browse files Browse the repository at this point in the history
  • Loading branch information
Leedehai committed Dec 22, 2023
1 parent f8a8b92 commit f3ae707
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 11 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ See the [manual](https://github.com/Leedehai/typst-physics/blob/master/physica-m

A larger [demo.typ](https://github.com/Leedehai/typst-physics/blob/master/demo.typ):

![demo-larger](https://github.com/Leedehai/typst-physics/assets/18319900/af4fcf6c-5da3-48d1-a7a7-59053f808db5)
![demo-larger](https://github.com/Leedehai/typst-physics/assets/18319900/b7dadf90-b401-4bbb-aff7-7c8840954209)

## Using physica in your Typst document

Expand Down
2 changes: 1 addition & 1 deletion demo.typ
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ A^T, curl vb(E) = - pdv(vb(B), t),
quad
tensor(Lambda,+mu,-nu) = dmat(1,RR),
quad
dd(x,y),
f(x,y) dd(x,y),
quad
dd(vb(x),y,[3]),
quad
Expand Down
Binary file modified physica-manual.pdf
Binary file not shown.
14 changes: 9 additions & 5 deletions physica-manual.typ
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ All symbols need to be used in *math mode* `$...$`.
[`TT`],
[],
[`v^TT, A^TT` #sym.arrow $v^TT, A^TT$],
[transpose, also see\ @matrix-tranpose],
[transpose, also see\ @matrix-transpose],

[`vectorbold(`_content_`)`],
[`vb`],
Expand Down Expand Up @@ -234,7 +234,7 @@ All symbols need to be used in *math mode* `$...$`.
[`TT`],
[],
[`v^TT, A^TT` #sym.arrow $v^TT, A^TT$],
[transpose, also see\ @matrix-tranpose],
[transpose, also see\ @matrix-transpose],

[#builtin([`mat(`...`)`])],
[],
Expand Down Expand Up @@ -592,6 +592,10 @@ Functions: `differential(`\*_args_, \*\*_kwargs_`)`, abbreviated as `dd(`...`)`.
- `d`: the differential symbol [default: `upright(d)`].
- `p`: the product symbol connecting the components [default: `none`].

TeXBook said _[f]ormulas involving calculus look best when an extra thin space
appears before dx or dy or d whatever_ (Chapter 18 p.168), and this package
heeds this advice.

*Order assignment algorithm:*
- If there is no order number or order array, all variables has order 1.
- If there is an order number (not an array), then this order number is assigned to _every_ variable, e.g. `dd(x,y,2)` assigns $x <- 2, y <- 2$.
Expand All @@ -607,8 +611,8 @@ Functions: `differential(`\*_args_, \*\*_kwargs_`)`, abbreviated as `dd(`...`)`.
column-gutter: 2em,

[
*(1)* #hl(`dd(f), dd(x,y)`) \
$ dd(f), dd(x,y) $
*(1)* #hl(`dd(f), f(rho,theta) dd(rho,theta)`) \
$ dd(f), f(rho,theta) dd(rho,theta) $
],
[
*(2)* #hl(`dd(x,3), dd(f,[k]), dd(f,[k],d:delta)`) \
Expand Down Expand Up @@ -785,7 +789,7 @@ In the default font, the Typst built-in symbol `planck.reduce` $planck.reduce$ l
[$ i hbar pdv(,t) psi = -frac(hbar^2, 2m) laplacian psi $],
)

=== Matrix transpose with superscript T <matrix-tranpose>
=== Matrix transpose with superscript T <matrix-transpose>

#v(1em)

Expand Down
6 changes: 5 additions & 1 deletion physica.typ
Original file line number Diff line number Diff line change
Expand Up @@ -482,7 +482,11 @@
arr.push($dsym#var$)
}
}
$#arr.join(prod)$
// Wrap in op(...) to give it smart spacing, just like Typst's built-in "dif"
// symbol. For example, there should be a space in the middle of "f(x) dx".
// See TeXBook Chapter 18 p.168 "Formulas involving calculus look best when
// an extra thin space appears before dx or dy or d whatever".
$#arr.map(ee => $op(ee)$).join(prod)$
}
#let dd = differential

Expand Down
7 changes: 4 additions & 3 deletions typst.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@ keywords = [
"physics", "mathematics", "brace", "set", "product", "evaluate", "restrict",
"integral", "gradient", "divergence", "curl", "vector", "field", "laplacian",
"matrix", "determinant", "diagonal", "identity", "Jacobian", "Hessian",
"Dirac", "braket", "differential", "derivative", "partial", "dv", "odv",
"pdv", "Planck", "hbar", "tensor", "isotope", "signal", "electromagnetism",
"mechanics", "quantum", "relativity", "imaginary", "notation",
"transpose", "Dirac", "braket", "differential", "derivative", "partial",
"dv", "odv", "pdv", "Planck", "hbar", "tensor", "isotope", "signal",
"electromagnetism", "mechanics", "quantum", "relativity", "imaginary",
"notation",
]
compiler = "0.10.0"
exclude = ["*.pdf", "*.py"]
Expand Down

0 comments on commit f3ae707

Please sign in to comment.