[Tex/LaTex] XITS font not found

xetex

I am running a recently updated TeX Live 2011 on a Mac (OS X 10.7 Lion). I wanted to use the XITS fonts, but the following file generates errors when processed with xelatex:

\documentclass{article}
\usepackage{unicode-math} 
\setmainfont{XITS} 
\setmathfont{XITS Math}
\begin{document}
Text $x+y=\sqrt{z}$
\end{document}

I'm including the relevant (I think) output below. Any ideas what is going on?

kpathsea: Running mktextfm XITS
/usr/local/texlive/2011/texmf/web2c/mktexnam: Could not map source abbreviation X for XITS.
/usr/local/texlive/2011/texmf/web2c/mktexnam: Need to update /usr/local/texlive/2011/texmf-dist/fonts/map/fontname/special.map?
mktextfm: Running mf-nowin -progname=mf \mode:=ljfour; mag:=1; nonstopmode; input XITS
This is METAFONT, Version 2.718281 (TeX Live 2011)


kpathsea: Running mktexmf XITS
! I can't find file `XITS'.

Best Answer

Fonts bundled with TeXLive are not usually made available to system, font services and XeTeX can’t locate fonts in TeX tree by font name (LuaTeX based packages does, though). So you need to either install TeX fonts system wide (check TeXLive documentation, though not sure with works for Mac), or access fonts by file name:

\documentclass{article}
\usepackage{fontspec}
\usepackage{unicode-math}

\setmainfont{XITS}
[    Extension = .otf,
   UprightFont = *-Regular,
      BoldFont = *-Bold,
    ItalicFont = *-Italic,
BoldItalicFont = *-BoldItalic,
]
\setmathfont{XITSMath-Regular}
[    Extension = .otf,
      BoldFont = XITSMath-Bold,
]

\begin{document}
Text $x+y=\sqrt{z}$ \boldmath $x+y=\sqrt{z}$
\end{document}