Skip to content

Commit

Permalink
Reland PR #7 manually
Browse files Browse the repository at this point in the history
Credit goes to Ruben (ruben-hude). While doing this, Leedehai fixed
a few issues in the original PR:
(1) out-of-sync manual
(2) subscripts and superscripts remain bold in vectorarrow()
  • Loading branch information
ruben-hude authored and Leedehai committed Sep 11, 2023
1 parent b8fe29e commit 68881ff
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 18 deletions.
Binary file modified physica-manual.pdf
Binary file not shown.
10 changes: 5 additions & 5 deletions physica-manual.typ
Original file line number Diff line number Diff line change
Expand Up @@ -164,16 +164,16 @@ All symbols need to be used in *math mode* `$...$`.
[`vb(a),vb(mu_1)` #sym.arrow $vb(a),vb(mu_1)$],
[vector, bold],

[`vectorarrow(`_content_`)`],
[`va`],
[`va(a),va(mu_1)` #sym.arrow $va(a),va(mu_1)$],
[vector, arrow],

[`vectorunit(`_content_`)`],
[`vu`],
[`vu(a),vu(mu_1)` #sym.arrow $vu(a),vu(mu_1)$],
[unit vector],

[`vectorarrow(`_content_`)`],
[`va`],
[`va(a),va(mu_1)` #sym.arrow $va(a),va(mu_1)$],
[vector, arrow \ #sub[(not bold: see ISO 80000-2:2019)]],

[`gradient`],
[`grad`],
[`grad f` #sym.arrow $grad f$],
Expand Down
34 changes: 21 additions & 13 deletions physica.typ
Original file line number Diff line number Diff line change
Expand Up @@ -155,28 +155,36 @@
#let vectorbold(a) = $bold(italic(#a))$
#let vb = vectorbold

#let __vectoraccent(a, accent) = {
let bold_italic(e) = math.bold(math.italic(e))
#let __vectoraccent(a, accent, be_bold) = {
let maybe_bold(e) = if be_bold {
math.bold(math.italic(e))
} else {
math.italic(e)
}
if type(a) == "content" and a.func() == math.attach {
math.attach(
math.accent(bold_italic(a.base), accent),
t: if a.has("t") { math.bold(a.t) } else { none },
b: if a.has("b") { math.bold(a.b) } else { none },
tl: if a.has("tl") { math.bold(a.tl) } else { none },
bl: if a.has("bl") { math.bold(a.bl) } else { none },
tr: if a.has("tr") { math.bold(a.tr) } else { none },
br: if a.has("br") { math.bold(a.br) } else { none },
math.accent(maybe_bold(a.base), accent),
t: if a.has("t") { maybe_bold(a.t) } else { none },
b: if a.has("b") { maybe_bold(a.b) } else { none },
tl: if a.has("tl") { maybe_bold(a.tl) } else { none },
bl: if a.has("bl") { maybe_bold(a.bl) } else { none },
tr: if a.has("tr") { maybe_bold(a.tr) } else { none },
br: if a.has("br") { maybe_bold(a.br) } else { none },
)
} else {
math.accent(bold_italic(a), accent)
math.accent(maybe_bold(a), accent)
}
}
#let vectorarrow(a) = __vectoraccent(a, math.arrow)
#let va = vectorarrow

#let vectorunit(a) = __vectoraccent(a, math.hat)
#let vectorunit(a) = __vectoraccent(a, math.hat, true)
#let vu = vectorunit

// According to "ISO 80000-2:2019 Quantities and units — Part 2: Mathematics"
// the vector notation should be either bold italic or non-bold italic accented
// by a right arrow
#let vectorarrow(a) = __vectoraccent(a, math.arrow, false)
#let va = vectorarrow

#let gradient = $bold(nabla)$
#let grad = gradient

Expand Down

0 comments on commit 68881ff

Please sign in to comment.