olsak / OpTeX

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

Don't unconditionally `\openref` in `\refdecl`? #75

Closed vlasakm closed 2 years ago

vlasakm commented 2 years ago

Currently \refdecl just opens the ref file and writes to it immediatly. This seems against OpTeX principle of not creating .ref files if they are not needed.

@olsak Do you think that \refdecl could check if the .ref file is open, and either would write to it immediatly, or buffer its argument until first \openref is run?

In pdfextra I am thinking about either working around this by not using \openref but some kind of \.refinit which would \openref as well as \refdecl. But then \refdecl is nested under another macro, and needs doubling of #.

olsak commented 2 years ago

I implemented this idea. Thanks.