4

I have a document with a structure:

+-- main.tex
+-- style.sty
+-- fonts
|   +-- times.tff
+-- sections
|   +-- section1.tex
|   +-- section2.tex

Main file main.tex includes section files via subfiles package.

Now I want to use my "times.tff" font in the document. So I include this part to my style:

\usepackage{fontspec}
\setromanfont[Path=fonts/]{times.ttf}

And everything is working well, but only if I compile document from the main. If I want to compile only section 1, then I get an error: fontspec error: "font-not-found". This is because font path for section 1 will be different from the main.

How can I set the path so that I could compile from the sections?

4

save the font file into your systems font directory or in TeX's font directory: TEXMF/fonts/truetype/ For the latter run texhash of update the file name data base for a MikTeX distribution. Then you do not need to specify a path.

  • Thanks for your reply. Unfortunately it is not possible to install a font in any folders other than given. – Serbin Feb 12 '16 at 18:46
  • 2
    You have at least a home (user) directory where you can create a texmf directory and then create `fonts/truetype/times.ttf`` – user2478 Feb 12 '16 at 18:51
1

On a Unix-like system (all I know) you could create symlinks "fonts" to the top level "fonts/" repertory which is referred to by the main document. This could work. Untested due to absence of MWE.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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