Search:   Help



LyX documentation


Shared groups


LyX /


Categories: LuaTeX, Unicode, TeX engine
<< | Page list | >>

How to use LyX with LuaTeX

Table of contents (hide)

  1.   1.  What is LuaTeX?
  2.   2.  Why use LuaTeX?
  3.   3.  Comparison to XeTeX
  4.   4.  Setting up LyX to work with LuaTeX
  5.   5.  Setting up OpenType math fonts
  6.   6.  External links
  7.   7.  Categories

1.  What is LuaTeX?

LuaTeX is a new TeX typesetting engine that fully supports Unicode and modern font technologies such as OpenType. It has been designed by parts of the pdfTeX team as the dedicated successor of pdfTeX, the current standard engine. Like XeTeX, LuaTeX allows the user to use any font installed on the system it runs on. Font selection and manipulation is controlled by the package (fontspec) also used in XeTeX. Compared to XeTeX, LuaTeX supports font expansion using the microtype package. When LuaTeX is directed to use font expansion, it may use a wider or narrower variant of a font to make interword spacing more even and lower the number of hyphenated words. See the documentation for the microtype package for more details (microtype is installed by default by TeXLive and MiKTeX). However, some microtypographic features are not supported by LuaTeX yet, namely kerning and spacing (see table 1 in section 3.1 of microtype's manual). If you need one of those features in your document, you are better off with pdfTeX.

Furthermore, LuaTeX also has a dedicated scripting interface (which, as the name implies, can run scripts in the language Lua). This allows for several tricks that are not possible with classic LaTeX or XeTeX. For instance, you can send your document through a spell-checker while outputting it to PDF (the errors will be marked in the PDF), you can extract all actual hyphenations to a typified list (which helps hyphenation checking), selectively disable ligatures and all sort of other fancy stuff (development on this has just started).

LuaTeX is still in beta status, although it is improving rapidly.


2.  Why use LuaTeX?

Modern fonts often have additional features that are only available in their OpenType format. For instance, TeX Gyre Termes is a free Times clone that offers, among other features old-style (lower case) numerals. They cannot be used as standard replacement for lining numerals unless the OpenType version of the font is used. The standard engine pdfTeX cannot use OpenType fonts, whereas XeTeX and LuaTeX can. But only LuaTeX currently supports both OpenType support and font expansion.

In short: Use LuaTeX whenever you need to use OpenType fonts and you require microtypographical features that XeTeX does not support.
Notice that XeTeX is a more mature typesetting engine than LuaTeX. And pdfTeX is more mature than both XeTeX and LuaTeX.

3.  Comparison to XeTeX

Both LuaTeX and XeTeX allow to use any OpenType and TrueType font for your documents, and both support Unicode natively. However, there are pros and cons for either engine, which will be sketched in what follows.

XeTeX only supports PDF while LuaTeX supports DVI and PostScript output additionally.

Furthermore, LuaTeX has a scripting interface which allows for some fancy processing tricks (see above for some examples).

XeTeX supports less microtypographic features than LuaTeX.

However, XeTeX currently supports more writing systems and scripts (Arabic, Hindi, etc.) than LuaTeX (unless the HarfBuzz rendering engine is used). XeTeX may thus be the preferred engine for most languages that use non-alphabetic or non-Right-to-Left scripts.

LuaTeX (without HarfBuzz) does not support 1

  • Arabic
  • Bengali
  • Divehi
  • Hebrew
  • Hindi
  • Kannada
  • Lao
  • Malayalam
  • Persian
  • Syriac
  • Tamil
  • Telugu
  • Thai
  • Urdu

Also, XeTeX exists and has been productively used for longer time than LuaTeX. So LuaTeX can be considered less "mature" and "stable" than XeTeX.

4.  Setting up LyX to work with LuaTeX

Since LyX 2.0 you only need to click Document→Settings→Fonts→Use non-TeX fonts (via XeTeX/LuaTeX). Then you can immediately View→PDF (LuaTeX) or View→DVI (LuaTeX).

A bug in LuaTeX means that fonts installed in your user directory may not be available on some systems (e.g. recent Ubuntu). In brief, the trouble is that LuaTeX does not know to look in ~/.local/share/fonts. The bug should be fixed in the next release of TeXLive after TeXLive 2014; in the mean time, a simple workaround is to make a symbolic link to ~/.fonts, where LuaTeX does know to look:

ln -s ~/.local/share/fonts ~/.fonts

If you already have a ~/.fonts directory, you can rename it to the more up-to-date name ~/.local/share/fonts first.

5.  Setting up OpenType math fonts

See the explanation of the XeTeX site.

6.  External links

The home page of the LuaTeX project
Documentation for the fontspec package
Documentation for the microtype package

7.  Categories

Categories: LuaTeX Unicode TeX engine

Edit - History - Print - Recent Changes - All Recent Changes - Search
Page last modified on 2021-12-30 21:23 UTC