Open Udi-Fogiel opened 8 months ago
I'm testing to this method to see if footnotes or marks work in tables and it seems that, unrelated to the lua code, \mspan
really hates \fnotes
, or \marks
. Try for example
\frame{\table{|c||l||r|}{ \crl
\mspan3[|c|]{\bf Title\mark{Test}} \crl
\noalign{\kern\hhkern}\crli
first & second & third \crlli
seven & eight & nine\fnote{bbgg} \crli}}
\bye
Why is that?
The mentioned answer perfectly works with \mark
but not with \footnote
. Maybe, it would like to deal with it more. Try to replace \lipsum[1-8]
in the example by \lipsum[1-10]
. You'll get
Overfull \vbox has occurred while \output is active
We can insert this code to an OpTeX trick but it isn't ready to use as default solution.
The mentioned answer perfectly works with
\mark
but not with\footnote
. Maybe, it would like to deal with it more. Try to replace\lipsum[1-8]
in the example by\lipsum[1-10]
. You'll getOverfull \vbox has occurred while \output is active
Oh, I missed that. The foot note inside the multicolumn environment seems to collide with the page number. I'll think about it over the weekend.
We can insert this code to an OpTeX trick but it isn't ready to use as default solution.
It would be great. This way maybe users can test this method and report problems. Maybe it would be worth mentioning that the trick can be limited to marks only, if it still have problems with inserts.
Your example with \mspan...\mark
shows very mysterious behavior, because the text "Title" disappears. We needn't any special Lua code, it disappears always. I explain why.
The \mspan
macro opens an internal one-line, one-column table with table parameters given in [...]
(i.e. |c|
, l
, etc. The \hbox
of the resulting table is scanned by \lastbox
and it is un-hboxed to the current (spanned) table item. If the last \hbox
of the inner table includes \insert
or \mark
, then it is propagated to the next vertical mode and it is placed just after the \hbox
of the inner table. Then the \lastbox
primitive fails (gives empty box): it cannot scan the last box because there is \mark
instead a box.
IMHO it can be called as a feature of \mspan
macro: we don't expect that there is something like \insert
, \mark
or \vadjust
inside the \mspan
parameter.
On the other hand, we can implement more robust \lastbox
pseudo-primitive using Lua code. It can (for example) ignore non-box material ad returns the first box when reading the list of nodes from behind.
I'm wondering if there are any disadvantages in using the method in this answer. If not, or if they are miniature compared to the advantages, maybe OpTeX can add similar function to the page builder callback by default? It could also be easily removed by the user, after all.