You can put the place()
function in the page.background
to get absolute positioning on the page. This is documented in the summary of the function place()
here.
Moving the black rectangle to the left or right side of the page is then only a matter of grabbing the page number to check whether it is even or odd. You already did this in your code but I couldn’t see if this works since you only have one page in your example.
If you use the following set rule inside your function fullindex()
you should get the correct placement of the black rectangle:
#set page(
paper: "a6",
margin: (inside: 20pt, outside: 30pt),
background: context {
let (page, ..) = counter(page).get()
place(if calc.even(page) { right } else { left }, rect(width: 1em, fill: black, height: 100%))
}
)
I also created a minimal example project to showcase the set rule here.
And a general note regarding your example project. Since you already included a warning about the size of the project, this could have been a hint for you to create a minimal example project that only reproduces your issue instead.