zauguin / luametalatex

18 stars 2 forks source link

Add additional LuaTeX node functions #5

Closed gucci-on-fleek closed 1 year ago

gucci-on-fleek commented 1 year ago

LuaMetaTeX is missing quite a few node functions compared to LuaTeX. ConTeXt has support code for most of these functions, so I've copied that in here. There are a number of potential approaches here:

  1. Add in all of the functions from the ConTeXt code.
  2. Add in only the 3 functions (node.slide, node.vpack, and node.find_attribute) that my package needs.
  3. Do nothing here and add in the functions to my package directly.

I'm using option 1 in this PR since that will maximize the backwards compatibility, but I can change this PR to use options 2 or 3 if you prefer.

zauguin commented 1 year ago

For licensing reason no ConTeXt code can be used in this repo.

gucci-on-fleek commented 1 year ago

For licensing reason no ConTeXt code can be used in this repo.

Ah, okay. So should I rewrite from scratch the functions that my package uses and open a new PR with just those, or should I just carry those functions in my package itself? You've included a few functions in luametalatex-oldnode.lua for third-party package compatibility, but I'm not sure if you're goal is maximum LuaTeX compatibility or just making the minimum number of changes required to compile average documents. Either option works for me.

(Regarding licensing, I'd think that using the ConTeXt code should be fine since it's all GPLv2. I can see how the "viral" nature there might be a concern, but luaotfload has the exact same issue and that's already built in to the regular LuaLaTeX format)

zauguin commented 1 year ago

So should I rewrite from scratch the functions that my package uses and open a new PR with just those, or should I just carry those functions in my package itself?

If you want to do so feel free to open a PR, but I can also quickly add them. They should just be wrappers around the .direct functions anyway if I'm not mistaken(?)

You've included a few functions in luametalatex-oldnode.lua for third-party package compatibility, but I'm not sure if you're goal is maximum LuaTeX compatibility or just making the minimum number of changes required to compile average documents.

The long term goal is as much compatibility as possible, but the short term approach is to avoid compatibility for compatibilities sake and prioritize actually needed functionality.

Regarding licensing, I'd think that using the ConTeXt code should be fine since it's all GPLv2.

Mostly I personally dislike the GPL for various reasons. That doesn't mean that I would never use GPL code or even that I would never write GPL code, but if I have the choice I prefer to avoid it. LuaMetaLaTeX is in many ways very independent from external code so it reasonably can avoid GPL code, so I stay away from it. (Also a big part of the motivation behind writing it is to create a completely independent LuaMetaTeX format, therefore avoiding ConTeXt code is kind of the point...)

gucci-on-fleek commented 1 year ago

If you want to do so feel free to open a PR, but I can also quickly add them. They should just be wrappers around the .direct functions anyway if I'm not mistaken(?)

Yep, they're just simple wrappers. I've opened a PR since it's pretty quick. See #7.

Mostly I personally dislike the GPL for various reasons. That doesn't mean that I would never use GPL code or even that I would never write GPL code, but if I have the choice I prefer to avoid it.

Ah, fair enough.

Also a big part of the motivation behind writing it is to create a completely independent LuaMetaTeX format, therefore avoiding ConTeXt code is kind of the point...

I had just assumed that most of the code here was copied from ConTeXt already. I was impressed before that you managed to get LaTeX to work, but now I'm really impressed.