Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrating inserts to the main vertical list using lua #155

Open
Udi-Fogiel opened this issue Nov 3, 2023 · 4 comments
Open

Migrating inserts to the main vertical list using lua #155

Udi-Fogiel opened this issue Nov 3, 2023 · 4 comments

Comments

@Udi-Fogiel
Copy link
Contributor

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.

@Udi-Fogiel
Copy link
Contributor Author

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?

@olsak
Copy link
Owner

olsak commented Nov 3, 2023

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.

@Udi-Fogiel
Copy link
Contributor Author

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

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.

@olsak
Copy link
Owner

olsak commented Nov 3, 2023

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants