Skip to content

Commit

Permalink
simplify if-clause
Browse files Browse the repository at this point in the history
  • Loading branch information
JoshuaLampert committed Nov 21, 2024
1 parent eacd6e7 commit 42f784a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions lib.typ
Original file line number Diff line number Diff line change
Expand Up @@ -78,20 +78,21 @@ set math.equation(numbering: equation-numbering-pattern) if equate-settings != n
show ref: it => {
let eq = math.equation
let el = it.element

let is-normal-equation = el != none and el.func() == eq
let with-subnumbers = equate-settings != none and equate-settings.keys().contains("sub-numbering") and equate-settings.sub-numbering
if equate-settings != none and el != none and el.func() == eq {
//Normal equation
let is-sub-equation = el != none and el.func() == figure and el.kind == eq
if equate-settings != none and is-normal-equation {
link(el.location(), numbering(
el.numbering,
..counter(eq).at(el.location())
))
} else if equate-settings != none and not with-subnumbers and el != none and el.func() == figure and el.kind == eq {
// Equate equations
} else if equate-settings != none and not with-subnumbers and is-sub-equation {
link(el.location(), numbering(
el.numbering,
counter(eq).at(el.location()).at(0) - 1
))
} else if equate-settings != none and el != none and el.func() == figure and el.kind == eq {
} else if equate-settings != none and is-sub-equation {
link(el.location(), numbering(
el.numbering,
..el.body.value
Expand Down
Binary file modified template/main.pdf
Binary file not shown.

0 comments on commit 42f784a

Please sign in to comment.