Skip to content

Commit

Permalink
Add 'delim' to vecrow(..)
Browse files Browse the repository at this point in the history
Fixed #24.
  • Loading branch information
Leedehai committed Mar 7, 2024
1 parent 444cb49 commit 14de0d8
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 4 deletions.
Binary file modified physica-manual.pdf
Binary file not shown.
6 changes: 3 additions & 3 deletions physica-manual.typ
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ All symbols need to be used in *math mode* `$...$`.
#v(1em)

#table(
columns: (5fr, 2fr, 6fr, 5fr),
columns: (5fr, 2fr, auto, 5fr),
align: left,
stroke: none,
[*Symbol*], [*Abbr.*], [*Example*], [*Notes*],
Expand All @@ -163,7 +163,7 @@ All symbols need to be used in *math mode* `$...$`.
[],
[
`vecrow(alpha, b)` \ #sym.arrow $vecrow(alpha, b)$ \
`vecrow(sum_0^n a_i, b)` \ #sym.arrow $vecrow(sum_0^n a_i,b)$ \
`vecrow(sum_0^n i, b, delim:"[")` \ #sym.arrow $vecrow(sum_0^n i,b,delim:"[")$ \
],
[row vector],

Expand Down Expand Up @@ -205,7 +205,7 @@ All symbols need to be used in *math mode* `$...$`.
[`laplacian`],
[],
[`diaer(u) = c^2 laplacian u` \ #sym.arrow $diaer(u) = c^2 laplacian u$],
[Laplacian, different from #builtin(`laplace`) $laplace$],
[Laplacian,\ not #builtin(`laplace`) $laplace$],

[`dotproduct`],
[`dprod`],
Expand Down
19 changes: 18 additions & 1 deletion physica.typ
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,24 @@

// == Vector notations

#let vecrow(..content) = $lr(( #content.pos().join([,]) ))$
#let vecrow(..sink) = {
let (args, kwargs) = (sink.pos(), sink.named()) // array, dictionary
let delim = kwargs.at("delim", default:"(")
let rdelim = if delim == "(" {
")"
} else if delim == "[" {
"]"
} else if delim == "{" {
"}"
} else if delim == "|" {
"|"
} else if delim == "||" {
"||"
} else { delim }
// not math.mat(), because the look would be off: the content
// appear smaller than the sorrounding delimiter pair.
$lr(#delim #args.join([,]) #rdelim)$
}

// Prefer using super-T-as-transpose() found below.
//
Expand Down

0 comments on commit 14de0d8

Please sign in to comment.