重新审视 TIPA 和 Fontspec

重新审视 TIPA 和 Fontspec

fontspec现在通常都不太好用TIPA。我提出这个问题的目的是找出到底是什么导致了这个问题。

在尝试诊断问题时,我从以下简单的 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}

令我惊讶的是,这是一个真正起作用的 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\'{a}
\end{IPA}

\end{document}

无法编译。当我说“无法编译”时,它xelatex并没有终止,但它确实占用了 100% 的 CPU,并且我的笔记本电脑风扇开始运转。最后,我不得不用 Ctrl-c 中断。以下是我终端上打印的最后几行:

(/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}
? 

这是文件的最后 15% 左右.log

(/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.

这实际上并没有帮助我了解出了什么问题。

我还应该指出,打印的内容似乎有所不同。有一次(实际上放置了很长一段时间后)文件.log在这里结束:

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

然后将! Interruption内容打印在下面。

(我可能记错了\@twocolumnfalse截断的位置,当时我没有复制它)。

终端输出的另一个示例是:

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

那么:这个问题的本质是什么?

答案1

拉丁现代字体不支持 IPA,但尝试加载传统字体却是徒劳的。

由于\textipa可用fontspec,因此只需对其进行修改即可使用支持 IPA 的字体(在本例中为 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}

在此处输入图片描述

相关内容