Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

How to compile properly a document using fontspec package?

Example code (15.1. XeTeX @ LaTeX-wikibooks.pdf)

\documentclass{article}
\usepackage{fontspec}
\setmainfont{Arial}
\begin{document}
Lorem ipsum...
\end{document} 

Result with $latex fontspec.tex

This is pdfTeXk, Version 3.1415926-1.40.9 (Web2C 7.5.7)
 %&-line parsing enabled.
entering extended mode
(./fontspec.tex
LaTeX2e <2005/12/01
Babel <v3.8l> and hyphenation patterns for english, usenglishmax, dumylang, noh
yphenation, german-x-2008-06-18, ngerman-x-2008-06-18, ancientgreek, ibycus, ar
abic, basque, bulgarian, catalan, pinyin, coptic, croatian, czech, danish, dutc
h, esperanto, estonian, farsi, finnish, french, galician, german, ngerman, mono
greek, greek, hungarian, icelandic, indonesian, interlingua, irish, italian, la
tin, mongolian, mongolian2a, bokmal, nynorsk, polish, portuguese, romanian, rus
sian, sanskrit, serbian, slovak, slovenian, spanish, swedish, turkish, ukenglis
h, ukrainian, uppersorbian, welsh, loaded.
(/usr/share/texmf/tex/latex/base/article.cls
Document Class: article 2005/09/16 v1.4f Standard LaTeX document class
(/usr/share/texmf/tex/latex/base/size10.clo)) (./fontspec.sty
(/usr/share/texmf/tex/latex/expl3/expl3.sty
(/usr/share/texmf/tex/latex/expl3/l3names.sty)
(/usr/share/texmf/tex/latex/etex-pkg/etex.sty)
(/usr/share/texmf/tex/latex/expl3/l3basics.sty)
(/usr/share/texmf/tex/latex/expl3/l3expan.sty)
(/usr/share/texmf/tex/latex/expl3/l3tl.sty)
(/usr/share/texmf/tex/latex/expl3/l3intexpr.sty)
(/usr/share/texmf/tex/latex/expl3/l3quark.sty)
(/usr/share/texmf/tex/latex/expl3/l3seq.sty
! Undefined control sequence.
l.129 \int_new:N
               \g_seq_nesting_depth_int
?

Result with $lualatex fontspec.tex

This is LuaTeX, Version snapshot-0.25.4-2009102410 (Web2C 7.5.7)
(fontspec.tex>
LaTeX2e <2005/12/01>
Babel <v3.8l> and hyphenation patterns for english, usenglishmax, dumylang, noh
yphenation, german-x-2008-06-18, ngerman-x-2008-06-18, ancientgreek, ibycus, ar
abic, basque, bulgarian, catalan, pinyin, coptic, croatian, czech, danish, dutc
h, esperanto, estonian, farsi, finnish, french, galician, german, ngerman, mono
greek, greek, hungarian, icelandic, indonesian, interlingua, irish, italian, la
tin, mongolian, mongolian2a, bokmal, nynorsk, polish, portuguese, romanian, rus
sian, sanskrit, serbian, slovak, slovenian, spanish, swedish, turkish, ukenglis
h, ukrainian, uppersorbian, welsh, loaded.
(/usr/share/texmf/tex/latex/base/article.cls
Document Class: article 2005/09/16 v1.4f Standard LaTeX document class
(/usr/share/texmf/tex/latex/base/size10.clo)) (fontspec.sty
(/usr/share/texmf/tex/latex/expl3/expl3.sty
(/usr/share/texmf/tex/latex/expl3/l3names.sty
(/usr/share/texmf/tex/generic/oberdiek/luatex.sty
(/usr/share/texmf/tex/generic/oberdiek/infwarerr.sty)
(/usr/share/texmf/tex/generic/oberdiek/ifluatex.sty)
(/usr/share/texmf/tex/latex/etex-pkg/etex.sty)
(/usr/share/texmf/tex/generic/oberdiek/luatex-loader.sty
(/usr/share/texmf/scripts/oberdiek/oberdiek.luatex.lua)))
(/usr/share/texmf/tex/generic/oberdiek/pdftexcmds.sty
(/usr/share/texmf/scripts/oberdiek/oberdiek.pdftexcmds.lua)))
(/usr/share/texmf/tex/latex/expl3/l3basics.sty)
(/usr/share/texmf/tex/latex/expl3/l3expan.sty)
(/usr/share/texmf/tex/latex/expl3/l3tl.sty)
(/usr/share/texmf/tex/latex/expl3/l3intexpr.sty)
(/usr/share/texmf/tex/latex/expl3/l3quark.sty)
(/usr/share/texmf/tex/latex/expl3/l3seq.sty
! Undefined control sequence.
l.129 \int_new:N
                 \g_seq_nesting_depth_int
?

Result with $xelatex fontspec.tex

This is XeTeXk, Version 3.1415926-2.2-0.999.6 (Web2C 7.5.7)
 %&-line parsing enabled.
entering extended mode
(./fontspec0.tex
LaTeX2e <2005/12/01>
Babel <v3.8l> and hyphenation patterns for english, usenglishmax, dumylang, noh
yphenation, german-x-2008-06-18, ngerman-x-2008-06-18, ancientgreek, ibycus, ar
abic, basque, bulgarian, catalan, pinyin, coptic, croatian, czech, danish, dutc
h, esperanto, estonian, farsi, finnish, french, galician, german, ngerman, mono
greek, greek, hungarian, icelandic, indonesian, interlingua, irish, italian, la
tin, mongolian, mongolian2a, bokmal, nynorsk, polish, portuguese, romanian, rus
sian, sanskrit, serbian, slovak, slovenian, spanish, swedish, turkish, ukenglis
h, ukrainian, uppersorbian, welsh, loaded.
(/usr/share/texmf/tex/latex/base/article.cls
Document Class: article 2005/09/16 v1.4f Standard LaTeX document class
(/usr/share/texmf/tex/latex/base/size10.clo)) (./fontspec.sty
(/usr/share/texmf/tex/xelatex/expl3/expl3.sty
(/usr/share/texmf/tex/xelatex/expl3/l3names.sty>

! Package l3names Error: Required primitive not found: \pdfstrcmp.>

See the l3names package documentation for explanation.>
Type  H <return>  for immediate help.>
 ...>

l.121     }>

Second example (#2:3 Test F-autofake @ fontspec/fontspec-testsuite.pdf)

\documentclass{testsuite}
\usepackage{fontspec}
\begin{document}
\Large
\def\text{ABC \textit{ABC} \textbf{ABC}
          \textbf{\textit{ABC}}\\}
\fontspec{Inconsolata}
\fontspec[AutoFakeSlant]{Inconsolata}
\fontspec[AutoFakeBold]{Inconsolata}
\fontspec[AutoFakeSlant,AutoFakeBold]
         {Inconsolata}
\fontspec[AutoFakeSlant=0.4]{Inconsolata}
\fontspec[AutoFakeBold=5]{Inconsolata}
\fontspec[AutoFakeSlant=0.4,AutoFakeBold=5]
         {Inconsolata}
\end{document}

Result with $latex/lualatex/xelatex fontspec1.tex

This is XeTeXk, Version 3.1415926-2.2-0.999.6 (Web2C 7.5.7)
 %&-line parsing enabled.
entering extended mode
(./fontspec1.tex
LaTeX2e <2005/12/01>
Babel <v3.8l> and hyphenation patterns for english, usenglishmax, dumylang, noh
yphenation, german-x-2008-06-18, ngerman-x-2008-06-18, ancientgreek, ibycus, ar
abic, basque, bulgarian, catalan, pinyin, coptic, croatian, czech, danish, dutc
h, esperanto, estonian, farsi, finnish, french, galician, german, ngerman, mono
greek, greek, hungarian, icelandic, indonesian, interlingua, irish, italian, la
tin, mongolian, mongolian2a, bokmal, nynorsk, polish, portuguese, romanian, rus
sian, sanskrit, serbian, slovak, slovenian, spanish, swedish, turkish, ukenglis
h, ukrainian, uppersorbian, welsh, loaded.>

! LaTeX Error: File `testsuite.cls' not found.

Type X to quit or <RETURN> to proceed,
or enter new name. (Default extension: cls)

Enter file name:

(./fontspec.sty (/usr/share/texmf/tex/latex/expl3/expl3.sty
(/usr/share/texmf/tex/latex/expl3/l3names.sty)
(/usr/share/texmf/tex/latex/etex-pkg/etex.sty)
(/usr/share/texmf/tex/latex/expl3/l3basics.sty)
(/usr/share/texmf/tex/latex/expl3/l3expan.sty)
(/usr/share/texmf/tex/latex/expl3/l3tl.sty)
(/usr/share/texmf/tex/latex/expl3/l3intexpr.sty)
(/usr/share/texmf/tex/latex/expl3/l3quark.sty)
(/usr/share/texmf/tex/latex/expl3/l3seq.sty
! Undefined control sequence.
l.129 \int_new:N
                 \g_seq_nesting_depth_int
?

Please, may you tell me what is the problem here?

share|improve this question
1  
Your question has severe formatting problems (code/pre mixup). Please fix them. –  Martin Schröder Aug 5 '12 at 17:45
    
Welcome to TeX.sx! A tip: If you indent lines by 4 spaces, they'll be marked as a code sample. You can also highlight the code and click the "code" button (with "{}" on it). This works much better than <pre> here :-) –  Joseph Wright Aug 5 '12 at 17:55
2  
Also, don't call your file 'fontspec.tex' when you are using the fontspec package. –  jon Aug 5 '12 at 18:26
1  
@jon You should be okay here, but you are quite right that there are some packages where this could be a disaster. –  Joseph Wright Aug 5 '12 at 18:31
3  
@jon Yes, that would be one. It happens where you have a foo.sty which loads 'payload' foo.tex. Often seen with packages that work with plain TeX as well as with LaTeX. –  Joseph Wright Aug 5 '12 at 18:35
show 1 more comment

1 Answer

Your TeX installation is too old to use fontspec. You need at least XeTeX 0.9994 or LuaTeX 0.40, as detailed in the LaTeX3 README and other documentation. You will need to install more up to date binaries, which realistically means an updated TeX Live (I see you are on Unix).

share|improve this answer
1  
In particular, LuaTeX has changed a lot since v0.25. Currently, we are on the v0.70 branch, and there have been a lot of changes to the Lua side. –  Joseph Wright Aug 5 '12 at 18:25
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.