On 8/21/2016 8:12 PM, Br. Samuel Springuel wrote:
As part of the GregorioTeX package, we have a Lua function which
rescales a particular distance register by multiplying it by an
arbitrary factor (the factor can be non-integer, so we cannot do this
math in TeX itself).  Originally we wrote the function as this:

local function scale_space(factor)
  local skip = tex.getskip('gre@skip@temp@four')
  skip.width = skip.width * factor
  -- should skip.stretch and skip.shink also be scaled?
end

However, we found that after updating our testing process to use TL2016
(and thus LuaTeX 0.95 instead of 0.80) the rescaling was no longer
happening.  After some experimentation, we found that the following worked:

local function scale_space(factor)
  local skip = tex.getskip('gre@skip@temp@four')
  skip.width = skip.width * factor
  tex.setskip('gre@skip@temp@four',skip)
  -- should skip.stretch and skip.shink also be scaled?
end

This implies to me that the behavior of the function interface for token
registers changed at some point between these two versions.  In 0.80 a
variable filled with a token register was linked to that register and
changes to the variable were reflected in the token register itself.  In
0.95 the variable is not linked to the register and thus changes to the
variable are not communicated to the register unless and until that is
done so explicitly.  Is my interpretation of the situation correct?  If
so, when did this change occur and what is the best way for me to stay
abreast of these sort of changes.

skips (glue) is kind of special in the sense that it's something indirect (glue specs)

in the current luatex the glue nodes no longer use these specs (so no indirectness) but the registers are still 'specs' so, what you get with tex.getskip is a gluespec (node) that you can then mess with (independently) and you set a skip by passing a gluespec node

(the old model also shared specs with ref counts and such which could be quite tricky and have side effects when messing with these specs)

you can use tex.setglue to set the width (or more values)

Hans


-----------------------------------------------------------------
                                          Hans Hagen | PRAGMA ADE
              Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
       tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-----------------------------------------------------------------

Reply via email to