5

I am trying to create a glue node that I can assign to the internal parameter tex.parfillskip.

In Plain TeX, the glue for \parfillskip is assigned as \parfillskip=0pt plus 1fil. Dumping the values in Lua(TeX):

print("width: " .. tex.parfillskip.width)
print("stretch: " .. tex.parfillskip.stretch)
print("shrink: " .. tex.parfillskip.shrink)
print("stretch_order: " .. tex.parfillskip.stretch_order)
print("shrink_order: " .. tex.parfillskip.shrink_order)

leads to this output:

width: 0
stretch: 65536
shrink: 0
stretch_order: 2
shrink_order: 0

So my questions are:

  • How does one convert a value 1fil to the stretch component of the glue spec. Is it just as simple as multiplying by 65536 (as it seems from the dump)?
  • How does one determine the value stretch_order? It seems a bit arbitrary. The value above is 2, but the stretch_order value for tex.topskip is 0. How does one determine what to put in that component for the glue spec.

1 Answers1

3

LuaTeX introduced an additional degree of infinite glue: you can have fi, fil, fill and filll. So settings like

\parfillskip=0pt plus 1pt
\parfillskip=0pt plus 1fi
\parfillskip=0pt plus 1fil
\parfillskip=0pt plus 1fill
\parfillskip=0pt plus 1filll

will have stretch orders 0, 1, 2, 3, 4 respectively.

Indeed

{\directlua{tex.setglue("parfillskip",65536,65536,65536,1,1)}\showthe\parfillskip}

will stop with

> 1.0pt plus 1.0fi minus 1.0fi.

The units are in scaled points, so to get 1<unit> you need 65536 whatever <unit> you choose among the ones above.

egreg
  • 1,121,712