24

As I understand it, latex is simply a macro package for tex, as in tex the program, not the format. (Again, weird, but I understand LaTeX to be a format of TeX.)

Does this imply that LaTeX the format can be applied to any TeX engine?

Assuming the positive, how are XeLaTeX and LuaLaTeX related to LaTeX, seeing as they build on their respective engines, XeTeX and LuaTeX?

If one were to build another tex, assuming it passes the TRIP test, could LaTeX be applied to it?

1

2 Answers 2

30

The currently LaTeX2e kernel (latex.ltx) does not contain any use of primitives other than those provided by Knuth in TeX. Indeed, if you read the code there are explicit steps taken to support TeX 2 (the 7-bit version), even though TeX 3 ('TeX90') was released in 1990. As such, the kernel itself will work with any TeX implementation that passes the TRIP test.

However, there is an important proviso to that. Building a format needs more than just latex.ltx, and in particular it needs hyphenation patterns. On my system (TeX Live 2013), trying to build a format file without the e-TeX extensions fails as at least one of the hyphenation files uses \numexpr (texmf-dist/tex/generic/hyph-utf8/patterns/tex/hyph-ka.tex). As the hyphenation patterns are not part of the format, you can get around this.


In terms of XeLaTeX and LuaLaTeX, these are very close to the 'standard' LaTeX format. As these engines use UTF-8 input, there are some adjustments which are more-or-less essential in terms of set up (category codes, etc.), which is therefore done in the format-building process. LuaLaTeX's format set up also enables the extra primitives it provides (they don't get activated 'out of the box'). In both cases, these adjustments are needed as latex.ltx was designed before XeTeX or LuaTeX were released, and it is a most sensible to make the adjustment as part of the format-building system.


It's worth noting that the LaTeX3 packages (expl3, etc.) have tougher requirements. As well as the e-TeX extensions, \pdfstrcmp or equivalent functionality is required. Currently, the engines which meet these requirements are

  • pdfTeX v1.30 or later
  • XeTeX v0.9994 or later
  • LuaTeX v0.40 or later
6
  • 1
    What's the TRIP test?
    – cgnieder
    Jul 25, 2013 at 19:28
  • 5
    @cgnieder The TRIP test is what Knuth uses to test TeX. If code passes the TRIP test, it is TeX :-)
    – Joseph Wright
    Jul 25, 2013 at 19:29
  • 2
    Thanks. I also just found texdoc tripman :)
    – cgnieder
    Jul 25, 2013 at 19:38
  • 1
    @cgnieder: you literally have to take a TRIP. :) Jul 25, 2013 at 19:46
  • Is it still correct that the LaTeX kernel does not use any primitives that were not in Knuth's TeX, or does the first paragraph need an update? IIRC it changed sometime in 2015 or 2016 or something like that, but I'm not sure of the details. Feb 13, 2018 at 0:43
12

While it is current that latex.ltx (the file that is used to build the format for LaTeX2e) does not rely on any primitives other than those of a vanilla TeX engine that passes the TRIP test, the LaTeX Project has announced several years back that the expectation is that LaTeX(2e) is run on a system with e-TeX extensions being enabled. This announcement is in one of the ltnews documents that list all important release changes.

As Joseph mentioned in his answer one area where this shows are hyphenation files, but there are also LaTeX packages that started to use these extensions.

Thus the answer to the question is, yes, LaTeX runs on any vanilla TeX engine but there may be some restrictions if it is one of the few systems that do not support e-TeX or have the e-TeX extensions not enabled by default.

2

You must log in to answer this question.

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