36

I have installed an open-type font on my OS and would like to use in a LaTeX document using XeLaTeX.

It works fine, but when I define my font family like this:

\ifxetex
  \newfontfamily{\neosans}{NeoSans} 
\else
\fi

When I then use \selectfont\neosansit just selects the Regular version of that font. However, I would like to use the Light version!

Even if I write \newfontfamily{\neosans}{NeoSans-Light} or \newfontfamily{\neosans}{NeoSans Light} it still chooses the Regular version.

The specifications of the font I would like to use looks as follows (in Danish, though):

Link to image

My question is

How do use the Light version of the font?

2 Answers 2

32

I don't have NeoSans, but experimented with another font:

\documentclass{article}
\usepackage{fontspec}
\newfontfamily{\os}{Open Sans}
\newfontfamily{\osl}[UprightFont={* Light}]{Open Sans}
\begin{document}
{Normal: \os Open Sans\par}
{Light: \osl Open Sans Light\par}
\end{document}

You see that the second line indeed chooses the light version.

enter image description here

Notice that \selectfont is not needed (and does nothing).

In your case you probably want to also change the italic and bold version:

\newfontfamily{\neosans}
  [Ligatures=TeX, % recommended
   UprightFont={* Light},
   ItalicFont={* Light Italic},
   BoldFont={* Medium},
   BoldItalicFont={* Medium Italic}]
  {NeoSans}

If you want that NeoSans is used as the standard sans serif font, then instead of \newfontfamily{\neosans} write \setsansfont:

\setsansfont
  [Ligatures=TeX, % recommended
   UprightFont={* Light},
   ItalicFont={* Light Italic},
   BoldFont={* Medium},
   BoldItalicFont={* Medium Italic}]
  {NeoSans}
0
9

A lot of people will recommend against mixing multiple weights of the same font in the same document, but LaTeX does standardize font series names for Light ({l}), as well as {el}, {ul}, {sb}, {eb} and {ub}.

So, this alternative might (I haven’t tested it) make all the styles in your screenshot available as part of the same family.

\newfontfamily\neosans{NeoSans}[
  % Ligatures = ..., etc.
  UprightFont = *-Regular ,
  ItalicFont = *-Italic ,
  BoldFont = *-Bold ,
  BoldItalicFont = *-BoldItalic ,
  FontFace = {l}{n}{*-Light},
  FontFace = {l}{it}{*-LightItalic},
  FontFace = {sb}{n}{*-Medium},
  FontFace = {sb}{it}{*-MediumItalic},
  FontFace = {eb}{n}{*-Black},
  FontFace = {eb}{it}{*-BlackItalic},
  Extention = .otf ]

This assumes that a font with PostScript outlines that you’re loading with fontspec has an *.otf extension.

The standard LaTeX command to select a weight other than regular or bold is, e.g., \fontseries{eb}\selectfont. For convenience and compatibility with a few other packages, you might define commands like the following:

\DeclareRobustCommand{\sbseries}{\fontseries{sb}\selectfont}
\DeclareTextFontCommand{\textsb}{\sbseries}
\DeclareRobustCommand{\ebseries}{\fontseries{eb}\selectfont}
\DeclareTextFontCommand{\texteb}{\ebseries}
\DeclareRobustCommand{\ltseries}{\fontseries{l}\selectfont}
\DeclareTextFontCommand{\textlt}{\ltseries}

This allows you to write \ltseries as you would \bfseries, or \texteb{foo} like you would \textmd{foo}.

You must log in to answer this question.

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