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, how can I use a font that I have downloaded in a folder, but have not installed on my system? I have tried to specify the path in setmainfont{Path = C:/MyFolder/MyFonts/, but I receive the error message fontspec error: "font-not-found"

Based on what I have found googling, I have tried these options, but they all give the same error message:

\setmainfont{Path = C:/MyFolder/MyFonts/}{LinLibertine_Rah.ttf}
\setmainfont{Path = C:/MyFolder/MyFonts/LinLibertine_Rah.ttf}
\setmainfont{Path = C:/MyFolder/MyFonts/}{LinLibertine}
\setmainfont{Path = C:/MyFolder/MyFonts/LinLibertine}
\setmainfont{Path = C:/MyFolder/MyFonts/}{Linux Libertine}
\setmainfont{Path = C:/MyFolder/MyFonts/Linux Libertine}
\setmainfont[Path = C:/MyFolder/MyFonts/]{LinLibertine_Rah.ttf}
\setmainfont[Path = C:/MyFolder/MyFonts/LinLibertine_Rah.ttf]
\setmainfont[Path = C:/MyFolder/MyFonts/]{LinLibertine}
\setmainfont[Path = C:/MyFolder/MyFonts/LinLibertine]
\setmainfont[Path = C:/MyFolder/MyFonts/]{Linux Libertine}
\setmainfont[Path = C:/MyFolder/MyFonts/Linux Libertine]
share|improve this question
Shouldn't path in Windows be using backslashes as directory delimiters? Should it be C:\MyFolder\Myfonts\ ? – ArTourter Jul 18 '12 at 21:56
I tried (on win xp with miktex 2.9.) \setmainfont[Path = J:/Install/Schriften/]{Inconsolata.otf} and the font was found. Are your folders really called "MyFolder" and "MyFonts" or do the real names contain things like space or unusual chars which could lead to problems? – Ulrike Fischer Jul 19 '12 at 9:16
I've stopped using spaces in names of folders and files, and replaced them with underscores. It turns out that was what XeTeX couldn't read. Once I removed the underscores, it worked. – Sverre Jul 19 '12 at 14:15
@Sverre: Don't edit the answer into the question. Leave the original question and add the answer with the "Your answer" form below. Answering your own questions is explicitly encouraged. – Caramdir Jul 19 '12 at 15:53
@ArTourter: For many years, Windows accepts paths with /. – Paul Gaborit Jul 19 '12 at 20:00
up vote 7 down vote accepted

Based on the comments and suggestions I received, I'm providing the solution here.

\setmainfont[   Path              = C:/MyStuff/Fonts/LinLibertineTTF/,
                Extension         = .ttf,
                BoldFont          = LinLibertine_RBah,
                ItalicFont        = LinLibertine_RIah,
                BoldItalicFont    = LinLibertine_RBIah,
                SmallCapsFeatures = {Letters = SmallCaps},
                Numbers           = OldStyle

Avoid spaces and underscores in your path.

share|improve this answer

Did you try to change the first set of curly brackets to square brackets? That is:


See Fontspec documentation v2.2b, pp. 7–8.

share|improve this answer
I've tried it now - and added the attempts to my question. – Sverre Jul 18 '12 at 20:51
@Sverre It may be that fontspec does not parse windows-like path specifications. The following example works on my linux box. \documentclass{article} \usepackage{fontspec} \defaultfontfeatures{Mapping=tex-text} \setmainfont[ExternalLocation=./randomFolder/]{ZnikomitNo24} \begin{document} Text. \end{document} – Ekin Jul 18 '12 at 21:12
@Sverre I agree with Ekin. Presumably if you have a file at C:/MyFolder/MyFonts/LinLibertine_Rah.ttf then your (currently) 7th example should have worked. Your other attempts are largely gibberish. – Will Robertson Jul 19 '12 at 5:42

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.