| 1 |
% luaoptions support package. |
| 2 |
% |
| 3 |
% Copyright (C) 2015-2026 the lualatex-tools Project |
| 4 |
% License: MIT |
| 5 |
% This file is part of luaoptions. |
| 6 |
|
| 7 |
\NeedsTeXFormat{LaTeX2e}% |
| 8 |
\ProvidesPackage{luaoptions}[2026/05/20 v0.9] %%LUAOPTIONS_DATE LUAOPTIONS_VERSION |
| 9 |
|
| 10 |
% Dependencies |
| 11 |
\RequirePackage{luatexbase} |
| 12 |
\RequirePackage{luaotfload} |
| 13 |
\RequirePackage{xkeyval} |
| 14 |
|
| 15 |
\directlua{ |
| 16 |
lua_options = require(kpse.find_file("luaoptions.lua") or "luaoptions.lua") |
| 17 |
} |
| 18 |
|
| 19 |
% Set an option in a registered client |
| 20 |
\newcommand{\setluaoption}[3]{% |
| 21 |
\directlua{ |
| 22 |
lua_options.set_option( |
| 23 |
'\luatexluaescapestring{#1}', |
| 24 |
'\luatexluaescapestring{#2}', |
| 25 |
'\luatexluaescapestring{#3}') |
| 26 |
}% |
| 27 |
} |
| 28 |
|
| 29 |
% Use an option and directly write it to LaTeX |
| 30 |
\newcommand{\useluaoption}[2]{% |
| 31 |
\directlua{ |
| 32 |
lua_options.use_option( |
| 33 |
'\luatexluaescapestring{#1}', |
| 34 |
'\luatexluaescapestring{#2}') |
| 35 |
}% |
| 36 |
} |