[texhax] testing if a control sequence is primitive

Joseph Wright joseph.wright at morningstar2.co.uk
Sat Oct 8 17:57:32 CEST 2011


On 08/10/2011 16:20, 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:
> 
> \ifprimitivecs{par}{Primitive}{Macro}
> 
> should return macro. Can \token_if_primitive:NTF do that?
> 

Try:

\documentclass{article}
\usepackage{expl3}
\ExplSyntaxOn
\token_if_primitive:NTF\end\TRUE\FALSE

and observe that the \FALSE branch is taken!
-- 
Joseph Wright


More information about the texhax mailing list