Skip to content

Commit

Permalink
Merge pull request #6 from shunichironomura/improve-section-reference
Browse files Browse the repository at this point in the history
Improve section reference show rule
  • Loading branch information
shunichironomura authored Sep 17, 2024
2 parents 1328c89 + 6249492 commit 4a63fd2
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
Binary file modified example.pdf
Binary file not shown.
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 4a63fd2

Please sign in to comment.