[Tex/LaTex] Using TIPA with fontspec

fontspectipaxetex

I'm trying to write a document that will contain characters in many different scripts (for which I am using fontspec and rendering with xelatex) and IPA symbols (for which I am using TIPA). Ordinarily, this works fine, however, I want to use slshape for my IPA symbols. If I take the manual's advice and use

\textipa{\slshape f@"nEtIks}

Or

\textipa{\textsl{f@"nEtIks}}

It fails with fontspec loaded. The document renders properly, but the IPA symbols appear upright. If I remove fontspec, then this works correctly, with the IPA symbols slanted. I tried getting fontspec to use tipasl12, but I could not find a way of allowing fontspec to use the font. However I named it, fontspec could not find the font.

This is the LaTeX I have which produces the correct IPA symbols, but they appear upright:

\documentclass[12pt,openany]{book}
\pagestyle{plain}
\usepackage[margin=1.8cm]{geometry}
\geometry{a4paper}
\usepackage[parfill]{parskip}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{fontspec,xltxtra,xunicode}
\newfontfamily{\AR}[Script=Arabic]{Scheherazade}
\usepackage{tipa}

\begin{document}

  \textipa{\slshape f@"nEtIks}

\end{document}

The following, however, works perfectly, but – obviously – would not allow me to use Arabic characters:

\documentclass[12pt,openany]{book}
\pagestyle{plain}
\usepackage[margin=1.8cm]{geometry}
\geometry{a4paper}
\usepackage[parfill]{parskip}
\usepackage{amsmath}
\usepackage{amssymb}
%\usepackage{fontspec,xltxtra,xunicode}
%\newfontfamily{\AR}[Script=Arabic]{Scheherazade}
\usepackage{tipa}

\begin{document}

  \textipa{\slshape f@"nEtIks}

\end{document}

Best Answer

The Arabic font is not a factor. The problem is that fontspec redefines \textipa under the assumption that the Latin Modern fonts have the IPA glyphs, which however should be called by Unicode.

Solution: restore the Computer Modern fonts for IPA.

\documentclass[12pt,openany]{book}
\pagestyle{plain}
\usepackage[margin=1.8cm]{geometry}
\geometry{a4paper}
\usepackage[parfill]{parskip}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{tipa}
\usepackage{fontspec}
\newfontfamily{\AR}[Script=Arabic]{Scheherazade}

\begin{document}
\renewcommand\textipa[1]{{\fontfamily{cmr}\tipaencoding #1}}

  \textipa{\slshape f@"nEtIks}

\end{document}

A more complete version, taking into account also the need for typewriter type:

\documentclass[12pt,openany]{book}
\pagestyle{plain}
\usepackage[margin=1.8cm]{geometry}
\geometry{a4paper}
\usepackage[parfill]{parskip}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{tipa}
\usepackage{fontspec}
\newfontfamily{\AR}[Script=Arabic]{Scheherazade}

\AtBeginDocument{
  \renewcommand\textipa[2][r]{{\fontfamily{cm#1}\tipaencoding #2}}
}

\renewenvironment{IPA}[1][r]
 {\fontfamily{cm#1}\tipaencoding}
 {}

\begin{document}

\textipa{\slshape f@"nEtIks}

\textipa[tt]{f@"nEtIks}

\begin{IPA}f@"nEtIks\end{IPA}

\begin{IPA}[tt]f@"nEtIks\end{IPA}

\begin{IPA}\slshape f@"nEtIks\end{IPA}


\end{document}

enter image description here

Related Question