I'm trying to get LaTeX3 working with an old e-TeX kernel, and it fails due to the lack of \pdfstrcmp (or XeTeX's \strcmp equivalent).

Is there a pure TeX definition of \pdfstrcmp that I could insert into the top of my file? or is this not possible?

  • Use LuaTeX instead of your old eTeX and program in Lua. May 1, 2013 at 16:35

1 Answer 1


The short answer is 'no'. The longer version is that this primitive (almost certainly) cannot be implemented in macros: primitives rarely can be. In particular, \pdfstrcmp can do an expandable comparison of two sets of tokens on a character ('string') basis, without loosing any spaces. In the past, the LaTeX3 team did have some code which attempted to do the same thing using only (e-)TeX primitives, but there were limitations and we ended up with issues as a result. The availability of this primitive is very useful for a number of functions which otherwise cannot be implemented expandably, and the team therefore made a decision to require it in addition to those from e-TeX: it's been available for a number of years.

  • 3
    There was quite a bit of discussion about requiring this primitive: in the end the utility outweighed the narrowing of usable engines.
    – Joseph Wright
    Apr 29, 2013 at 8:55
  • 1
    The problem being was that there was no way (or we couldn't see one) to emulate this in an expandable way. so the code we had was ok 95% of the time but in the remaining 5% it blew up badly. So if anybody comes up with an expandable implementation of this primitive using only e-TeX that would be interesting, but I seriously doubt this is possible, given that several people tried very hard already. Apr 29, 2013 at 15:48
  • @FrankMittelbach: How then was the primitive built?
    – Ahmed Musa
    Apr 29, 2013 at 18:49
  • @AhmedMusa a primitive is a command that is offered already by the engine. That particular one is part of pdftex since a couple of years back and under a different name by XeTeX. expl3 detects which engine it is running on and selects the right name to use. Apr 29, 2013 at 18:59
  • 2
    @CharlesStewart \strcmp is \pdfstrcmp: XeTeX addition of primitives from pdfTeX tend to drop the \pdf... part if they are not PDF-related.
    – Joseph Wright
    Oct 11, 2015 at 12:52

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .