
在 XeLaTeX 中編寫粗略的語法並使用 fontspec 將預設字體更改為 Bitstream Charter 而不是 CM。對於輸出的第一頁左右,一切正常,但在第二頁上,字體突然變回 Computer Modern。我找不到任何理由。我的序言是這樣設定的:
\usepackage[left=0.5in,right=0.5in,top=1in,bottom=1in]{geometry}
\renewcommand{\rmdefault}{bch}
\usepackage{fontspec}
\newfontfamily\la{Brill Roman}
\usepackage{xunicode}
\usepackage{xltxtra}
\usepackage{array}
\usepackage{multirow}
\renewcommand{\p}{\textipa}
第二頁的輸出如下:
該區域的實際 LaTeX 程式碼的運作方式如下。
\item \la{V} $\to$ any of the vowels or diphthongs.
\item \la{C2} $\to$ optional; restricted to nasals, fricatives, and \la{/l/}.
\end{enumerate}
\item \la{N} -- syllabic nasal. May be any of the nasals.
\end{enumerate}
\large{\textbf{Stress}}
Stress is always on the penultimate syllable.
答案1
最新的 TeX 發行版具有 XCharter OpenType 字體,因此您可以使用它而不是\renewcommand{\rmdefault}{bch}
除了 ASCII 字元之外不會給您任何內容。
此外,\la
如您所定義的,它只是一個開關,告訴 XeLaTeX 從那時起使用 Brill。
正確的文件是
\documentclass{article}
\usepackage[left=0.5in,right=0.5in,top=1in,bottom=1in]{geometry}
\usepackage{fontspec}
\setmainfont{XCharter}
\newfontfamily\lafont{Brill Roman}[Color=FF0000]
\DeclareTextFontCommand{\la}{\lafont}
\usepackage{array}
\usepackage{multirow}
\newcommand{\p}{\textipa}
\begin{document}
\begin{enumerate}
\item \la{V} $\to$ any of the vowels or diphthongs.
\item \la{C2} $\to$ optional; restricted to nasals, fricatives, and \la{/l/}.
\item \la{N} -- syllabic nasal. May be any of the nasals.
\end{enumerate}
{\large\textbf{Stress}\par}
Stress is always on the penultimate syllable.
\end{document}
請注意,\la
現在做接受爭論,但\large
沒有。文字採用 Charter 字體,而參數中的文字\la
採用 Brill 字體(我將它們塗成紅色只是為了在範例中更加強調,刪除該Color=FF0000
選項)。
如果您的系統字體中沒有XCharter
,您可以使用更複雜的設定:
\setmainfont{XCharter}[%
Extension=.otf,
UprightFont=*-Roman,
ItalicFont=*-Italic,
BoldFont=*-Bold,
BoldItalicFont=*-BoldItalic,
]
另請注意,通常不應加載xunicode
和。xltxtra
根據您可用的版本fontspec
,您可能需要將強制參數和可選參數的順序切換為\setmainfont
和\newfontfamily
:
\newfontfamily\lafont[Color=FF0000]{Brill Roman}
\setmainfont[%
Extension=.otf,
UprightFont=*-Roman,
ItalicFont=*-Italic,
BoldFont=*-Bold,
BoldItalicFont=*-BoldItalic,
]{XCharter}
在這種情況下,最好更新 TeX 發行版。
答案2
在
\la{N}
它們{}
沒有做任何事情,\la
不接受參數,它會切換當前組的其餘部分的字體。在本例中,即\end{enumerate}
So 此時字體(以及任何其他本機聲明)將恢復為它們在 處的值\begin{enumerate}
。
目前尚不清楚您是否只想\la
更改 的字體N
,或者是否想更改 while 文件的字體,在這種情況下您可以使用
\setmainfont{Brill Roman}