0

In a macro I would like to detect if it is the first item put right after a pagebreak/columnbreak on the top of the next page/column. In that case it would like it to behave differently (e.g. change color) than in any other place on the page. How do I do that?

4
  • 1
    essentially you can not do that with a macro. Macros are expanded while the source is being read, the text for a paragraph is then typeset on one long horizontal line that is then split into multiple lines for a paragraph, those lines are placed on one long vertical list then from time to time as enough material is collected, the page breaker cuts off a page from the vertical lists, adds floating figures and the page head and foot and ships out a page. the macros are long forgotten by then. Jun 25 '20 at 8:35
  • Can I somehow exploit what e.g. vspace does when behaving differently on top of a page?
    – TeXter
    Jun 25 '20 at 8:41
  • 1
    no vspace always acts the same way and always adds a glue node to the vertical list, tex's underlying page breaker (which can not be adjusted from tex code you would need to change the tex program itself) discards certain types of nodes, including glue, when cutting a page off the vertical list. You can do a two pass system, looking at (for example` \pdfsavepos and then comparing the value of \pdflastypos saved in teh aux file to see the vertical position of the text on the last run and assume you are at top of a page, and correct on a following run if that is no longer true Jun 25 '20 at 8:56
  • You COULD write the "current" position to the aux file using \pdfsavepos and \pdflastypos. See tex.stackexchange.com/questions/244853/… for example. Jun 25 '20 at 12:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.