Show borders around the main text area, header and footer in Typst documents.
This may be useful to understand and debug layout issues.
The idea is similar to the LaTeX showframe
package.
#import "@preview/showframe:v0.1.0": background
#set page(paper: "a6")
#set page(background: background())
#lorem(100)
#pagebreak()
#set page(background: background(stroke: blue + 1pt))
#lorem(100)
The following limitations are known, PRs to address them are always welcome!:
- If
page.margin
contains theinside
oroutside
keys, andpage.binding
is set toauto
, the package will currently assume an LTR document with binding on the left side. It would be correct to follow Typst and determine the binding according to the text direction.
The following are some ideas of functionality that might be added or improved in this package:
- Further separate measuring and rendering steps in the implementation.
This would allow to make the rendering more customizable
e.g. like the cross markers in this related
tex.SE
question, or by not having contiguous lines but just rectangles around the main and margin text areas.
The following Typst issues and forum post inspired this package and informed its design and implementation:
- the
layout
package shows the page dimensions - the
showframe
package - the
geometry
package used as\usepackge[showframe,pass]{geometry}
- a related
tex.SE
question