73

Adding the missing member to pdfLaTeX vs. XeLaTeX and pdfLaTeX vs. LuaLaTeX, here's the last of the big three: XeLaTeX vs. LuaLaTeX.

Where would a typical template for XeLaTeX differ from one for LuaLaTeX? Two areas coming to my mind in which it would be nice to get some detailed information on what's advisable to use, or what's currently usable to which degree with which compiler are:

  1. microtype
  2. babel vs. polyglossia

Since I don't expect there to be too many packages to list here, it might also sense to mention which packages both XeLaTeX and LuaLaTeX users typically make use of, but not pdfLaTeX users, i.e. the common denominator (?) of the other two questions in the "trinity".

For the general differentiation between XeLaTeX and LuaLaTeX see Differences between LuaTeX, ConTeXt and XeTeX. Also related: Considerations when migrating from XeTeX to LuaTeX?

8

1 Answer 1

28
+500

While I’m no expert in either XeLaTeX or LuaLaTeX, I’ve used both a bit, so I’ll try to write up some things that I’ve noticed in the “front-end” superficial user level.

fontspec

... is the standard way of using fonts with both engines. I haven’t noticed remarkable differences in the outcome or font selection, but according to the comments to this question, there seem to be some.

This means, of course, that neither inputenc nor fontenc should be used. Do make sure to save your .tex file in UTF-8.

microtype

Version 2.5 from 2013-03-13 seems to have improved XeLaTeX support a lot. For LuaLaTeX (and pdfLaTeX), protrusion and expansion are supported; for XeLaTeX it’s only protrusion. Since microtype typically works great without further configuration, you can simply load it for any of the engines.

babel/polyglossia

polyglossia only works with XeLaTeX. A minimal setup of babel works with both engines (I think a recent update also included some improvements for XeLaTeX, is that right?), but the package description on CTAN still says: “Users of XeTeX are ad­vised to use polyglos­sia rather than ba­bel.” Hence, I’d follow that advice and use babel with LuaLaTeX (and pdfLaTeX), but polyglossia with XeLaTeX. That’s certainly the way it used to be.

xunicode

On up-to-date systems, this package should not be necessary at all – that seems to be the verdict here on tex.sx. If anywhere, it should only be used with XeLaTeX; in fact, it produces an error message in LuaLaTeX (unless it’s loaded after fontspec).

LuaLaTeX-only packages

While there probably are some packages specifically tailored for XeLaTeX, I would assume there are (and will be) many more for LuaLaTeX, making use of the scripting language Lua being tightly tied into the engine. Two that I have used so far are Patrick’s lua-check-hyphen, enabling you to easily check all hyphenations that occur in your document, and Mico’s selnolig (announcement on meta), which automatically suppresses typographically undesirable ligatures for English and German, based on an extensive pattern list. (Check it out.)

4
  • It's not necessary to save your .tex file in UTF-8 when using fontspec. I never do. My .tex file contains nothing but ASCII characters. I use macros for all non-ASCII glyphs. If you use fancy font-dependent characters in your .tex file, you're at the mercy of the display font when you visually inspect your file. That can cause issues when you open your file 10 years from now, and you don't remember what font you used, and it can be an issue when you share your .tex file with others (I've been at the receiving end of such files, much to my frustration).
    – Sverre
    Apr 30, 2013 at 20:15
  • 5
    @Sverre If you save a file in ascii it is automatically utf-8; so in fact you always do. Apr 30, 2013 at 20:24
  • @phg I think we're talking about two different things here. I didn't say I save my file "in ascii", only that I use ASCII characters only. UTF-8 is backward compatible with ASCII, but you can easily save your file with something else than UTF-8 encoding and only use ASCII characters.
    – Sverre
    Apr 30, 2013 at 20:52
  • Regarding LuaTeX-only packages, there is also the new TikZ graph layout library.
    – 0 _
    Aug 19, 2014 at 8:29

You must log in to answer this question.

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