I've been putting off implementation of flexible vertical whitespace in the mom macros for a long time because my intuition told me that, for something so conceptually simple, the details were going to be a nightmare. Well, I got them all worked out for non-columnar docs, then ran into a hitch. I'm using the .h register to determine the space between the last printed text line and the footer trap, and it works perfectly for non-columnar docs. However, when setting two-column text, if the first column is longer than the second, the .h of the first column "sticks" because .h isn't writable.
Conceptually, can anyone think of another way to get the position that would be reported by .h without actually using .h? The nl register looks like the obvious choice, but nl counts empty lines, making it unusable. So far, my attempts to get around that have failed. FWIW, the strategy I'm using is to collect strings on a first pass that contain the amount of whitespace before the footer trap divided by the number of flexes (flexible vertical whitespaces) on the page. The flex-space is applied during a second pass. At the top of the FOOTER macro, before anything else, I have .de FOOTER .nr flex:target-pos \\n[.p]+\\n[#VARIABLE_FOOTER_POS]-1 .nr flex:current-pos \\n[.h]-\\n[.v] .nr flex:diff \\n[flex:target-pos]-\\n[flex:current-pos] .if (\\n[flex:diff]%2)=1 .nr flex:diff -1 .if \\n[flex-spaces] \{\ . nr flex-space:\\n[flex]@\\n[#COL_NUM] \\n[flex:diff]/\\n[flex-spaces] . if dPDF.EXPORT \ . tm .ds flex-space:\\n[flex]@\\n[#COL_NUM] \\n[flex-space:\\n[flex]@\\n[#COL_NUM]]u .\} .\" Remainder of footer .. #VARIABLE_FOOTER_POS is always negative (the bottom margin that moves up the page if there are footnotes). "-1" is because the footer trap is always 1 unit lower than visual bottom margin. "flex-spaces" is the number of times a flex directive has been inserted into the text of the current page. "dPDF.EXPORT" because I'm piggybacking on Deri's pdfmom, which uses PDF.EXPORT during the first pass to collect strings for forward references. -- Peter Schaffter http://www.schaffter.ca