Dear list,

I have a mix of a question and a suggestion regarding option handling in Lua-based LaTeX packages.

I contributed to the development of the lyluatex package, whose 1.0 final has recently been uploaded to CTAN (https://ctan.org/pkg/lyluatex and https://github.com/jperon/lyluatex). The package makes extensive use of options (package, global and per-entry options), and the main developer has produced an impressive infrastructure to handle these.

After I copied and adjusted the relevant code to some of my own package I realized we should factor it out so I can access and reuse the functionality from arbitrary packages, so we moved the code to two separate Lua modules.

After the release I suggested going one step further and moving the functionality in a *package* so after a simple \RequirePackage there would be the relevant Lua tables available. When lyluatex is loaded the helper modules are loaded implicitly.

However, now I think that the helper functionality is in no way related to lyluatex and probably generally useful, and so the questions are a) is that true? b) is that publicly available already (oops)? and c) what would be the best way forward to make it as useful as possible?

We have two modules:

 * lyluatex-lib.lua
   (https://github.com/jperon/lyluatex/blob/master/lyluatex-lib.lua)
 * lyluatex-options.lua
   (https://github.com/jperon/lyluatex/blob/master/lyluatex-options.lua)

Probably the stuff in lyluatex-libs.lua is not really unique, and we should rather investigate the lualibs package for existing functionality and probably change the code to use that. However, the option handling might be something that could be made available separately to simplify the creation of Lua-based packages for others as well. A user-oriented short description of the functionality is in this section of the manual: https://github.com/jperon/lyluatex/blob/master/lyluatex.md#option-handling-option-handling. An example of a package making use of the functionality is here: https://github.com/uliska/lyluatexmp/blob/master/lyluatexmp.sty. Note that in line 43 a `lyluatex_options` object is available through the implicit loading through lyluatex. https://github.com/uliska/lyluatexmp/blob/master/lyluatexmp.lua then accesses the options' current values through the xmp_opts table defined starting at https://github.com/uliska/lyluatexmp/blob/master/lyluatexmp.sty#L44

To reiterate the question: Is this approach to handling options something that already exists (so we shouldn't have bothered with the implementation in the first place)? If not am I right with the assumption that it would be a good idea to make it available as a generic package, say `luaoptions`?

Thanks for any suggestions
Urs


Reply via email to