olsak / OpTeX

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

Compatibility with PGF/TikZ #61

Closed vlasakm closed 3 years ago

vlasakm commented 3 years ago

With #60 we are getting more compatible with PGF/TikZ. Although we will no longer clash with the use of \pdfpageresources primitive token register, by either using PGF's mechanism when detected, we don't let PGF write the page resources.

This is because PGF delegates the PDF object writing to \pgfutil@everybye and that is never executed in OpTeX (it hooks into \end and we do \_end).

This can be mitigated manually by e.g. loading PGF/TikZ like this:

\load[tikz]
\_addto\_byehook{\_the\_cs{pgfutil@everybye}}

In my opinion this should be hanled by OpTeX. What about having something like tikz.opm that would load the real tikz and also do this? Maybe we could later include other compatibility code there (e.g. for https://github.com/pgf-tikz/pgf/issues/983?). This of course bring the problem of syncing with (possible) PGF internals updates.

olsak commented 3 years ago

Using tikz.opm is good idea. If a user does \input tikz then somewhat will not work well, but \load[tikz] is in our competence and we can do corrections (e.g. for pgf-tikz/pgf#983). And we add a message about it to documentation.

vlasakm commented 3 years ago

@olsak Should I try to also make PGF use the .ref file instead of a .pgf auxiliary file?

(Not sure if it is feasible, but I would like to know if this is even desirable).

olsak commented 3 years ago

@olsak Should I try to also make PGF use the .ref file instead of a .pgf auxiliary file?

(Not sure if it is feasible, but I would like to know if this is even desirable).

No. I think that better is the TikZ behavior like in plain TeX.

vlasakm commented 3 years ago

Both ideas presented here are implemented in #63.

But in the future it may be a better idea create more thorough pgfutil-optex.def and pgfsys-optex.def files. This would hopefully provide better/cleaner integration in areas such as color, auxiliary file writing, font selelction, "shipout hacking", and logging.

Notably PGF uses the atbegshi package to hook into output box processing. The injections that it does are only usefull with (x)dvipdfm(x) as far as I can tell. But atbegshi requires more packages (iftex, infwarerr, ltxcmd), which troubles me more.

vlasakm commented 3 years ago

Closing (at least for now).