TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Using XeLaTeX and the fontspec package, I am experiencing problems using fonts whose name includes the space character. Here is a simple example:

\setmainfont{Times New Roman}

gives, upon xelatex the error:

kpathsea: Invalid fontname `Times New Roman', contains ' '

I have used this font before and previously working examples ceased to work when I re-installed my operating system (Ubuntu 11.04) and TeXlive2011.

share|improve this question
This error usually arises when fontspec fails to find the font at all. Are you sure that the font is available still on your system? (Can you use it a regular application like Open Office?) – Alan Munn Feb 1 '12 at 4:11
The font is indeed missing on OpenOffice. The error message is quite misleading. – Yossi Gil Feb 1 '12 at 5:40
On my system, fontspec gives a very helpful error right after the error you mention. Maybe you're not seeing the whole thing. It clearly says fontspec error: "font-not-found" (etc.) – Alan Munn Feb 1 '12 at 5:43
I've turned my comments into an answer. – Alan Munn Feb 1 '12 at 5:49
@alfC Sometimes fonts in linux don't get registered and you need to load them using the filename. See Figuring out Xetex fonts under Debian perhaps? – Alan Munn Sep 10 '15 at 20:57
up vote 7 down vote accepted

The error you are seeing usually arises when fontspec can't find the font at all. It is usually accompanied by the following more helpful error generated by fontspec itself:

kpathsea: Invalid fontname `A Funny Font', contains ' '

./kpathsea-test.tex:4: fontspec error: "font-not-found"
! The font "A Funny Font" cannot be found.
! See the fontspec documentation for further information.
! For immediate help type H <return>.

l.4 \setmainfont{A Funny Font}

Maybe your editing environment is hiding some of the console output from you.

Any font that is usable on your system in a regular application (e.g. Open Office) should be found by fontspec. So you should check to see if "Times New Roman" is actually available on your system after your OS update.

share|improve this answer

Your Answer


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.