# Can ConTeXt do what luaTeX does?

I am aware that ConTeXt is a macro package whereas luaTeX is an engine. As far as I know, luaTeX is a plain TeX + Lua as an embedded scripting language. Furthermore, ConTeXt can use Lua.

My question is where are the differences? In other words, what are some situations in which one overcomes the other (i.e. advantages and disadvantages)?

Contrary to what Gaussler says, from circa 2018 there's a new format called ConTeXt LMTX (Lua, Metapost, TeX, XML) using a new engine called LuaMetaTeX. I'll try to summarize some advantages and disadvantages wrt aspects I'm familiar with. Also, by simplicity I list both ConTeXt (format) and LuaMetaTeX (engine) features.

EDIT: Gaussler is right wrt average users. ConTeXt MkIV and LuaTeX (be OpTeX, LaTeX, Plain, etc.) should be capable (theoretically) of doing essentially the same things. It's only when you need more tuning or features that differences become clear.

• Compiled libraries (.so/.dll) aren't supported by default. This is because LuaMetaTeX doesn't fully support them and you have to include your own Lua libraries. Also, and unlike ConTeXt with LuaTeX, you need an additional flag --permitloadlib. According to LuaMetaTeX manual, "the reason for having this as option is the wish for security [...], so this might give an extra feeling of protection": http://www.pragma-ade.com/general/manuals/luametatex.pdf
• Not really a disadvantage, but a caveat. LuaMetaTeX uses Lua 5.4 which is in active development, so minor differences (and bugs) wrt Lua 5.3 will be there.
• One thing I’ve never been able to understand is why we don’t drop this horrible #1–#9 scheme for arguments where you constantly have to worry about doubling or n-upling the number of #’s. We should use #<a unique string> instead, with no ## or ########. So then we could do e.g. \def\myindex#subscript#superscript{^{#superscript}_{#subscript}}. Nov 13, 2020 at 15:53
• @Gaussler ConTeXt partially solves the naming situations via a preprocessor, so I suppose a change in the binary isn't necessary. Such a radical change would introduce a lot of bugs if included in the engine, I think. Wrt hashes, I guess this hasn't changed because nobody has proposed a better alternative.
– user226564
Nov 13, 2020 at 16:16
• As is evident from another post I made today, I would very much prefer TeX to behave more like a normal programming language with respect to how it expands its commands. This would make the language a lot more predictable and accessible for programmers. I cannot help wonder why packages that are celebrated as masterpieces of TeX programming (e.g. siunitx) would have been completely trivial introductory exercises in any other programming language than TeX. Nov 13, 2020 at 16:51
• @Gaussler TeX is a macro processor not a programming language, so the comparison is ill-posed. You could compare TeX to something like the C preprocessor or a restricted subset of Lisp. BTW, hash doubling is very necessary, otherwise you couldn't do \def\foo#1{\def\bar##1{#1/##1}}. Nov 21, 2020 at 19:16
• @HenriMenke TeX certainly has programming language features. Hash doubling would not be necessary if TeX were designed as I suggested. Then you could simply call your variables #1 and ##1 different things, like #firstvar and #secondvar (of course, the macro processing would in general work very differently). For the same reason, in most programming languages, I can have a globally defined variable s and still use s as the name of an argument in a function; then the language will usually just ignore the original variable s in the function definition. Nov 21, 2020 at 19:21

ConTeXt (in its newest version) runs exclusively on LuaTeX. So ConTeXt can do everything LuaTeX can.

• context in its newest version runs on luametatex, not luatex. Nov 13, 2020 at 14:11
• @UlrikeFischer Close enough. Nov 13, 2020 at 14:17
• not really. luametatex is so different that it wasn't possible to create a latex format with it without lots of tweeks (and perhaps it broke again after the last changes). Nov 13, 2020 at 14:19
• @Gaussler You're wrong, really wrong. Hans Hagen has made significant changes in LuaMetaTeX which make it unusable with traditional formats.
– user226564
Nov 13, 2020 at 14:24
• @JairoA.delRio And yet, for the average user, the difference probably hardly matters. The important thing to the OP seems to be whether ConTeXt can do the same things LuaTeX (with another format) can, and unless you doing some complicated constructions, the answer is probably “yes”. Nov 13, 2020 at 14:36