0

I'm trying to use specific fonts in my LaTeX file. But fontspec can't find my desired fonts. I use

family file | grep -i helvetica

to know the names to use in XeTeX using fontspec

/usr/local/share/fonts/HelveticaNeueLTPro-UltLtIt.otf: Helvetica Neue LT Pro,HelveticaNeueLT Pro 25 UltLt
/usr/local/share/fonts/HelveticaNeueLTPro-BdCn.otf: Helvetica Neue LT Pro,HelveticaNeueLT Pro 57 Cn
/usr/local/share/fonts/HelveticaNeueLTPro-Lt.otf: Helvetica Neue LT Pro,HelveticaNeueLT Pro 45 Lt

My .cls part that needs specific fonts is

\RequirePackage[quiet]{fontspec}
\RequirePackage[math-style=TeX,vargreek-shape=unicode]{unicode-math}

\setmathfont{Latin Modern Math}

\newfontfamily\bodyfont[]{HelveticaNeueLT Pro 45 Lt}
\newfontfamily\thinfont[]{HelveticaNeueLT Pro 25 UltLt}
\newfontfamily\headingfont[]{HelveticaNeueLT Pro 57 Cn}

\defaultfontfeatures{Mapping=tex-text}
\setmainfont[Mapping=tex-text, Color=textcolor]{HelveticaNeueLT Pro 45 Lt}

But fontspec gives errors all the time!

7
  • Welcome to TeX.SX! We can't help you unless you tell us specifically what errors you're getting.
    – ChrisS
    Commented Aug 19, 2013 at 23:37
  • And perhaps a minimal working example (MWE). Note that, if these lines are indeed the problem, you can copy them into such a minimal file with no issues. Commented Aug 19, 2013 at 23:48
  • The error is "font-not-found". The font "HelveticaNeueLT Pro 45 Lt" cannot be found.
    – GSchimiti
    Commented Aug 19, 2013 at 23:53
  • 2
    Did you tried the file name without extension? E.g. HelveticaNeueLTPro-Lt.
    – Tobi
    Commented Aug 20, 2013 at 0:26
  • 1
    Wow! Works perfect.. Problem solved! Thanks!
    – GSchimiti
    Commented Aug 20, 2013 at 0:41

2 Answers 2

4

You need to use the PostScript name, usually it's the same as the filename sans extension, but not always --- use a font information utility to determine what it is:

\documentclass{minimal}
\RequirePackage[quiet]{fontspec}
\RequirePackage[math-style=TeX,vargreek-shape=unicode]{unicode-math}
\begin{document}
\newfontfamily\bodyfont[]{HelveticaNeueLTStd-Lt}
\newfontfamily\thinfont[]{HelveticaNeueLTStd-UltLt}
\newfontfamily\headingfont[]{HelveticaNeueLTStd-Cn}
\defaultfontfeatures{Mapping=tex-text}
\setmainfont[Mapping=tex-text, Color=textcolor]{HelveticaNeueLTStd-Lt}
Main. \bodyfont (bodyfont is same as main)\par
\thinfont Thin.\par
\headingfont Headingfont is condensed.
\end{document}
1
3

You can use the file name instead of the font name, e.g. for Helvetica Neue LT Pro-Lt 45 Lt.

\setmainfont[Mapping=tex-text, Color=textcolor]{HelveticaNeueLTPro-Lt}
1
  • 2
    With Ligatures=TeX instead of Mapping=tex-text, the call is compatible with LuaLaTeX.
    – egreg
    Commented Aug 20, 2013 at 9:34

You must log in to answer this question.

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