Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
flavio20002 committed Aug 19, 2024
1 parent fc7d715 commit be29472
Show file tree
Hide file tree
Showing 7 changed files with 149 additions and 149 deletions.
14 changes: 7 additions & 7 deletions example/example.typ
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@
subtitle: "A Practical Guide",
date: "Anno scolastico 2023-2024",
author: "Goro Akechi",
mainColor: rgb("#F36619"),
main-color: rgb("#F36619"),
lang: "en",
cover: image("./background.svg"),
imageIndex: image("./orange1.jpg"),
listOfFigureTitle: "List of Figures",
listOfTableTitle: "List of Tables",
supplementChapter: "Chapter",
supplementPart: "Part",
part_style: 0,
image-index: image("./orange1.jpg"),
list-of-figure-title: "List of Figures",
list-of-table-title: "List of Tables",
supplement-chapter: "Chapter",
supplement-part: "Part",
part-style: 0,
copyright: [
Copyright © 2023 Flavio Barisi

Expand Down
6 changes: 3 additions & 3 deletions my-index.typ
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ figure(
kind: index_string
)))

#let make-index-int(title: none, main_color_state:none) = {
#let make-index-int(title: none, main-color-state:none) = {

let content-text(content) = {
let ct = ""
Expand All @@ -29,7 +29,7 @@ figure(
pagebreak(to: "odd")
set par(first-line-indent: 0em)
locate(loc => {
let mainColor = main_color_state.at(loc)
let main-color = main-color-state.at(loc)
let elements = query(selector(figure.where(kind: index_string)).before(loc), loc)
let words = (:)
for el in elements {
Expand Down Expand Up @@ -69,7 +69,7 @@ figure(
#let firstCharacter = sk.first()
#if firstCharacter != register {
v(1em, weak:true)
box(width: 100%, fill: mainColor.lighten(60%), inset: 5pt, align(center, text(size: 1.1em, weight: "bold", firstCharacter)))
box(width: 100%, fill: main-color.lighten(60%), inset: 5pt, align(center, text(size: 1.1em, weight: "bold", firstCharacter)))
register = firstCharacter
v(1em, weak:true)
}
Expand Down
38 changes: 19 additions & 19 deletions my-outline.typ
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@
]
}

#let my-outline(appendix_state, part_state, part_location,part_change,part_counter, mainColor, textSize1:none, textSize2:none, textSize3:none, textSize4:none) = {
#let my-outline(appendix-state, part-state, part-location,part_change,part-counter, main-color, textSize1:none, textSize2:none, textSize3:none, textSize4:none) = {
show outline.entry: it => {
let appendix_state = appendix_state.at(it.element.location())
let numberingFormat = if appendix_state != none {"A.1"} else {"1.1"}
let appendix-state = appendix-state.at(it.element.location())
let numberingFormat = if appendix-state != none {"A.1"} else {"1.1"}
let counterInt = counter(heading).at(it.element.location())
let number = none
if counterInt.first() >0 {
Expand All @@ -29,25 +29,25 @@
let heading_page = it.page

if it.level == 1 {
let part_state = part_state.at(it.element.location())
let part_location = part_location.at(it.element.location())
let part-state = part-state.at(it.element.location())
let part-location = part-location.at(it.element.location())
let part_change = part_change.at(it.element.location())
let part_counter = part_counter.at(it.element.location())
let part-counter = part-counter.at(it.element.location())
if (part_change){
v(0.7cm, weak: true)
box(width: 1.1cm, fill: mainColor.lighten(80%), inset: 5pt, align(center, text(size: textSize1, weight: "bold", fill: mainColor.lighten(30%), numbering("I",part_counter.first()))))
box(width: 1.1cm, fill: main-color.lighten(80%), inset: 5pt, align(center, text(size: textSize1, weight: "bold", fill: main-color.lighten(30%), numbering("I",part-counter.first()))))
h(0.1cm)
box(width: 100% - 1.2cm, fill: mainColor.lighten(60%), inset: 5pt, align(center, link(part_location,text(size: textSize1, weight: "bold", part_state))))
box(width: 100% - 1.2cm, fill: main-color.lighten(60%), inset: 5pt, align(center, link(part-location,text(size: textSize1, weight: "bold", part-state))))
v(0.45cm, weak: true)
}
else{
v(0.5cm, weak: true)
}
if (counterInt.first() == 1 and appendix_state != none ){
my-outline-row(insetSize: 2pt, textWeight: "bold", textSize: textSize2, textColor:mainColor, number: none, title: appendix_state, heading_page: heading_page, location: it.element.location())
if (counterInt.first() == 1 and appendix-state != none ){
my-outline-row(insetSize: 2pt, textWeight: "bold", textSize: textSize2, textColor:main-color, number: none, title: appendix-state, heading_page: heading_page, location: it.element.location())
v(0.5cm, weak: true)
}
my-outline-row(insetSize: 2pt, textWeight: "bold", textSize: textSize2, textColor:mainColor, number: number, title: title, heading_page: heading_page, location: it.element.location())
my-outline-row(insetSize: 2pt, textWeight: "bold", textSize: textSize2, textColor:main-color, number: number, title: title, heading_page: heading_page, location: it.element.location())
}
else if it.level ==2 {
my-outline-row(insetSize: 2pt, textWeight: "bold", textSize: textSize3, textColor:black, number: number, title: title, heading_page: heading_page, location: it.element.location())
Expand All @@ -59,22 +59,22 @@
outline(depth: 3, indent: false)
}

#let my-outline-small(partTitle, appendix_state, part_state, part_location,part_change,part_counter, mainColor, textSize1:none, textSize2:none, textSize3:none, textSize4:none) = {
#let my-outline-small(partTitle, appendix-state, part-state, part-location,part_change,part-counter, main-color, textSize1:none, textSize2:none, textSize3:none, textSize4:none) = {
show outline.entry: it => {
let appendix_state = appendix_state.at(it.element.location())
let numberingFormat = if appendix_state != none {"A.1"} else {"1.1"}
let appendix-state = appendix-state.at(it.element.location())
let numberingFormat = if appendix-state != none {"A.1"} else {"1.1"}
let counterInt = counter(heading).at(it.element.location())
let number = none
if counterInt.first() >0 {
number = numbering(numberingFormat, ..counterInt)
}
let title = it.element.body
let heading_page = it.page
let part_state = part_state.at(it.element.location())
if (part_state == partTitle and counterInt.first() >0 and appendix_state==none){
let part-state = part-state.at(it.element.location())
if (part-state == partTitle and counterInt.first() >0 and appendix-state==none){
if it.level == 1 {
v(0.5cm, weak: true)
my-outline-row(insetSize: 1pt, textWeight: "bold", textSize: textSize2, textColor:mainColor, number: number, title: title, heading_page: heading_page, location: it.element.location())
my-outline-row(insetSize: 1pt, textWeight: "bold", textSize: textSize2, textColor:main-color, number: number, title: title, heading_page: heading_page, location: it.element.location())
}
else if it.level ==2 {
my-outline-row(textWeight: "regular", textSize: textSize4, textColor:black, number: number, title: text(fill: black, title), heading_page: text(fill: black, heading_page), location: it.element.location())
Expand All @@ -87,7 +87,7 @@
box(width: 9.5cm, outline(depth: 2, indent: false, title: none))
}

#let my-outline-sec(listOfFigureTitle, target, textSize) = {
#let my-outline-sec(list-of-figure-title, target, textSize) = {
show outline.entry.where(level: 1): it => {
let heading_page = it.page
[
Expand All @@ -100,7 +100,7 @@
}
pagebreak(to: "odd")
outline(
title: listOfFigureTitle,
title: list-of-figure-title,
target: target,
)
}
14 changes: 7 additions & 7 deletions tests/long-part-title/test.typ
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#import "../../typst-orange.typ": book, part, chapter, my-bibliography, appendices

#let mainColor = rgb("#F36619")
#let main-color = rgb("#F36619")

#set text(font: "Lato")
#show math.equation: set text(font: "Fira Math")
Expand All @@ -11,14 +11,14 @@
subtitle: "A Practical Guide",
date: "Anno scolastico 2023-2024",
author: "Goro Akechi",
mainColor: mainColor,
main-color: main-color,
lang: "en",
cover: image("./background.png"),
imageIndex: image("./orange1.jpg"),
listOfFigureTitle: "List of Figures",
listOfTableTitle: "List of Tables",
supplementChapter: "Chapter",
part_style: 0,
image-index: image("./orange1.jpg"),
list-of-figure-title: "List of Figures",
list-of-table-title: "List of Tables",
supplement-chapter: "Chapter",
part-style: 0,
copyright: [
Copyright © 2023 Flavio Barisi

Expand Down
12 changes: 6 additions & 6 deletions tests/part-style-1/test.typ
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@
subtitle: "A Practical Guide",
date: "Anno scolastico 2023-2024",
author: "Goro Akechi",
mainColor: rgb("#F36619"),
main-color: rgb("#F36619"),
lang: "en",
listOfFigureTitle: "List of Figures",
listOfTableTitle: "List of Tables",
supplementChapter: "Chapter",
supplementPart: "PART",
part_style: 1,
list-of-figure-title: "List of Figures",
list-of-table-title: "List of Tables",
supplement-chapter: "Chapter",
supplement-part: "PART",
part-style: 1,
copyright: [
Copyright © 2023 Flavio Barisi

Expand Down
14 changes: 7 additions & 7 deletions tests/sample-book/test.typ
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@
subtitle: "A Practical Guide",
date: "Anno scolastico 2023-2024",
author: "Goro Akechi",
mainColor: rgb("#F36619"),
main-color: rgb("#F36619"),
lang: "en",
cover: image("./background.png"),
imageIndex: image("./orange1.jpg"),
listOfFigureTitle: "List of Figures",
listOfTableTitle: "List of Tables",
supplementChapter: "Chapter",
supplementPart: "Part",
part_style: 0,
image-index: image("./orange1.jpg"),
list-of-figure-title: "List of Figures",
list-of-table-title: "List of Tables",
supplement-chapter: "Chapter",
supplement-part: "Part",
part-style: 0,
copyright: [
Copyright © 2023 Flavio Barisi

Expand Down
Loading

0 comments on commit be29472

Please sign in to comment.