4

fontspec does not generally play nicely with TIPA these days. My intention in this question is to find out what exactly is causing the problem.

In attempting to diagnose the problem, I began with the following, simple MWE:

\documentclass[12pt]{article}
\pagestyle{plain}
\usepackage[margin=1.8cm]{geometry}
\geometry{a4paper}
\usepackage[parfill]{parskip}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{tipa}
\usepackage[no-math]{fontspec} %no-math option provided to remove guff
                               %from the log file

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

\begin{document}

\begin{IPA}
  kAT
\end{IPA}

\end{document}

This, to my surprise, is an MWE that actually works, it does exactly what it should do.

Introducing an accent, however, breaks things. This:

\documentclass[12pt]{article}
\pagestyle{plain}
\usepackage[margin=1.8cm]{geometry}
\geometry{a4paper}
\usepackage[parfill]{parskip}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{tipa}
\usepackage[no-math]{fontspec} %no-math option provided to remove guff
                               %from the log file

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

\begin{document}

\begin{IPA}
  kAT\'{a}
\end{IPA}

\end{document}

Won't compile. And when I say, "won't compile," xelatex does not terminate, but it does use up 100% CPU and my laptop fan starts. Eventually, I am forced to interrupt with Ctrl-c. What follows are the final lines printed on my terminal:

(/usr/share/texlive/texmf-dist/tex/latex/euenc/eu1enc.def)
(/usr/share/texlive/texmf-dist/tex/latex/euenc/eu1lmr.fd))
(/usr/share/texlive/texmf-dist/tex/xelatex/xunicode/xunicode.sty
(/usr/share/texmf/tex/latex/tipa/t3enc.def
(/usr/share/texlive/texmf-dist/tex/latex/euenc/eu1lmss.fd))
(/usr/share/texlive/texmf-dist/tex/latex/graphics/graphicx.sty
(/usr/share/texlive/texmf-dist/tex/latex/graphics/graphics.sty
(/usr/share/texlive/texmf-dist/tex/latex/graphics/trig.sty)
(/usr/share/texlive/texmf-dist/tex/latex/latexconfig/graphics.cfg)
(/usr/share/texlive/texmf-dist/tex/xelatex/xetex-def/xetex.def))))
(/usr/share/texlive/texmf-dist/tex/latex/fontspec/fontspec.cfg)))
(./TIPA_Experiment.aux) (/usr/share/texmf/tex/latex/tipa/t3cmr.fd)
*geometry* driver: auto-detecting
*geometry* detected driver: xetex
^C! Interruption.
\reserved@c ->\tipaupperaccent 
                               {1}
l.19   kAT\'{
             a}
? 

And this is the final 15%, or so, of the .log file:

(/usr/share/texlive/texmf-dist/tex/latex/fontspec/fontspec.cfg)))
(./TIPA_Experiment.aux)
\openout1 = `TIPA_Experiment.aux'.

LaTeX Font Info:    Checking defaults for OML/cmm/m/it on input line 16.
LaTeX Font Info:    ... okay on input line 16.
LaTeX Font Info:    Checking defaults for T1/cmr/m/n on input line 16.
LaTeX Font Info:    ... okay on input line 16.
LaTeX Font Info:    Checking defaults for OT1/cmr/m/n on input line 16.
LaTeX Font Info:    ... okay on input line 16.
LaTeX Font Info:    Checking defaults for OMS/cmsy/m/n on input line 16.
LaTeX Font Info:    ... okay on input line 16.
LaTeX Font Info:    Checking defaults for OMX/cmex/m/n on input line 16.
LaTeX Font Info:    ... okay on input line 16.
LaTeX Font Info:    Checking defaults for U/cmr/m/n on input line 16.
LaTeX Font Info:    ... okay on input line 16.
LaTeX Font Info:    Checking defaults for T3/cmr/m/n on input line 16.
LaTeX Font Info:    Try loading font information for T3+cmr on input line 16.
 (/usr/share/texmf/tex/latex/tipa/t3cmr.fd
File: t3cmr.fd 2001/12/31 TIPA font definitions
)
LaTeX Font Info:    ... okay on input line 16.
LaTeX Font Info:    Checking defaults for EU1/lmr/m/n on input line 16.
LaTeX Font Info:    ... okay on input line 16.

*geometry* driver: auto-detecting
*geometry* detected driver: xetex
*geometry* verbose mode - [ preamble ] result:
* driver: xetex
* paper: a4paper
* layout: <same size as paper>
* layoutoffset:(h,v)=(0.0pt,0.0pt)
* modes: 
* h-part:(L,W,R)=(51.21504pt, 495.07779pt, 51.21504pt)
* v-part:(T,H,B)=(51.21504pt, 742.61676pt, 51.21504pt)
* \paperwidth=597.50787pt
* \paperheight=845.04684pt
* \textwidth=495.07779pt
* \textheight=742.61676pt
* \oddsidemargin=-21.05495pt
* \evensidemargin=-21.05495pt
* \topmargin=-58.05495pt
* \headheight=12.0pt
* \headsep=25.0pt
* \topskip=12.0pt
* \footskip=30.0pt
* \marginparwidth=44.0pt
* \marginparsep=10.0pt
* \columnsep=10.0pt
* \skip\footins=10.8pt plus 4.0pt minus 2.0pt
* \hoffset=0.0pt
* \voffset=0.0pt
* \mag=1000
* \@twocolumnfalse
* \@twosidefalse
* \@mparswitchfalse
* \@reversemarginfalse
* (1in=72.27pt=25.4mm, 1cm=28.453pt)

! Interruption.
\reserved@c ->\tipaupperaccent 
                               {1}
l.19   kAT\'{
             a}
? x

Here is how much of TeX's memory you used:
 14318 strings out of 493918
 287219 string characters out of 6150563
 322624 words of memory out of 5000000
 17533 multiletter control sequences out of 15000+600000
 5735 words of font info for 24 fonts, out of 8000000 for 9000
 1144 hyphenation exceptions out of 8191
 46i,1n,35p,10393b,95s stack positions out of 5000i,500n,10000p,200000b,80000s
No pages of output.

This doesn't actually help me to understand what's going wrong.

I should also point out that exactly what is printed seems to vary. On one occasion (after actually leaving it for quite a long while) the .log file finished here:

* \hoffset=0.0pt
* \voffset=0.0pt
* \mag=1000
* \@twocol

And then the ! Interruption stuff was printed beneath.

(I may have mistaken exactly where \@twocolumnfalse was truncated, I didn't copy it at the time).

Another example of terminal output is:

^C! Interruption.
\new@ifnextchar ...rved@a {#2}\def \reserved@b {#3
                                                  }\futurelet \@let@token \n...
l.19   kAT\'{
             a}
? 

So: What is the nature of this problem?

Au101
  • 10,278
  • Just as a heads up, in a future version of fontspec the xunicode package will no longer be loaded automatically. Some accent commands etc. will be supported but no TIPA. – Will Robertson Oct 18 '15 at 08:19

1 Answers1

6

The Latin Modern fonts don't support IPA, but trying to load the legacy fonts is hopeless.

Since \textipa is available with fontspec, one just modifies it in order to use a font supporting IPA (in this case CMU Serif).

\documentclass[12pt]{article}

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

\newfontfamily{\tipacm}[Scale=MatchUppercase]{CMU Serif}

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

\begin{document}

\textipa{k\textscripta T\'{a}}

\textipa{kAT\'{a}}

\begin{IPA}
  kAT\'{a}
\end{IPA}

\end{document}

enter image description here

egreg
  • 1,121,712
  • You can set the font with \renewcommand\useTIPAfont{\tipacm}. There is no need to patch \textipa. – Ulrike Fischer Oct 17 '15 at 14:37
  • Ah, I see, that makes a lot of sense +1. But, would it be possible to explain why it is hopeless? Also, is this the only work around? (It seems like it's quite a good one if it is, but is there any way to special case TIPA so that fontspec doesn't interfere with it?) – Au101 Oct 17 '15 at 15:06
  • @Au101 fontspec, via xunicode, wants to provide support for IPA, so going back to support the legacy tipa package becomes, at least, very difficult. And in my opinion there's no point in doing this: as you see, the input is the same as with tipa and it works. You can also directly use the Unicode characters in the IPA range: try \textipa{kɑθá}. – egreg Oct 17 '15 at 15:31
  • Fair enough, so CMU Serif is one of the Computer Modern Unicode fonts? Is there a difference between this and the old style? Anyway, I thank you :) Would you, though, be able to explain what's broken? Just for my own personal understanding - not to solve any problem or anything. I'm just interested to know where the conflict lies and why exactly TIPA and fontspec cannot play together where once they did. What exactly is the problem? From a purely academic point of view – Au101 Oct 17 '15 at 15:37
  • 1
    @Au101 By default, fontspec uses Latin Modern, that has optical sizes, whereas CMU Serif has just one size that's scaled; it's not really a big deal, since IPA insertions are distinct anyway; you can also set CMU Serif as default, if you want: it supports Latin, Greek, Cyrillic and IPA. – egreg Oct 17 '15 at 15:41