[Tex/LaTex] Getting started with LuaTeX and ConTeXt


I've been using LaTeX now for roughly about 20 years. Only within the past 3 years or so have I tried understanding the internal workings of TeX. There are not a few posts here for which the OP is using LuaTeX or ConTeXt. I thought it might be a good project to try to understand what's going on there. But I'm a bit overwhelmed by the material I find.

Most of the material I can find (such as calling texdoc luatex from the command line) seems to target an audience already familiar with the concepts. (In fact texdoc context is even worse in terms of helpfulness.)

So where do I get started?

I would hope some sort of introduction would address the following points:

  • What does LuaTeX/ConTeXt do for you?
  • Why would I want to use LuaTeX/ConTeXt?
  • How do I incorporate the facilities I'm already familiar with (such as pstricks and TikZ) in a LuaTeX/ConTeXT document?

It would also be nice if I could be pointed to some show-case pieces that demonstrate the power of using these …. (I don't know what to call them) engines?

Best Answer

I'm not an expert on any of this but this is what I've been able to figure out.

ConTeXt is a macro package, a peer of LaTeX. It happens to run only on the LuaTeX engine. LaTeX supports several engines, so you get LuaLaTeX and XeLaTeX, and I think (but may be mistaken) that "vanilla" LaTeX runs on PDFTeX or "original" TeX.

The differences between the engines from my perspective as a user is basically this:

  • "classic" TeX makes those ugly DVI files and depends on ugly METAFONT fonts (the prime offender being Computer Modern).
  • PDFTeX is just like "classic" except it produces PDFs without you having to go through dvipdf or dvips | ps2pdf.
  • XeTeX uses your system fonts (TTF or OTF), and is therefore inherently superior to the previous two.
  • LuaTeX is TeX with the programming language Lua baked-in. It seems to support OTF and TTF fonts as well as XeTeX.

So, to answer your questions:

  1. What does LuaTeX do for you? It gives you better font handling and a sane extension language. You can also access Lua libraries directly from TeX if you wanted to do esoterica like connect to databases from your typesetting process.
  2. What does ConTeXt do for you? It does the same things LaTeX does. I find it a lot easier to understand and read, and it seems to take a lot less effort and produce much more beautiful documents. The main problem (IMO) is that it changes so rapidly the documentation often seems to be out of date, which leads me to the helpful folks on the mailing list and here on SE.
  3. Why would I want to use LuaTeX? Apart from the improved font handling and ease of extensibility, the main argument would be that it is where all the action is currently. If you're not swayed by those aspects I'm not sure there's anything really for you here.
  4. Why would I want to use ConTeXt? Because you want to do things that are complex to do in LaTeX more easily and you want a typesetting workflow that is more modular and repeatable. Your threshhold for document beauty has increased. You're tired of the ol' package hunt and subsequent trying to find the incompatibility when something doesn't work. You've noticed that LaTeX fights back hard when you try to use plain TeX facilities and you want to try a macro package that plays nicer.
  5. How do I incorporate the facilities I'm already familiar with? ConTeXt actually has TikZ baked in, so you can just continue using that. PStricks is unsupported in things that do not take a PostScript route to get to the finished product, so you won't be able to use it. ConTeXt has fairly tight integration with METAPOST though, for doing lower-level graphics. You may find that approachable. Random LaTeX packages are, for the most part, completely inaccessible to ConTeXt users.

I hope this helps. I'm a fairly enthusiastic (if ill-informed) user of ConTeXt and am getting more into plain TeX. I find that solutions to problems in ConTeXt almost never rely on third-party modules, but it's not all that uncommon that I'm unable to find the answer in the wiki. Responsiveness of the community on here and the mailing list is very high. But I am starting to wonder if I'd be happier using plain TeX, since I'm a fairly capable programmer and lately feel like I'd be happier with my own faulty abstractions that I understand fully than someone else's, especially if that someone else is such a wizard I can't really read the code.

If you want to really go outside the box though there are other typesetting systems; Heirloom Troff in particular is interesting if you want to try something much faster and weaker than TeX, and it is also able to access system fonts.

I realize we're all bound by blood to recommend The TeXBook but I've actually gotten much more out of TeX by Topic (available on Lulu for $15) and TeX for Beginners. I really hate Knuth's writing style.