-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
allocation of user defined whatsits #187
Comments
What do you suggest to implement exactly? |
Probably something like (I don't think -- Allocator for user_defined whatsit nodes. There is
-- is interface only at the lua end.
local whatsits = {}
function alloc.new_whatsit(name)
whatsits[#whatsits+1] = name
return #whatsits
end I don't see any point for a support from |
@vlasakm any thoughts? |
Sorry, I must have missed this discussion, @Udi-Fogiel thanks for pinging me. Addition of I looked briefly into my older clone of TeX Live, and I didn't find that many uses of the allocator. Personally I thought whatsits are problematic in multiple ways - e.g. interaction with various TeX algorithms which although nominally ignore whatsits, still see them as nodes in the node lists, which can cause some problems. Hence the better approach for e.g. implementing color has been LuaTeX attributes. For other traditional uses of whatsits like PDF literals or images, I agree with the LuaTeX team that a rule is a much better way to represent those. TeX algorithms already know that rule is something abstract, but with a height, width and depth that it has to take into account for calculations, unlike the "dimensionless" whatsits. There is a Just out of interest @Udi-Fogiel what is your use for user defiend whatsits? So here are a few questions: Do we want to implement this just because it is missing, or do we actually have a need for it? I think being futureproof might make sense even if nobody has any use for it, but in this particular case, whatsits sound like the past, not the future :). I like your simple definition with just a Line 155 in 1096bef
define_lua_command is in LaTeX / minim a two step process: allocate a lua function id, define a token to Lua function. My idea was, that because the functions are stored in a table anyways, there is no need for allocator, since the size of the table itself is a generator of "fresh numbers".
I would have to also freshen up on LuaMetaTeX, but I think it also simplified things by removing whatsits, though I don't remember what exactly is the offered alternative (probably the user rules and attributes on nodes), so introducing a whatsit allocator now, may not prove futureproof with regards to LuaMetaTeX (if ever considered by OpTeX). With user whatsit ids, I am not sure what is the better approach to take. I think it would be nice to have it integrate with minim, and that either requires a TeX counter or a special case. (I personally have no problem with either.). |
The LuaTeX engine let you define new custom whatsits and identifying them by setting them an ID. Currently there is no built in way (that I'm aware of) in OpTeX to allocate these IDs so if several macro writers use this feature they can possibly clash by using the same ID. Allocating these IDs can prevent that.
The text was updated successfully, but these errors were encountered: