Skip to content

Commit e985e38

Browse files
committed
Fix referencing chapter
1 parent edc4778 commit e985e38

File tree

9 files changed

+22
-10
lines changed

9 files changed

+22
-10
lines changed

example/example.typ

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
listOfFigureTitle: "List of Figures",
2020
listOfTableTitle: "List of Tables",
2121
supplementChapter: "Chapter",
22-
supplementPart: "PART",
22+
supplementPart: "Part",
2323
part_style: 0,
2424
copyright: [
2525
Copyright © 2023 Flavio Barisi
@@ -39,9 +39,9 @@
3939
]
4040
)
4141

42-
#part("Part One Title")
42+
#part("Part One Title")
4343

44-
#chapter("Sectioning Examples", image: image("./orange2.jpg"))
44+
#chapter("Sectioning Examples", image: image("./orange2.jpg"), l: "chap1")
4545
#index("Sectioning")
4646

4747
== Section Title
@@ -144,6 +144,10 @@ Lists are useful to present information in a concise and/or ordered way.
144144
== Ligatures
145145
fi fj fl ffl ffi Ty
146146

147+
== Referencing Chapters
148+
#index("Referencing")
149+
This statement references to another chapter @chap1
150+
147151
#part("Part Two Title")
148152

149153
#chapter("Mathematics", image: image("./orange2.jpg"))

tests/sample-book/ref03.png

625 Bytes
Loading

tests/sample-book/ref04.png

9.83 KB
Loading

tests/sample-book/ref09.png

10.5 KB
Loading

tests/sample-book/ref16.png

28.8 KB
Loading

tests/sample-book/ref17.png

-3 Bytes
Loading

tests/sample-book/ref25.png

5.29 KB
Loading

tests/sample-book/test.typ

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
listOfFigureTitle: "List of Figures",
2020
listOfTableTitle: "List of Tables",
2121
supplementChapter: "Chapter",
22-
supplementPart: "PART",
22+
supplementPart: "Part",
2323
part_style: 0,
2424
copyright: [
2525
Copyright © 2023 Flavio Barisi
@@ -39,9 +39,9 @@
3939
]
4040
)
4141

42-
#part("Part One Title")
42+
#part("Part One Title")
4343

44-
#chapter("Sectioning Examples", image: image("./orange2.jpg"))
44+
#chapter("Sectioning Examples", image: image("./orange2.jpg"), l: "chap1")
4545
#index("Sectioning")
4646

4747
== Section Title
@@ -144,6 +144,10 @@ Lists are useful to present information in a concise and/or ordered way.
144144
== Ligatures
145145
fi fj fl ffl ffi Ty
146146

147+
== Referencing Chapters
148+
#index("Referencing")
149+
This statement references to another chapter @chap1
150+
147151
#part("Part Two Title")
148152

149153
#chapter("Mathematics", image: image("./orange2.jpg"))

typst-orange.typ

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,18 +84,22 @@
8484
#move(dx: -4pt, block(text(fill: mainColor, size: 6em, weight: "bold", part_state.display())))
8585
]
8686
]
87-
#align(bottom+right, my-outline-small(title, appendix_state, part_state, part_location,part_change,part_counter, mainColor, textSize1: outlinePart, textSize2: outlineHeading1, textSize3: outlineHeading2, textSize4: outlineHeading3))
87+
#align(bottom+right, my-outline-small(title, appendix_state, part_state, part_location,part_change,part_counter, mainColor, textSize1: outlinePart, textSize2: outlineHeading1, textSize3: outlineHeading2, textSize4: outlineHeading3))
8888
])
8989

9090
]
9191
}
9292

93-
#let chapter(title, image:none) = {
93+
#let chapter(title, image:none, l: none) = {
9494
pagebreak(to: "odd")
9595
heading_image.update(x =>
9696
image
9797
)
98-
heading(level:1, title )
98+
if l != none [
99+
#heading(level: 1, title) #label(l)
100+
] else [
101+
#heading(level: 1, title)
102+
]
99103
part_change.update(x =>
100104
false
101105
)
@@ -172,7 +176,7 @@
172176
bodyfmt: body => [#body #h(1fr) $square$]
173177
).with(numbering: none)
174178

175-
#let project(title: "", subtitle: "", date: "", author: (), logo: none, cover: none, imageIndex:none, body, mainColor: blue,copyright: [], lang: "en", listOfFigureTitle: none, listOfTableTitle: none, supplementChapter: "Chapter", supplementPart: "PART", fontSize: 10pt, part_style: 0) = {
179+
#let project(title: "", subtitle: "", date: "", author: (), logo: none, cover: none, imageIndex:none, body, mainColor: blue,copyright: [], lang: "en", listOfFigureTitle: none, listOfTableTitle: none, supplementChapter: "Chapter", supplementPart: "Part", fontSize: 10pt, part_style: 0) = {
176180
set document(author: author, title: title)
177181
set text(size: fontSize, lang: lang)
178182
set par(leading: 0.5em)

0 commit comments

Comments
 (0)