[NTG-pdftex] [Dev-luatex] \primitive\pdfoutput cannot be queried

Heiko Oberdiek oberdiek at uni-freiburg.de
Wed Apr 15 19:13:46 CEST 2009

Hello Taco,

On Sat, Apr 11, 2009 at 04:18:41PM +0200, Taco Hoekwater wrote:

> Taco Hoekwater wrote:
> >Heiko Oberdiek wrote:
> >>
> >>AFAIK, an expression with \primitive will become expandable
> >>if and only if the primitive is expandable.
> >>(pdfTeX: \pdfprimitive)
> >
> >I am thinking about this bug.
> Please look at the attached patch against pdftex trunk. I have a similar
> patch in luatex now, and it works ok for your example file as well as
> some other stuff I tried.

Yes, many thanks.

> The patch makes scan_something_internal (for \number and the other 
> convert commands) and scan_int (other places where numbers are needed)
> skip over the unexpandable version of \primitive so that it looks at
> the next token, and if that token is a primitive, it uses this instead.
> If the next token is not a primitive at all, then a frozen \relax is
> inserted, as that is probably the best thing to do. I have considered
> reporting an error, but that is too unpredictable for my taste (and a
> "Missing number" error will likely follow anyway).
> Please check against any other tests you may have.

If the next token is not a primitive, then it vanishes:


% ok:

\sx % [macro:->\pdfprimitive \pdfoutput ]

% token vanishes in the next cases:

\sx % [macro:->]

\sx % [macro:->23]

\sx % [macro:->]

\sx % [macro:->]

\edef\x{\pdfprimitive $}
\sx % [macro:->]

[\pdfprimitive 0] % []

% An error message I could trigger by:

\chardef\a=10 %
\pdfprimitive\a X

! Missing control sequence inserted.
<inserted text> 
<to be read again> 
l.70 \pdfprimitive\a X

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

More information about the ntg-pdftex mailing list