5

This question is about organising files in a package for CTAN.

How can I load lua and tex helper files in the documentclass so that they are found when the package is installed in the TeXLive folders?

I would like to upload this package to CTAN: wallcalendar

Some of its functionality depends on running helper Lua functions which are collected in a helper script and used this way:

\luadirect{
require("./scripts/wallcalendar-helpers.lua")
monthEvents(
  \luastring{\@t@monthName},
  \@t@filterPred,
  \@t@formatFunc,
  \luastringO{\@t@formatCmd},
  \luastring{\@t@eventsCsv},
  \luastring{\@t@markDefaultsCsv},
  \@t@minEvents
)}}

And there are helper tex files which define names of things for a given language, such as i18n/hungarian.tex

Used this way:

% Load internal translations
\InputIfFileExists{i18n/\@wall@calendarLanguage.tex}{}%
{\ClassError{wallcalendar}{File Not Found: i18n/\@wall@calendarLanguage.tex}{}}

These methods only work when the files are copied in the project folder (where the user's document such as mycalendar.tex is).

David Carlisle
  • 757,742
Gambhiro
  • 3,384

1 Answers1

3

The simplest is to arrange that wallpaper.lua is in the same directory as the package file (actually anywhere in tex's input path but alongside the package is simplest for distributing and then)

\directlua{require('wallpaper')}

any recent version of luatex will default the .lua extension and find the file via the usual tex input path search.

similarly

\InputIfFileExists{i18n/\@wall@calendarLanguage.tex}

should work as long as the i18n directory is in the standard places searched by kpathsea (although a simpler alternative would be to use

\InputIfFileExist{\@wall@calendarLanguage}

and put all the language files in the same directory as your class file in the installed version.

David Carlisle
  • 757,742