85

I'm in the process of switching my LaTeX document from pdflatex to lualatex. Similar to Frequently loaded packages: Differences between pdfLaTeX and XeLaTeX I would like to know, what are typical packages loaded with LuaLaTeX and which typical pdfLaTeX packages should be removed or replaced?

The following are the main difference I found so far:

  • Don't use inputenc, but instead save your plain files in utf-8 and add the following as the first line: % !Mode:: "TeX:UTF-8".
  • Don't use font-packages but instead load fontspec with \setmainfont{FONT_NAME}, \setsansfont{FONT_NAME}, \setmonofont{FONT_NAME}.
  • In order to make microtype work with fontspec, use the beta version of microtype (At least with TeX Live 2011). See more details.
  • hyperref should be loaded with the option unicode.

What other packages do you use? What about babel and textcomp? And are there some "killer-packages" that are only working with lualatex besides fontspec?

3 Answers 3

44

Besides supporting a Lua interpreter, LuaTeX brings to pdfTeX quite the same changes as XeLaTeX (native Unicode support, support for system fonts).

For this reason, the question you linked to applies to LuaTeX as well, modulo the answers to this question about migrating from XeTeX to LuaTeX, which shows that apart from microtype support and font names, LuaTeX- and XeTeX-specific codes are mostly compatible.

babel works fine with LuaTeX as far as I can tell. At least with frenchb, I haven't had any issues.

Besides fontspec (which also works with XeTeX), there's more and more packages that use Lua to provide features. As an example, I have recently released the impnattypo package which has some LuaTeX specific features (thanks to Patrick), and I have more coming (such as the unreleased overcolored package).

1
  • 6
    Perhaps it's best to load polyglossia instead of babel with LuaLaTeX? Oct 3, 2013 at 21:40
27

Most usage questions for LuaLaTeX are answered in lualatex-doc.pdf.

0
8

Similar to the MWE in the linked XeLaTeX question, here is a MWE for LuaLaTeX. It uses the ifluatex package to allow switching between pdfLaTeX and LuaLaTeX (remember to delete all .aux files). I used the fonts from the Microsoft ClearType fonts, because they look good on screen and printed.

% !TEX program = LuaLaTeX
\documentclass[
    a4paper,
    ngerman,
    final
]{scrbook}

\usepackage{amsmath}

\usepackage{ifluatex}
\ifluatex
    % Lua(La)TeX
    \usepackage[ngerman]{babel}
    %\usepackage{polyglossia}   
    %\setmainlanguage[spelling=new,babelshorthands=true]{german}
    \usepackage{fontspec}
    \defaultfontfeatures{Ligatures=TeX}
    \usepackage[]{unicode-math} 
    \unimathsetup{math-style=TeX}
    \setmainfont[Ligatures=TeX]{Constantia} 
    \setsansfont{Calibri}
    \setmonofont{Consolas}
    \setmathrm{Cambria Math}
    \setmathfont{Cambria Math}
\else
    %default: pdf(La)TeX
    \usepackage[ngerman]{babel}
    \usepackage{lmodern} % load vector font
    \usepackage[T1]{fontenc} % font encoding
    \usepackage[utf8]{inputenc} % input encoding
\fi

\usepackage[babel=true]{microtype}


%% ==================
\begin{document}
\chapter{Goldener Schnitt}
Beim Goldenen Schnitt (lateinisch: sectio aurea) oder auch bei der Goldenen Teilung 
--- seltener beim Göttlichen Schnitt oder bei der Göttlichen Teilung (lateinisch: proportio divina) --- 
entsteht ein bestimmtes Verhältnis zwischen zwei Zahlen oder zwei Größen.
Dieses Verhältnis ist die Goldene Zahl $\Phi$ (Phi) (oder das Goldene Verhältnis oder das Göttliche Verhältnis) und hat den Wert
\begin{equation}
    \Phi=\frac{1 + \sqrt{5}}{2} \approx 1{,}618
\end{equation}
Zum Beispiel stehen zwei Teile einer Strecke im Verhältnis $\Phi$, 
wenn sich der größere zum kleineren Teil verhält wie die ganze Strecke zum größeren Teil.
\begin{equation}
    \frac{a}{b} = \frac{a+b}{a}
\end{equation}
Streckenverhältnisse wie beim Goldenen Schnitt werden seit der griechischen Antike als Inbegriff von Ästhetik und Harmonie angesehen. 
Sie werden als ideale Proportionen in Kunst und Architektur angewendet, 
kommen aber auch in der Natur vor. 
Das Goldene Verhältnis ist häufig bei der Bildkomposition in der Malerei zu finden und wird heute oft in der Photographie verwendet. 
\begin{table}[!htb]
\begin{tabular}{@{}l*{10}{p{7mm}@{}}}
    Some T1 characters:     & \# & \$ & \% & Ă & Ň & § & @ & Æ & ß   & £   \\[1.5mm]
    Some non-T1 characters: & ‡  & ÿ  & ‰  & … & ¶ & ½ & ĩ & µ & | | & | | \\
\end{tabular}
\end{table}
Es zeichnet sich durch eine Reihe besonderer mathematischer Eigenschaften aus.
Umgangssprachlich wird Goldener Schnitt auch für die Goldene Zahl beziehungsweise für das Goldene Verhältnis gebraucht.
\end{document}
4
  • 4
    I would suggest to not use the ClearType fonts as a default as they are—as far as I know—only provided in Windows. Hence using the TeX Gyre fonts or the Libertine might be a better solution for the MWE as they come bundled with TeX Live (and I think MikTeX too) and therefore are available on most TeX installations. Sep 30, 2015 at 16:12
  • You can also install these fonts on Linux: venutip.com/content/installing-vista-fonts-ubuntu and they seem to be very complete, also they match nicely together. Also, I frequently include pdf graphics generated with Excel, so I definetly want to use a font that is available system wide. If you have a better suggestion, feel free to edit my answer.
    – matth
    Oct 1, 2015 at 7:10
  • 3
    I am aware of the fact that one could install them on Linux but reading the guide you linked, it doesn't seem to be a thing one wants to do to just make a MWE running. My point is to use a font in the MWE that comes with TeX Live or MikTeX, such as TeX Gyre or Libertine. Using them you won't need to install anything more but your TeX distribution to use the MWE. Oct 1, 2015 at 11:56
  • 2
    Yes, MWEs should work without further effort, especially without something like installing fonts from another OS.
    – JPi
    Mar 21, 2016 at 13:00

You must log in to answer this question.

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