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 advised to use polyglossia
rather than babel
.” 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.)
To answer my own question: Ubuntu 20.04's TeX Live 2019 claims to provide luahbtex
(in the description of the texlive-luatex
package) but in fact it doesn't. To make matters worse it silently links lualatex-dev
, which is supposed to run on luahbtex
, to luatex
.
One can use the following workaround:
Download https://mirrors.rit.edu/CTAN/systems/texlive/tlnet/archive/luahbtex.x86_64-linux.tar.xz (or whatever corresponds to your architecture). You can use another mirror, of course.
Put the luahbtex
binary from this package into /usr/local/bin
and in the same directory create lualatex-dev
as a soft link to luahbtex
.
In /var/lib/texmf/fmtutil.cnf-TEXLIVEDIST
change the line
lualatex-dev luatex language.dat,language.dat.lua lualatex.ini
to
lualatex-dev luahbtex language.dat,language.dat.lua lualatex.ini
.
(That is, change the engine from luatex
to luahbtex
.)
Run sudo fmtutil-sys --byfmt=lualatex-dev
.
Using lualatex-dev
you can now compile any TeX file using the emoji
package or otherwise relying on luahbtex
without problem. (In case of emoji
here's no need to use \setemojifont{}
except you want to change the font the package chooses by itself.)
Best Answer
It is because some works is in progress specially for the bidi package, on the other hand I am waiting for some of luatex bidi bugs getting fixed. you can test things if you want: