# [texhax] testing if a control sequence is primitive

Sat Oct 8 18:13:13 CEST 2011

On Sun, Oct 09, 2011 at 02:20:20AM +1100, Vafa Khalighi wrote:

> Thanks. but I should also add that there is one more requirement. If \cs is
> primitive but also redefined, e.g. \par or \input in LaTeX, it should return
> Macro not primitive like:

Except that \par is not always redefined in LaTeX, only in some
circumstances.

> \ifprimitivecs{par}{Primitive}{Macro}
>
> should return macro. Can \token_if_primitive:NTF do that?

What happens if \par is redefined to be another primitive?

\let\par=\hbox

What about primitives under a different name?

\let\endgraf=\par

\endgraf is not an original primitive, but it has the meaning of
a primitive.

Yours sincerely
Heiko Oberdiek