[Tex/LaTex] Making a new font family based on the default font

fontsfontspecmacxetex

I'm running XeLaTeX on a Mac, and I'm getting into a lot of trouble with finding fonts.

Here's my code (taken from here: Revisiting TIPA and Fontspec)

\documentclass[12pt]{article}

\usepackage{environ}
\usepackage[no-math]{fontspec}

\newfontfamily{\tipacm}{CMU Serif}

\NewEnviron{IPA}{\expandafter\textipa\expandafter{\BODY}}
\renewcommand\useTIPAfont{\tipacm}

\begin{document}

\normalfont
\textipa{k\textscripta T\'{a}}
\textipa{kAT\'{a}}
\begin{IPA}
  kAT\'{a}
\end{IPA}

\end{document}

Whenever I run it, I get the "font-not-found" error. when I search the fc-list for anything that looks like "computer modern" or any variant or abbreviation of that, I find nothing.

But obviously, my computer does have Computer Modern installed, since it's making these default pdfs fine. I would like to be able to make a new font family (e.g. \newfontfamily{\tipacm}) with the default font? If it's using a font to make a pdf, shouldn't I be able to make a renamed copy of it without having to load something externally? In essence, I'd like to make a new font family without having to load anything dependent on file paths.

Theoretically, I'd like something like: \newfontfamily{\tipacm}{\currentdefaultfontfamily}

Best Answer

The best is if you install CMU also in the /Library/Fonts folder. Otherwise, you can get the same with a slightly more complicated code:

\documentclass[12pt]{article}

\usepackage{environ}
\usepackage[no-math]{fontspec}

\newfontfamily{\tipacm}[
  Extension=.otf,
  UprightFont=*rm,
  %ItalicFont=*ti,% no IPA here
  BoldFont=*bx,
  %BoldItalicFont=*bi,% no IPA here
]
{cmun}

\NewEnviron{IPA}{%
  \expandafter\textipa\expandafter{\BODY}%
}
\renewcommand\useTIPAfont{\tipacm}

\begin{document}

\normalfont
\textipa{k\textscripta T\'{a}}
\textipa{kAT\'{a}}
\begin{IPA}
  kAT\'{a}
\end{IPA}

\textbf{\textipa{A}}

\end{document}

enter image description here

In order to install the font also for the system, open a new Finder window, hit Command-Shift-G and type, in the box that opens,

/usr/local/texlive/2015/texmf-dist/fonts/opentype

Open another Finder window and to the same for /Library/Fonts. Now copy the folder cm-unicode from the first window to the second one.

Related Question