[Tex/LaTex] Using LuaTeX as a replacement for pdfTeX

luatexpdftex

In this question Differences between LuaTeX, ConTeXt and XeTeX various differences between LuaTeX and XeTeX (and ConTeXt) are discussed. And in this question Using XeLaTeX instead of pdfLaTeX a recipe for switching from pdfLaTeX to XeLaTeX is given. In this question, I would like a similar recipe for using LuaLaTeX. I'm particularly interested in the degree to which LuaTeX can be used as a drop-in replacement for pdfTeX. I'm not interested in things that LuaTeX can do that pdfTeX can't.

So the question is:

What do I need to do to use LuaLaTeX instead of pdfLaTeX to compile existing or new documents?

Some specific sub-questions:

  1. What packages are compatible with pdfLaTeX but not with LuaLaTeX?
  2. Are there any packages specific to LuaLaTeX that should be loaded in most LuaLateX documents?

Best Answer

I think we don't need to do much. The only incompatible thing I know is the UTF-8 encoding.

To answer the sub-questions:

  1. Any package related to input encodings and font encodings:

    • inputenc. You should always use UTF-8 encoding to input the text. For backward compatibility, use luainputenc instead.
    • fontenc. Don't use it with fontspec explictly.
    • textcomp. Use xunicode instead, which is loaded by fontspec.
    • Most old font packages (esp. for text fonts) are better not to be used. For example, use XITS, TeX Gyre Termes or Linux Libertine O fonts with fontspec instead of times package, and use Unicode fonts for main text together with mathptmx and txfonts (font math fonts only) to get proper text fonts.
    • CJK is not compatible with LuaTeX. Today only a few unofficial LaTeX packages in Korea and Japan are available. This may be not very important for western users.
  2. fontspec. To load TrueType/OpenType fonts. This is the only necessary one, I think. Also, luacode and unicode-math are useful.