Skip to content

Commit

Permalink
Improve section reference show rule
Browse files Browse the repository at this point in the history
  • Loading branch information
shunichironomura committed Sep 17, 2024
1 parent 1328c89 commit 58610a5
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions template.typ
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,31 @@
v(-0.8 * measure(2 * a).width)
}

// Section reference settings
show ref: it => {
let el = it.element
if el != none and el.func() == heading {
context {
let heading_counts = counter(heading).at(it.element.location())
if el.depth == 1 {
//
[第#heading_counts.at(0)章]
// counts
} else if el.depth == 2 {
//
[第#heading_counts.at(0).#heading_counts.at(1)節]
} else if el.depth == 3 {
//
[第#heading_counts.at(0).#heading_counts.at(1).#heading_counts.at(2)項]
} else {
it
}
}
} else {
it
}
}

// Paragraph settings
show par: set block(spacing: 0.65em)

Expand Down

0 comments on commit 58610a5

Please sign in to comment.