3

I want to add some custom font into my latex build process in macOS 13.3, this is the command I am using right now:

\setmainfont[
    Path = { /Users/xiaoqiangjiang/.fonts/ },
  Extension = .otf ,
  BoldFont = HelveticaNeueLTPro-Md.otf ,
]{HelveticaNeueLTPro-Roman.otf}

when I using the full path like this /Users/xiaoqiangjiang/.fonts/, it works fine. But when I replace the path to ~/.fonts/, the texstudio shows could not found the fonts. Does the setmainfont command path support the ~? what should I do to fixed this issue?

2
  • why I replace the user path with ~, the xelatex could not found the fonts when compile?
    – Dolphin
    Commented Jun 15, 2023 at 13:25
  • 3
    sorry I meant no, you can't use ~. Install the fonts so that your system can find them, then xelatex and lualatex will find them too. Commented Jun 15, 2023 at 13:27

1 Answer 1

3

No, you can't use ~ for home, but you can use \string~.

\documentclass{article}
\usepackage{fontspec}

\newfontface{\fell}{IMFePIit29C}[
  Path=\string~/provaccia/conf-1.7b/fell/,
  Extension=.otf,
]

\begin{document}

{\fell Hello}

\end{document}

I found a rarely used font in some working directory. Here's the console output about the font (username masked), with LuaLaTeX

</Users/*******/provaccia/conf-1.7b/fell/IMFePIit29C.otf>

So you see it works. I also tested XeLaTeX with success.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .