I am aware of this question \pdfstrcmp or \strcmp in pure TeX so I want to learn how to add the missing primitive \pdfstrcmp to e-TeX. From LaTeX3 source code expl3.lua:

local function strcmp(A, B)
  if A == B then
  elseif A < B then
l3kernel.strcmp = strcmp

it seems to me that the primitive \pdfstrcmp is basically a wrapper for standard C's strcmp function. So I believe there should be an easy way to "delegate" the WEB implementation to C (not using pure TeX like the aforementioned question). What is the procedure to add new primitives to an engine?

  • 1
    \pdfstrcmp is already present as primitive in pdfTeX, XeTeX has \strcmp as primitive and an implementation in Lua exists for LuaTeX (e.g., package pdftexcmds). What are you missing? Apr 6, 2018 at 23:41
  • 1
    the etex engine is (these days) pdftex in dvi mode, so \pdfstrcmp is defined. Apr 6, 2018 at 23:44
  • @Oberdiek I am using the original e-TeX that only output the DVI. I have a special need for it.
    – An Hoa
    Apr 6, 2018 at 23:48
  • 1
    there is no "procedure" (and historically it is rather rarely done) but pdftex is open source so you could in theory take tug.org/svn/texlive/trunk copy the pdftexdir to ahoatexdir and then make a new engine with whatever changes you wanted to make and then promote that format over the existing pdftex format (see for example ptex with extra primitives for japanese typesetting) Apr 6, 2018 at 23:54
  • 1
    @AnHoa \pdfstrcmp is independent from the output mode and can be used in DVI mode as well. The prefix \pdf comes from pdfTeX, not from PDF, and should avoid name clashes with existing macros. Apr 7, 2018 at 7:24


You must log in to answer this question.

Browse other questions tagged .