
このコードは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 時間の検索と試行の末、ようやく答えを見つけました。これですべてが解決することを願っていますが、ドキュメントのサイズが大きくなるにつれて新しいエラーが発生する可能性があります。