# How is a TeX document written when using LuaLaTeX?

I am new to the LaTeX world and would like to start off with a book project. My target is specifically creating books for print and online.

My requirements are

• UTF-8,
• Arabic,
• custom fonts,
• to output PDF/X-1a compliant PDFs.

I have read that LuaTeX is the new engine.

How does using LuaLaTeX affect the .tex document structure?

For example, if I follow the LaTeX Beginner’s Guide, would I be able to use LuaLaTeX?

Is only the preamble different when using LuaLaTeX?

I am using TeXStudio under Windows 8.1.

• luatex isn't "the new engine" it's an experimental project with a unicode based TeX extension. If starting a new project using Arabic, you certainly should look at one of the extended TeX engines, but you might want to also look at xetex. (The latex markup for lualatex and xelatex is essentially the same). xelatex uses external font libraries and may (depending on fonts used) be better at the font shaping required for Arabic. – David Carlisle May 6 '15 at 7:32
• @DavidCarlisle, my main issue of not using xelatex i have not found a way to output a pdf in PDF/X-1a complaint pdf. Pdflatex and Lualatex does that, here is the post tex.stackexchange.com/questions/242303/… – Ibn Saeed May 6 '15 at 8:21
• If you are starting, may be take a look at ConTeXt. – Manuel May 6 '15 at 9:45
• the linked reference just seems to be about including the color profile, is that the only issue? the `\immediate\pdfobj` syntax clearly only works for pdf/lua tex but there should be an equivalent `\special` for xdvipdfmx I would have thought. It's only just including some literal pdf code at that point. – David Carlisle May 6 '15 at 10:07
• @Manuel, LaTeX seems to have a lot of online resources and help. ConTeXt, seems to be limited, since i am starting out i dont know where to look for books on ConTeXt, specifically MKIV – Ibn Saeed May 6 '15 at 16:16

LuaLaTeX shouldn’t affect your document too much. The main thing you’ll have to change is the preamble. There’s no need to load packages like `fontenc` or `inputenc`. LuaLaTeX supports UTF-8 by default, so you should encode your files with UTF-8 (this should be possible with TeXStudio). Instead of having a preamble like

``````\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
``````

there now is the package `fontspec` to set the document’s fonts:

``````\documentclass{article}
\usepackage{fontspec}
\setmainfont[Ligatures=TeX]{Linux Libertine O}
\setsansfont[Ligatures=TeX]{Linux Biolinum O}
``````

and so on. Please read the documentation of the `fontspec` package for details on this. Also the LuaTeX reference might be useful, as well as Manuel Pé­gourié-Gon­nard’s Guide to LuaLaTeX, which I really recommend reading. It basically gives you the main differences (see p. 3 of the PDF file):

1. Don’t load `inputenc`; just encode your source in UTF-8.
2. Don’t load `fontenc` or `textcomp`; load `fontspec`.
3. `babel` works with LuaLaTeX but you can load `polyglossia` instead.
4. Don’t use any package that changes the fonts; use `fontspec` commands instead.

Basically, everything that works with normal pdfTeX should also work with LuaTeX, but be aware that LuaTeX is still in development and it could change from release to release. For distinct questions and problems, please have a look around this website for an answer to your question, or ask a question yourself.

• thanks for the answer. i did read Manuel Pé­gourié-Gon­nard's Guide to use of LaTeX with LuaTeX before posting. I have downloaded fontspec and LuaTex Reference, ill go through the refernce first. – Ibn Saeed May 6 '15 at 7:39
• Can i use Memoir with LuaLaTeX without making any changes, or are there some steps i need to take care for using memoir with lualatex – Ibn Saeed May 6 '15 at 7:40
• @IbnSaeed They should work without problem. – Franck Pastor May 6 '15 at 8:05
• I think there is a typo in the second code block: It should be `\usepackage{fontspec}` instead of `\usepackage{fontenc}` – Aaron Digulla May 6 '15 at 13:37
• Thinking about it, my previous comment is probably worth a question on its own... – Daniel May 6 '15 at 14:50