[NTG-context] context.delayed as parameter of setuphead[before=...]

Hans Hagen j.hagen at xs4all.nl
Wed Nov 4 17:35:02 CET 2020

On 11/4/2020 4:53 PM, Sylvain Hubert wrote:
> % Hans, sorry for having replied on the wrong channel before.
> On Tue, 3 Nov 2020 at 09:03, Hans Hagen <j.hagen at xs4all.nl 
> <mailto:j.hagen at xs4all.nl>> wrote:
>     On 11/3/2020 4:05 AM, Sylvain Hubert wrote:
>      >  > as tables like those in setuphead({somehead}, {somesettings}) are
>      > actual Lua tables and follow Lua, not TeX, rules
>      > But there are lua apis that support delayed TeX like
>      > `context.chapter(context.delayed'text')`.
>      > Whether or not the function is stored in a table should be
>     theoretically
>      > irrelevant.
>      > I guess there should be a switch somewhere that let the command
>      > recognized delayed function.
>     all is possible but not all is reasonable to support .. adding layer
>     upon layed doesn't make it more pretty
> Indeed, but still it would be nice to have a complete and consistent 
> interface between tex and lua unless it would harm the functionality.

it would harm performance because it involves parsing all values and 
also ways around cases where the title is "function" (lieral text).

>     anyway, chapter (section) titles go tinto a toc table and storing lua
>     delayed function definitions there makes not much sense
> It might be helpful in cases like alternative coloring. Writing
>     "function() local x=1; return function() x=1-x; return ({'black', 
> 'gray'})[x] end end"
> can be way much easier for lua speakers than digging up a bunch of 
> documentations to figure out whether it's implemented, or how it can be 
> implemented in a language like TeX, or both which is worse. In such 
> cases, it would also be much natural to write 'before=function()..' than 
> 'before=\ctxlua{function()...}` unless, again, the former harms the 
> functionality.
Really? I have no clue what that function makec clearer than tex. And 
one still needs some documentation that explains what it does.

Often there often is a pretty clean way to do it with less code.


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

More information about the ntg-context mailing list