I’m trying to define a function to inset a paragraph by exactly half a page (ignoring the margin), i.e. the left margin of the paragraph should be at (page.width - page.margin.left - page.margin.right)/2
, but this function doesn’t seem to be straightforward to define.
I tried
#let right(body) = block(inset:(left:50%), body)
but the behavior is very weird and it doesn’t do what I intended
#set par(justify: true)
Left.
#let right(body) = block(inset:(left:50%), stroke:1pt+black, body)
#right[
Right.
]
#let right(body) = block(inset:(left:60%), stroke:1pt+black, body)
#right[
Right.
]
#let right(body) = block(inset:(left:70%), stroke:1pt+black, body)
#right[
Right.
]
#let right(body) = block(inset:(left:80%), stroke:1pt+black, body)
#right[
Right.
]
#let right(body) = block(inset:(left:90%), stroke:1pt+black, body)
#right[
Right.
]
#let right(body) = block(inset:(left:100%), stroke:1pt+black, body)
#right[
Right.
]
#let right(body) = block(inset:(left:50%), stroke:1pt+black, body)
#right[
Right. #lorem(50)
]
#let right(body) = block(inset:(left:60%), stroke:1pt+black, body)
#right[
Right. #lorem(20)
]
#let right(body) = block(inset:(left:70%), stroke:1pt+black, body)
#right[
Right. #lorem(20)
]
#let right(body) = block(inset:(left:80%), stroke:1pt+black, body)
#right[
Right. #lorem(20)
]
#let right(body) = block(inset:(left:90%), stroke:1pt+black, body)
#right[
Right. #lorem(20)
]
#let right(body) = block(inset:(left:100%), stroke:1pt+black, body)
#right[
Right. #lorem(20)
]
I want to set the inset amount to (page.width - page.margin.left - page.margin.right)/2
but page.margin
is unreliable because it can be auto
instead of a value, and I’m not familiar with the context
syntax. I’m kind of stuck not knowing how to proceed.
Any help would be appreciated.