olsak / OpTeX

OpTeX - LuaTeX format with extended Plain TeX macros
http://petr.olsak.net/optex/
35 stars 13 forks source link

Execute \byehook only after all pages are shipped #96

Closed vlasakm closed 2 years ago

vlasakm commented 2 years ago

\_byehook does amongst other things:

\_immediate\_closeout\_reffile
\_edef\_tmp{\_mdfive{\_jobname.ref}}%

Thus it makes sense to \_byehook only after all pages have been written, since they may contain \write whatsits from \wref.

\endslides (\_def\_endslides{\_byehook \_end}) is thus wrong, since it doesn't ensure all pages are shipped before \byehook.

Excerpt of log file that demonstrates the issue (write is to command line, since the ref file is closed), I added CLOSE REF message to where \_byehook closes \_reffile:

[1] (/home/michal/src/optex/optex/base/slides.opm) [2.1] [2.2] [2.3] [2.4] [2.5] [2.6]
CLOSE REF
\_Xpage{8}{3}
[3.6])

The test file: https://github.com/vlasakm/optex-minim/blob/master/examples/optex-minim-pgf-test.tex (although it should be reproducible more easily).

olsak commented 2 years ago

I have not a special development branch of tikz.opm and optex.lua codes in order to run your example without errors. I am unable to test this without more effort, but you can try this: replace the line 111 of slides.opm by

\_def\_endslides{\_vfill \_supereject \_byehook \_end}

If this solves the problem I am ready to commit such correction.

vlasakm commented 2 years ago

I just fixed a bug (in my local copy of luaotfload) that removed a page from that test file, so I can no longer reproduce the issue easily :(.

I think that this \bye equivalent definition ought to work, but I was worried that it may not be appropriate for slides, but I unfortunately don't know much about how slides are handled.

olsak commented 2 years ago

IMHO, the \vfill \supereject should be here, the macro is more robust especially when \slideshow is not activated.

olsak commented 2 years ago

I added \vfill \supereject to slides.