I'd like to determine approximately how far down the page TeX's paragraph builder (i.e., tex.linebreak(...) in LuaTex) is when it starts. For example, in \begin{document}A\par B\end{document} when the tex.linebreak is about to start I assume it is one baselineskip down the page.
The reason I ask for an approximate answer is because I believe it's not really possible to determine the answer exactly. The obstacles include (I think) the fact that the vertical list destined to become a page may be stretchable and hence until the page is set the the vertical position is not known. And of course, the page is set after line-breaking happens.
However, a reasonable approximation (I think) would be to compute the natural vsize of all the matter on the vertical list when linebreak is called. A very simple approach is to simply count how many lines have been created so far (see the amazing answer https://tex.stackexchange.com/a/403353/1078). But this won't deal with things like section headings and display math. What struck me as a better approximation was to track the vertical size of everything that gets added to the main vertical list.
What I have tried is writing my own linebreak_filter that calls tex.linebreak and intercepts its return. Unfortunately the retuned list of nodes is quite complicated. Furthermore, I seem to be missing things like displayed mathematics. So I wonder whether I am on the right track (or reinventing the wheel).
linebreak_filterwhere I am, then I can passtex.linebreaka suitable parshape table. Perhaps this is hopeless (or the domain offlowfram)? – banbh Jan 17 '22 at 22:44