# Slanted font with TIPA in XeLaTeX

I am writing a linguistics paper relying heavily on tipa for phonetic transcription. Sometimes the transcriptions are upright for transcriptions, and sometimes slanted for examples. This is no problem in pdfLatex.

However, I wanted to explore the possibility of changing the font of both the normal text and the IPA, so I tried switching to XeLaTeX but I cannot get the slanted phonetic text to work.

This works well in pdfLaTeX, but the slanted text does not work with XeLaTeX and with fontspec instead appears upright:

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{tipa}

\begin{document}

This is a text with a \textipa{[f@"nERIk]} transcription and
\textipa{\textsl{slænt@d}} text for in-text use. I also use \textsc{small
caps} a lot.

\end{document}


If I switch the font to Times using \usepackage{times} without fontspec it also works. But as soon as I add fontspec the slanted text appears upright. Here is an example:

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{tipa}
\DeclareFontSubstitution{T3}{ptm}{m}{n}
\usepackage{fontspec}

\setmainfont[BoldFont={Minion Pro Bold.ttf}, ItalicFont={Minion Pro Italic.ttf}
{Minion Pro Regular.ttf}

\begin{document}

\huge This is a text with a \textipa{[f@"nERIk]} transcription and
\textipa{\textsl{slænt@d}} text for in-text use. I also use \textsc{small caps}
a lot.

\end{document}


I tried adding \DeclareFontSubstitution{T3}{ptm}{m}{sl} as well, but it made everything in the tipa environment slanted, instead of only what’s inside \textsl{}. If it doesn’t work I’ll just use times, but I wanted to see if it would be possible.

If anyone has a better suggestion for a font to use for IPA together with Minion Pro, suggestions are also welcome.

You can compile your file using LuaLaTeX with fontspec. LuaLaTeX admits unicode characters which makes it simpler in typing phonetic transcriptions, and more legible to read when writing the code if I may add.

In order to typeset those phonetics symbols, the font you use must contain those characters in its map, so I recommend you use Doulos SIL, a font designed specifically to attend the variety of symbols in different languages (You can download it for free here). Also it's a serif font and combine together with Minion Pro that you want to use.

The Doulos SIL font does not have a natural slanted or italic shape, but you can fake it with fontspec.

Here's the solution you want for your document:

\documentclass{article}

\usepackage{fontspec}

%\setmainfont[BoldFont={Minion Pro Bold.ttf}, ItalicFont={Minion Pro Italic.ttf}
%{Minion Pro Regular.ttf}

\setmainfont{MinionPro}[
Extension = .otf,
UprightFont = *-Regular,
BoldFont = *-Bold,
ItalicFont = *-It,
BoldItalicFont = *-BoldIt
]

\newfontfamily\ipafont{Doulos SIL}[
SlantedFont={Doulos SIL},
SlantedFeatures={FakeSlant=0.15}
]
\newcommand{\ipa}[1]{{\ipafont #1}}

\begin{document}

\huge This is a text with a [\ipa{fəˈnɛɾɪk}] transcription and \textsl{\ipa{slæntəd}} text for in-text use. I also use \textsc{small caps} a lot. \textsl{slanted}

\end{document}


You may notice that the text is typesetted with Minion Pro, but the phonetic symbols use Doulos SIL font.

If you cannot find all the IPA symbols you need, you may want to visit this site to type the words and symbols and then copy and paste in you document and compile it.

I commented the font you used to put mine instead, but you're free to uncomment yours and comment mine to compile properly in your machine.

You could add the family you want to use to the \tipaencoding command:

\documentclass{article}
\usepackage[T1]{tipa}
\renewcommand\tipaencoding{\fontencoding{T3}\fontfamily{ptm}\selectfont}
\usepackage{fontspec}

\setmainfont{TeX Gyre Heros}

\begin{document}

\huge This is a text with a \textipa{[f@"nERIk]} transcription and
\textipa{\textsl{slænt@d}} text for in-text use. I also use \textsc{small caps}
a lot.

\end{document}


As a complement to Levy's fine answer, here's a way to “reuse” the Tipa traditional input style. Also I define the \ipa command with a *-variant for slanted type.

\documentclass{article}
\usepackage{fontspec}

\setmainfont{MinionPro}[
Extension=.otf,
Path=/Library/Fonts/,
UprightFont=*-Regular,
ItalicFont=*-It,
BoldFont=*-Bold,
BoldItalicFont=*-BoldIt,
SlantedFont=*-Regular,
SlantedFeatures={FakeSlant=0.25},
]
\newfontfamily\ipafont{Doulos SIL}[
SlantedFont={Doulos SIL},
SlantedFeatures={FakeSlant=0.15}
]

\ExplSyntaxOn
\NewDocumentCommand{\ipa}{sm}
{
\group_begin:
\ipafont
\IfBooleanTF{#1}
{ \textsl { \lundgren_ipa:n { #2 } } }
{ \lundgren_ipa:n { #2 } }
\group_end:
}

\cs_new_protected:Nn \lundgren_ipa:n
{
\tl_map_function:nN { #1 } \__lundgren_ipa_char:n
}

\cs_new:Nn \__lundgren_ipa_char:n
{
\str_case:nnF { #1 }
{
{"}{ˈ}
{@}{ə}
{E}{ɛ}
{R}{ɾ}
{I}{ɪ}
%...
}
{#1}
}
\ExplSyntaxOff

\begin{document}

This is a text with a \ipa{[f@"nERIk]} transcription and
\ipa*{slænt@d} text for in-text use. I also use \textsc{small caps}
a lot. The transcription also works with direct input \ipa{[fəˈnɛɾɪk]}.

\end{document}


The settings for Minion Pro are due to how the fonts are stored on my machine, use the appropriate way for your machine.

The list of conversions is of course incomplete, you can fill in new correspondences as you type your document.