8

I am just starting to use LuaLaTeX. Mainly because I want to use a ttf font for a presentation. My MWE looks like

\documentclass{article}

\usepackage{fontspec}

\setmainfont[]{HelveticaNeue/HelveticaNeueLTCom-Th.ttf}

\begin{document}
Test
\end{document}

I have a folder called HelveticaNeue in the same folder as the MWE file. The folder consists of many versions of the famous font Helvetica Neue. The content looks like

HelveticaNeueLTCom-Bd.ttf   
HelveticaNeueLTCom-BdCn.ttf 
HelveticaNeueLTCom-BdCnO.ttf    
HelveticaNeueLTCom-BdEx.ttf 
HelveticaNeueLTCom-BdExO.ttf    
HelveticaNeueLTCom-BdIt.ttf 
HelveticaNeueLTCom-BdOu.ttf 
HelveticaNeueLTCom-Blk.ttf  
HelveticaNeueLTCom-BlkCn.ttf    
HelveticaNeueLTCom-BlkCnO.ttf   
HelveticaNeueLTCom-BlkEx.ttf    
HelveticaNeueLTCom-BlkExO.ttf   
HelveticaNeueLTCom-BlkIt.ttf    
HelveticaNeueLTCom-Cn.ttf   
HelveticaNeueLTCom-CnO.ttf  
HelveticaNeueLTCom-Ex.ttf   
HelveticaNeueLTCom-ExO.ttf  
HelveticaNeueLTCom-Hv.ttf   
HelveticaNeueLTCom-HvCn.ttf 
HelveticaNeueLTCom-HvCnO.ttf    
HelveticaNeueLTCom-HvEx.ttf 
HelveticaNeueLTCom-HvExO.ttf    
HelveticaNeueLTCom-HvIt.ttf 
HelveticaNeueLTCom-It.ttf   
HelveticaNeueLTCom-Lt.ttf   
HelveticaNeueLTCom-LtCn.ttf 
HelveticaNeueLTCom-LtCnO.ttf    
HelveticaNeueLTCom-LtEx.ttf 
HelveticaNeueLTCom-LtExO.ttf    
HelveticaNeueLTCom-LtIt.ttf 
HelveticaNeueLTCom-Md.ttf   
HelveticaNeueLTCom-MdCn.ttf 
HelveticaNeueLTCom-MdCnO.ttf    
HelveticaNeueLTCom-MdEx.ttf 
HelveticaNeueLTCom-MdExO.ttf    
HelveticaNeueLTCom-MdIt.ttf 
HelveticaNeueLTCom-Roman.ttf    
HelveticaNeueLTCom-Th.ttf   
HelveticaNeueLTCom-ThCn.ttf 
HelveticaNeueLTCom-ThCnO.ttf    
HelveticaNeueLTCom-ThEx.ttf 
HelveticaNeueLTCom-ThExO.ttf    
HelveticaNeueLTCom-ThIt.ttf 
HelveticaNeueLTCom-UltLt.ttf    
HelveticaNeueLTCom-UltLtCn.ttf  
HelveticaNeueLTCom-UltLtCnO.ttf 
HelveticaNeueLTCom-UltLtEx.ttf  
HelveticaNeueLTCom-UltLtExO.ttf 
HelveticaNeueLTCom-UltLtIt.ttf  
HelveticaNeueLTCom-XBlkCn.ttf   
HelveticaNeueLTCom-XBlkCnO.ttf

I compile the file using (Windows 7, LuaTeX version 0.76.0-2013062820, rev 4627) lualatex filename. I receive an error;

error

I added a screenshot because the error does not exist in the log file.

An additional question would be how to use the different font features like small caps, italic, bold and so on. I have seen that you can define it like here:

\setmainfont[
    BoldFont       = Fontname-Bold,
    ItalicFont     = Fontname-Italic,
    BoldItalicFont = Fontname-BoldItalic
]{Fontname}

but I did not find small caps in the ttf font files.


Update

Following Herbert's advice, I added all the ttf font files into my Windows font folder (now I can use them in Word and so on). This look like

font-placement

Then I changed the MWE accordingly:

\documentclass{article}

\usepackage{fontspec}

%\setmainfont[]{HelveticaNeue/HelveticaNeueLTCom-Th.ttf}
\setmainfont[]{Helvetica Neue LT Com 23}

\begin{document}
Test
\end{document}

and receive this error message:

new-error

Following Mico's advice (placing the ttf file in the same folder as the MWE file) works. I do not understand why and I wonder how to use bold, small caps and so on. Do I have to define all manually?

test


2nd Update

After double clicking on a font file I saw the "real" name. Using this name works with system fonts;

\setmainfont[]{HelveticaNeueLT Com 35 Th}

system-fonts

  • 1
    Did you activate the fonts in a way that's appropriate for a Windows system? Barring that, does the compilation succeed if you place the tex file in the same directory as the font files? The "Th" part in the font name would appear to point to the "thin" font version, aka weight "35", right? – Mico Jan 25 '14 at 16:05
  • 1
    The Helvetica Neue font family is a "superfamily" which provides (i) 2 shapes: upright and italic; (ii) 9 weights: ultralight, thin, light, roman (closest to ordinary "regular"), medium, bold (closest to ordinary "bold"), heavy, black, and extra black; (iii) 3 spacing options: regular, condensed, and extended. You will probably need to load the regular, condensed, and extended subfamilies as separate font groups via fontspec's mechanisms. fontspec will otherwise be overwhelmed. You may also need to be a bit selective about font weights: Do you really need nine weights in one documeht? – Mico Jan 25 '14 at 16:22
  • 1
    Double click on one of the font files and you'll see the font name. I don't know if Windows knows the command otfinfo -i <file.ttf|otf> which displays the font name of <file>.ttf|otf. – user2478 Jan 25 '14 at 16:22
  • Hello Mico. I do not need nine weights. But I will need bold, italic and small caps of only one weight. Sorry if I confused you. Apparently there are no small caps in my collection. – Dr. Manuel Kuehner Jan 25 '14 at 16:41
8

put the font files into your system font directory and then use

\documentclass{article}
\usepackage{fontspec}
\setmainfont{Helvetica Neue}
\begin{document}
Test \textbf{Test} \textit{Test}
\end{document}

The document has the fonts included:

voss@shania:~> pdffonts Test/test7.pdf
name                        type          encoding     emb sub uni object ID
--------------------------- ------------- ------------ --- --- --- ---------
NZAOYG+HelveticaNeue        CID Type 0C   Identity-H   yes yes yes      4  0
WLHJWU+HelveticaNeue-Bold   CID Type 0C   Identity-H   yes yes yes      5  0
PRPRRI+HelveticaNeue-Italic CID Type 0C   Identity-H   yes yes yes      6  0

Maybe that your version of Helvetica has another name, then change it in the example.

Here is the info from your HelveticaNeueLTCom-Lt.ttf:

voss@shania:~/Fonts/Helvetica/ttf> otfinfo -i HelveticaNeueLTCom-Lt.ttf 
Family:              HelveticaNeueLT Com 45 Lt
Subfamily:           Regular
Full name:           Helvetica Neue LT Com 45 Light
PostScript name:     HelveticaNeueLTCom-Lt
Preferred family:    Helvetica Neue LT Com
Preferred subfamily: 45 Light
Mac font menu name:  HelveticaNeueLT Com 45 Lt
Version:             Version 2.01;2006
Unique ID:           Linotype GmbH:Helvetica Neue LT Com 45 Light:2006
Description:         Helvetica is one of the most famous and popular typefaces in the world. It lends an air of lucid efficiency to any typog

Here is a setting for your fonts:

\setmainfont[
  BoldFont=HelveticaNeueLTCom-Md,
  ItalicFont=HelveticaNeueLTCom-LtIt,
]{HelveticaNeueLTCom-Lt}

with the output:

enter image description here

for a small caps font use:

  SmallCapsFont=TeXGyre Heros,
  SmallCapsFeatures={Letters=SmallCaps},
  • Thanks! There are no small caps available apparently. So I have to use false/fake/ugly small caps? – Dr. Manuel Kuehner Jan 25 '14 at 16:45
  • 1
    see my edit ... – user2478 Jan 25 '14 at 17:08
  • Herbert -- allow me one last question. Eventually I want to use the stuff in a beamer presentation. What math/roman font (for variables like $a^2 + b^2 = c^2$) would fit visually? – Dr. Manuel Kuehner Jan 25 '14 at 17:21
  • 1
    Latin Modern Math Roman – user2478 Jan 25 '14 at 17:30
5

The command \setmainfont of the fontspec package is, AFAICT, designed primarily to deal with font families that have no more than four members: regular, italic, bold, and bold-italic; fortunately, many font families are set up in this way. There are, however, some font superfamilies that have many more members, differentiated by weight -- e.g., Helvetica Neue features not just two but nine [!] weights: ultralight, thin, light, roman, medium, bold, heavy, black, and extra black -- spacing ("condensed" and "extended" subfamilies to go along with the "regular" subfamily), and (of course) shape (upright and italic/oblique). There used to be (and they still exist...) font families that featured "Expert font" files for features such as small caps and oldstyle numbers; for fonts released in the modern OpenType format, these expert features, if available at all, are nowadays generally included in the main font files.)

The font selection mechanisms provided by the fontspec package are going to be overwhelmed when confronted with such superfamilies. Without explicit guidance provided by the user, the likelihood that the "correct" medium and bold weights will be chosen must be low. Clearly, the choices one has to make from among the members of the superfamily are far more complex than when one has to choose fonts for a basic book or article.

Using the \newfontfamily directive, you can probably come up with about two dozen "regular-sized" font families that will suit most of your typesetting needs.

  • A rule of thumb among sans-serif superfonts (which you should take merely as a starting point, not some law of nature!) is that "basic" and "bold" weights should be separated by 20 or 30 "units" but not 40 units or more. [In case you're not sure what's going on, the UltraLights are sometimes termed the 20s, thins are 30s, lights are 40, etc., up to black being in the 90s and extra black in the 100s.]

  • A second rule of thumb is that it's not wise to mix-and-match condensed, regular, and extended characters in close proximity. Of course, depending on your typesetting needs, you may want to experiment with ignoring this rule of thumb too!

Using these rules of thumb as a starting point, you might try setting up the following font families:

\newfontfamily\NHBasic[%%basic weight: 50, "bold" weight: 70
   Extension      = .ttf,
   ItalicFont     = HelveticaNeueLTCom-It,
   BoldFont       = HelveticaNeueLTCom-Bd,
   BoldItalicFont = HelveticaNeueLTCom-BdIt]
  {HelveticaNeueLTCom-Roman}

\newfontfamily\NHBasicCn[%%basic weight: 50, "bold" weight: 70
   Extension      = .ttf,
   ItalicFont     = HelveticaNeueLTCom-CnO,
   BoldFont       = HelveticaNeueLTCom-BdCn,
   BoldItalicFont = HelveticaNeueLTCom-BdCnO]
  {HelveticaNeueLTCom-Cn}

\newfontfamily\NHBasicEx[%%basic weight: 50, "bold" weight: 70
   Extension      = .ttf,
   ItalicFont     = HelveticaNeueLTCom-ExO,
   BoldFont       = HelveticaNeueLTCom-BdEx,
   BoldItalicFont = HelveticaNeueLTCom-BdExO]
  {HelveticaNeueLTCom-Ex}

\newfontfamily\NHUltra[%%basic weight: 20, "bold" weight: 40
   Extension      = .ttf,
   ItalicFont     = HelveticaNeueLTCom-UltLtIt,
   BoldFont       = HelveticaNeueLTCom-Lt,
   BoldItalicFont = HelveticaNeueLTCom-LtIt]
  {HelveticaNeueLTCom-UltLt}

\newfontfamily\NHUltraEx[%%basic weight: 20, "bold" weight: 40
   Extension      = .ttf,
   ItalicFont     = HelveticaNeueLTCom-UltLtExO,
   BoldFont       = HelveticaNeueLTCom-LtEx,
   BoldItalicFont = HelveticaNeueLTCom-LtExO]
  {HelveticaNeueLTCom-UltLtEx}

\newfontfamily\NHUltraCn[%%basic weight: 20, "bold" weight: 40
   Extension      = .ttf,
   ItalicFont     = HelveticaNeueLTCom-UltLtCnO,
   BoldFont       = HelveticaNeueLTCom-ThCn,
   BoldItalicFont = HelveticaNeueLTCom-ThCnO]
  {HelveticaNeueLTCom-UltLtCn}

\newfontfamily\NHThin[%%basic weight: 30, "bold" weight: 50
   Extension      = .ttf,
   ItalicFont     = HelveticaNeueLTCom-ThIt,
   BoldFont       = HelveticaNeueLTCom-Roman,
   BoldItalicFont = HelveticaNeueLTCom-It]
  {HelveticaNeueLTCom-Th}

\newfontfamily\NHThinEx[%%basic weight: 30, "bold" weight: 50
   Extension      = .ttf,
   ItalicFont     = HelveticaNeueLTCom-ThExO,
   BoldFont       = HelveticaNeueLTCom-Ex,
   BoldItalicFont = HelveticaNeueLTCom-ExO]
  {HelveticaNeueLTCom-ThEx}


\newfontfamily\NHThinCn[%%basic weight: 30, "bold" weight: 50
   ItalicFont     = HelveticaNeueLTCom-ThCnO,
   BoldFont       = HelveticaNeueLTCom-Cn,
   BoldItalicFont = HelveticaNeueLTCom-CnO]
  {HelveticaNeueLTCom-ThCn}

\newfontfamily\NHLight[%%basic weight: 40, "bold" weight: 60
   ItalicFont     = HelveticaNeueLTCom-LtIt,
   BoldFont       = HelveticaNeueLTCom-Md,
   BoldItalicFont = HelveticaNeueLTCom-MdIt]
  {HelveticaNeueLTCom-Lt}

\newfontfamily\NHLightEx[%%basic weight: 40, "bold" weight: 60
   ItalicFont     = HelveticaNeueLTCom-LtExO,
   BoldFont       = HelveticaNeueLTCom-MdEx,
   BoldItalicFont = HelveticaNeueLTCom-MdExO]
  {HelveticaNeueLTCom-LtEx}

\newfontfamily\NHLightCn[%%basic weight: 40, "bold" weight: 60
   ItalicFont     = HelveticaNeueLTCom-LtCnO,
   BoldFont       = HelveticaNeueLTCom-MdCn,
   BoldItalicFont = HelveticaNeueLTCom-MdCnO]
  {HelveticaNeueLTCom-LtCn}

To start off something in the "Basic" font, you'd issue the command \NHBasic, to switch to Ultralight-Condensed, you'd issue the instruction \NHUltraCn, etc.

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.