I’d like to create a Typst function for typesetting a scene break/thematic break/transition (not sure what the best term is) as in most printed novels[1], i.e.:
- By default, the break is displayed as a blank line between paragraphs
- …unless that line is the first or last line on the page (or in the column, for multicolumn environments, I suppose), in which case the line contains some decorative element (usually three spaced asterisks).
- Either way, the paragraph immediately after the break is not indented.
I know how to define a function for producing a decorative line with no indentation afterwards, but I’m unsure how to determine whether that line will be placed at the first or last line of the page and “blanking” it if it isn’t. The closest thing I can find to a “current line on page” function is here().position(), which returns a dictionary containing the current y-coordinate. If I then had the current line height (not sure how to get that) and the current page’s top & bottom margins (I assume they’re stored in page().margin, but I can’t figure out how to query them at the moment), I assume I could make this work. Am I on the right track? Is there a better way?
Note that the following description assumes the use of “book paragraphs” where every paragraph is typically indented and there is typically no gap between consecutive paragraphs. “Web paragraphs” (where paragraphs are not indented and there is a blank line between every pair of consecutive paragraphs) are out of scope for this. ↩︎