According to the fontspec
package's user manual (2017/03/31 v2.6a, Section 5.1, p. 12)
Fonts known to LuaTEX […] may be loaded by their standard names as you'd speak them out loud, such as Times New Roman or Adobe Garamond. […]
The simplest example might be something like
\setmainfont{Cambria}[...]
[…] The 'font name' can be found in various ways, such as by looking in the name listed in a application likeFont Book
on Mac OS X.
My operating system is Mac OS X. The following screenshot shows the Times New Roman font in in my Font Book
application.
The following screenshot shows the Avenir
font name in my Font Book
application.
The following LaTeX document sets the main font of the document to Times New Roman
.
\documentclass{report}
\usepackage{fontspec}
\setmainfont{Times New Roman}
\begin{document}
Hello, world!
\end{document}
Processing this document with the LuaLaTeX format (i.e. with the LuaLaTeX "engine") results in the following pdf, as expected:
However, replacing 'Times New Roman' with 'Avenir' and reprocessing the document with the LuaLaTeX format results in no pdf, and the following error message:
ERROR: table index is nil.
— TeX said —
\scan_stop:
l.3 \setmainfont{Avenir}— HELP —
From the .log file…The lua interpreter ran into a problem, so the remainder of this lua chunk will be ignored.
What's the problem? Why doesn't the Avenir example work whereas the Times New Roman one does?
Operating System: macOS Sierra Version 10.12.5
MacTex distribution: MacTeX-2017
LuaTeX: Version 1.0.4
Best Answer
I don't really know why LuaLaTeX is not able to associate Avenir Book to the upright font; with XeLaTeX it seems to go well.
Actually, if one looks closely, when XeLaTeX is used, the
.ttc
font file in the/System/Library/Fonts
folder is used, not one of the files in/Library/Fonts
. Perhaps this is the issue when LuaLaTeX comes into play, becauseluaotfload
has a different strategy for choosing fonts.For LuaLaTeX you need to specify the font names (at least in this case):
This would be needed also with XeLaTeX if you want Medium instead of Black.
Output with LuaLaTeX
Output with XeLaTeX
Output with XeLaTeX and just
\setmainfont{Avenir}