最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

xelatex - How to let LaTeX look for a font's .fonspec in a specific directory? - Stack Overflow

programmeradmin2浏览0评论

I am a novice at LaTeX and I got a problem about using font.

Problem

My LaTeX workspace structure is like the following (case sensitive):

root
├── main.tex
├── class.cls
└── font
    ├── aaa.fontspec
    └── AAA-Roman.ttf

In class.cls I declared a new class based on the article class, specified the location of .fontspec and set the font:

\defaultfontfeatures{
    Path = ./font/,
    Extension = .fontspec
}
\setmonofont{AAA}

The content of aaa.fontspec is:

\defaultfontfeatures[AAA]
{
    Extension = .ttf,
    UprightFont = *-Roman
}

The main.tex then invoke the newly defined class as document class.

I use XeLaTeX for compilation. I suppose it will find the font in a way like \setmonofont{AAA} -> font/aaa.fontspec -> AAA.ttf but it failed with the error Package fontspec Error: The font "AAA" cannot be found.

Originally the aaa.fontspec was under the root directory and the .cls file does not have \defaultfontfeatures, everything worked just fine.

Question

  • What is the correct command to let LaTeX look for a fontspec in a specific directory?
发布评论

评论列表(0)

  1. 暂无评论