<div dir="ltr">Hi Urs,<br><br>I am also working on a package that has several Lua files and that I<br>want to submit to CTAN at some point - in some months, I think...<br><br>I have a suggestion: add compilation - i.e., lualatex-ing -<br>instructions that let people test your package quickly. I did that<br>here<br><br> <a href="http://angg.twu.net/dednat6.html#quick-start">http://angg.twu.net/dednat6.html#quick-start</a><br> <a href="http://angg.twu.net/dednat6/demo-minimal.tex.html">http://angg.twu.net/dednat6/demo-minimal.tex.html</a><br> <a href="http://angg.twu.net/dednat6/demo-minimal.tex">http://angg.twu.net/dednat6/demo-minimal.tex</a><br><br>and my number of users exploded! It went from 1 to 5 if I take "users"<br>in a strict sense.<br><br> Cheers,<br> Eduardo Ochs =)<br> <a href="http://angg.twu.net/dednat6.html">http://angg.twu.net/dednat6.html</a><br> <a href="http://angg.twu.net/math-b.html">http://angg.twu.net/math-b.html</a><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, 19 Jul 2019 at 06:13, Urs Liska <<a href="mailto:lists@openlilylib.org">lists@openlilylib.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">18. Juli 2019 23:50, "Karl Berry" <<a href="mailto:karl@freefriends.org" target="_blank">karl@freefriends.org</a>> schrieb:<br>
<br>
> Hi Urs - yes, it is no problem to keep the doc .lua files in the doc<br>
> tree.<br>
> <br>
>> how would I indicate this? <br>
> <br>
> The best place to describe intended installation layout is in the README<br>
> file, although assuming the CTAN upload will have (something like)<br>
> doc/luaexamples/*.lua vs. tex/subfolder/*.lua, it will be evident to me<br>
> what to do.<br>
<br>
For clarity I'll state that the package is called `luatemplates`.<br>
<br>
The structure relevant to the documentation is<br>
<br>
<root><br>
|- luatemplates.sty<br>
|- luatemplates.lua<br>
|- documentation<br>
|- luatemplates.tex (the manual)<br>
|- luatemplates-manual-templates.lua (required as Lua module by the manual)<br>
|- examples<br>
|- examples-type-one.lua (just listed in the manual)<br>
|- examples-type-two.lua (listed *and required* in/from the manual)<br>
|- example*.tex (example files to look at, each having a corresponding .lua file)<br>
|- ..<br>
<br>
> <br>
> Also, what would be the appropriate link<br>
> to point to in the manual (you'll find the example files in ...)?<br>
> <br>
> It depends on the appropriate subdirectory of doc, e.g.,<br>
> texmf-dist/doc/latex/yourpkgname/luaexamples, but "latex" might be<br>
> "generic" or "support" or whatever. It depends on what your package does :).<br>
> I usually use something corresponding to the main CTAN subtree location.<br>
> (Suggesting something is fine.)<br>
<br>
The package is a generic tool for simplifying the development of Lua-based packages, allowing "formatter" templates or functions to be defined in Lua and all the macro and argument handling be done automatically. [1]<br>
<br>
> <br>
> Another thing that can be useful to mention is running "texdoc -l<br>
> yourpkgname", which should show all the relevant files (and maybe some<br>
> irrelevant ones), including the examples.<br>
> <br>
<br>
I didn't know that, sorry. This seems like a good suggestion to give readers an easy way of finding the examples.<br>
<br>
> On another front:<br>
> <br>
>> require(subfolder.module-name) from the main .lua file. <br>
> <br>
> Does that actually work? <br>
<br>
I don't really know, that's why I brought it up in this email. It works in my development repository but I know I can't assume the same when put into another context. Probably it works here because everything is found through relative paths.<br>
<br>
> Does your script do something to put subfolder<br>
> in the Lua input path, or similar(*)? If not, or even if so, I strongly<br>
> recommend making the file basenames be unique, like<br>
> yourpkg-module-name.lua.<br>
<br>
As said, maybe it just works thanks to the relative paths. Another view on the directory structure quoted above is<br>
<br>
<root><br>
|- luatemplates.lua<br>
|- luatemplates<br>
|- builtins.lua<br>
|- formatter.lua<br>
|- ...<br>
<br>
So from within luatemplates.lua I can successfully write<br>
<br>
require('luatemplates.builtins')<br>
<br>
This does not seem to be related to the current working directory because it also works when compiling the manual from the "documentation" subdirectory.<br>
<br>
Your comment made me think of whether this worked because the files are relative to the caller or because they are within the search path. Since changing "require('builtins')" also works I assume it's the latter. In that case I'll rename the files to make them unique so no other users accidentally load them ...<br>
But this should also imply that the files will be found when they are stored in another location not findable through relative paths and independently of the current working directory, right?<br>
<br>
> <br>
> If you have a preference, the runtime .lua files can end up either under<br>
> scripts/ or under tex/. Let me know. --best, karl.<br>
<br>
I don't know much about the TDS, but it seems somewhat natural that they are under scripts/.<br>
<br>
Thank you for the comments, and your work in general!<br>
Best<br>
Urs<br>
<br>
[1]<br>
This is not meant as a request but rather as an invitaion: I would be grateful for any public feedback (and discussiton, and contribution) *before* a CTAN release. The package is located at <a href="https://github.com/uliska/luatemplates" rel="noreferrer" target="_blank">https://github.com/uliska/luatemplates</a>, where also a compiled PDF of the current manual can be downloaded. I must admit, though, that making it work is a little bit tricky because it requires another package (lyluatex) to be run from its Github repository (instead of TeX Live), and even from a specific branch.<br>
<br>
For a glimpse of what it does the following example files may give an idea:<br>
<a href="https://github.com/uliska/luatemplates/blob/master/documentation/examples/luatemplates-mwe.tex" rel="noreferrer" target="_blank">https://github.com/uliska/luatemplates/blob/master/documentation/examples/luatemplates-mwe.tex</a><br>
and <br>
<a href="https://github.com/uliska/luatemplates/blob/master/documentation/examples/luatemplates-mwe-templates.lua" rel="noreferrer" target="_blank">https://github.com/uliska/luatemplates/blob/master/documentation/examples/luatemplates-mwe-templates.lua</a><br>
or<br>
<a href="https://github.com/uliska/luatemplates/blob/master/documentation/examples/validate-options.tex" rel="noreferrer" target="_blank">https://github.com/uliska/luatemplates/blob/master/documentation/examples/validate-options.tex</a><br>
and<br>
<a href="https://github.com/uliska/luatemplates/blob/master/documentation/examples/validate-options.lua" rel="noreferrer" target="_blank">https://github.com/uliska/luatemplates/blob/master/documentation/examples/validate-options.lua</a><br>
> <br>
> (*) It is possible to use kpsewhich --subdir=yourpkg to filter the possible<br>
> extraneous matches, which I implemented years ago for Heiko, but from a<br>
> quick grep, I didn't see anything actually using it ...<br>
<br>
</blockquote></div>