[luatex] tex.enableprimitives producing non-primitives?

Heiko Oberdiek oberdiek at uni-freiburg.de
Wed Sep 23 14:16:55 CEST 2009


On Wed, Sep 23, 2009 at 01:52:07PM +0300, Élie Roux wrote:

> 2009/9/23 Heiko Oberdiek <oberdiek at uni-freiburg.de>:
> >
> > Thus your real question is, that you want to know, whether the
> > TeX engine does provide the primitive in question, even if the
> > control sequence is redefined?
> 
> I think there is quite a misunderstanding...
> 
> I reformulate my thought: in the following example:
> 
> \catcode`\{=1
> \catcode`\}=2
> \ifx\directlua\undefined
> \else
>  \directlua{tex.enableprimitives('',{'pdfprimitive'})}
>  \directlua{tex.enableprimitives('',{'attribute'})}
>  \directlua{tex.enableprimitives('testprefix',{'attribute'})}
> \fi
> 
> \testprefixattribute 3 = 4
> 
> \pdfprimitive\attribute 4=5
> 
> \pdfprimitive\testprefixattribute 3 = 4
> 
> \end
> 
> to be compiled with luatex -ini:
> 
> we see that I enable the primitive attribute with no prefix, thus
> \pdfprimitive\attribute works, until here all is ok. But I also enable
> the primitive attribute with the prefix testprefix, so I expect the
> same behaviour: \pdfprimitive\testprefixattribute should be working,

\pdfprimitive does not know about tex.enableprimitives and does
not care for the current meaning of \testprefixattribute.
\pdfprimitive expects the same name as you use in the second
argument of tex.enableprimitives.

> but it's not... So the question is: why? Is it normal that primitives
> enabled with no prefix are considered by \pdfprimitive as primitives,
> and not the ones enabled with no prefix?

A prefix does not matter for \pdfprimitive, because it doesn't
know anything about a prefix.
Example:
\catcode`\{=1
\catcode`\}=2
\directlua{tex.enableprimitives('',{'pdfprimitive','box'})}
\directlua{tex.enableprimitives('h',{'box','relax'})}
\pdfprimitive\hbox{}% works by accident
\pdfprimitive\hrelax{}% generates expected error
\end

Yours sincerely
  Heiko <oberdiek at uni-freiburg.de>


More information about the luatex mailing list