-
Notifications
You must be signed in to change notification settings - Fork 6
Comparing hydra() return gives unexpected results #35
Copy link
Copy link
Open
Labels
bugSomething isn't workingSomething isn't workingneeds-investigationFurther information is requestedFurther information is requested
Description
I'm experimenting with hydra to show the sections of the current page(s) like so:
Section 2 · Chapter A · 1 — Section 2 · Chapter B · 5
I only want to show the section/chapter part if the content crosses sections/chapters on a given page. Therefore I'm trying to compare if the first use-last: false and last use-last: true elements are the same. Like so:
#context if not (hydra(2, skip-starting: false, use-last: false) == hydra(2, skip-starting: false, use-last: true)) {
text(red, "This page contains content crossing two chapters")
}In my understanding on the first page the first and second level 2 headline should be the same element, while on the fifth page content crosses from Chapter B to Chapter C (minimal example not showing my full nesting level):

Full Code Example
#import "@preview/hydra:0.6.1": hydra
#set page(
width: 120mm,
height: 120mm,
header: context {
if not (hydra(2, skip-starting: false, use-last: false) == hydra(2, skip-starting: false, use-last: true)) {
text(red, "Page contains content crossing two chapters")
}
},
)
= Section 1
== Chapter A
#lorem(200)
= Section 2
#lorem(200)
== Chapter B
#lorem(200)
== Chapter C
#lorem(50)Shouldn't this comparison also be equal on the first page? Or is there a better way to achieve what I'm trying to do?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingneeds-investigationFurther information is requestedFurther information is requested