olsak / OpTeX

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

Try to improve wording of OpTeX trick 99 #103

Closed vlasakm closed 1 year ago

vlasakm commented 1 year ago

Try to make Lua function allocation more robust by introducing luatexbase.new_luafunction which is by interface compatible with the function of the same name from LaTeX (see texdoc ltluatex) . Though instead of using a TeX count register to keep the number of allocated Lua functions we use the natural length of the Lua functions table.

Directly returning the length of said table is not nice, since if the user doesn't add anything to the allocated entry, the length stays the same and we could return the same allocation number to some other caller. We can somehow mitigate this by setting the allocated entry to something -- a dummy function.

This can be used to simplify the pstricks OpTeX trick. While at it I tried to improve the wording.

I am unfortunately not anywhere near my current setup, so this pull request is untested. Hopefully I didn't miss anything fundamental and this can be merged after someone confirms that it works.

olsak commented 1 year ago

I don't plan to add a declaration of luatexbase.new_luafunction to the optex lua base code. The OpTeX trick about pstricks is only very specific, I don't recommend to use it. Thank you for improving text of OpTeX trick 0099, I'll use this commit.

vlasakm commented 1 year ago

I rebased the changes and removed the changes with regards to new_luafunction.

olsak commented 1 year ago

I don't plan to add a declaration of luatexbase.new_luafunction to the optex lua base code. The OpTeX trick about pstricks is only very specific, I don't recommend to use it. Thank you for improving text of OpTeX trick 0099, I'll use this commit.

olsak commented 1 year ago

done in another commit