XeLaTeX 和 `tipa`

XeLaTeX 和 `tipa`

因此,此代码适用于XeLaTeX

\documentclass[12pt]{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 pUK.t\~A}
\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}

但是当我取消注释 %\textipa{\slshape pUK.t\~A} 紧接着的行时\begin{document},它不再编译。我该如何纠正它?

答案1

这个答案更像是一种替代方法的建议,我认为这种方法更简单。由于您已经在使用 Xelatex,因此您可以为文本设置常规字体,并为 IPA 设置字体,从而直接在编辑器中输入 IPA。我认为它在编辑时也比 更具可读性tipa

\documentclass{article}
\usepackage{fontspec}
\setmainfont{Century Gothic}
\newfontfamily\ipafont{Charis SIL}
\newcommand\ipa[1]{{\ipafont #1}}

\begin{document}\noindent
This is a paper about Linguistics (IPA: \ipa{lɪŋgwɪstɪks}). And it goes on...
\end{document}

我已将常规字体设置为与默认字体不同的字体,更明显的字体,以便您看到差异。

示例图片

答案2

经过 24 小时的搜索和尝试,我终于找到了答案。我希望这能解决所有问题,尽管随着文档大小的增加,我可能会遇到新的错误。

https://tex.stackexchange.com/a/127427/80224

相关内容