
使用虛擬希臘語鍵盤和以下軟體包可以直接實現希臘語 unicode 字元(例如 θ)
\usepackage[mathletters]{ucs}
\usepackage[utf8]{inputenc}
然而,PDF 中顯示的字元始終是希臘語變體,例如,\vartheta
與 相對\theta
。
\let\vartheta\theta
除了針對每個角色之外,還有什麼方法可以避免這種情況嗎?
答案1
嗯嗯
theta 的 Unicode 定義是:
U+03b8 GREEK SMALL LETTER THETA
U+03d1 GREEK THETA SYMBOL
其中第一個是您問題中的問題,第二個是更捲曲的開放性問題。
但是,在套件設定的編碼中,預設ucs
會提供 U+03b8 字元\texttheta
(如果載入了正確的字體編碼,這可能會在文字模式下為您提供正確的字符,我得到了未定義的命令)但是如果您使用該[mathletters]
選項如同在您的片段中一樣,它會切換為使用定義
\uc@dclc{952}{mathletters}{\ensuremath{\vartheta}}%
在文件中uni-3.def
即,假設您想要數學模式下的 theta 符號字元。所以\let
你建議的是一種方法,或者你可以覆蓋這個定義:
\documentclass{article}
\usepackage[mathletters]{ucs}
\usepackage[utf8x]{inputenc}
\makeatletter
\uc@dclc{952}{mathletters}{\ensuremath{\theta}}%
\makeatother
\begin{document}
(e.g. θ)
\end{document}
其產生:
全套\var
...在uni-3.def
是
5 matches for "\\var" in buffer: uni-3.def
174:\uc@dclc{949}{mathletters}{\ensuremath{\varepsilon}}%
183:\uc@dclc{952}{mathletters}{\ensuremath{\vartheta}}%
210:\uc@dclc{961}{mathletters}{\ensuremath{\varrho}}%
213:\uc@dclc{962}{mathletters}{\ensuremath{\varsigma}}%
225:\uc@dclc{966}{mathletters}{\ensuremath{\varphi}}%
答案2
如果您想避免 ucs(例如與 biblatex 衝突),您可以使用此處提供的 lgrxenc.def 和 lgrenc.dfu:http://milde.users.sourceforge.net/LGR/
lgrenc.dfu 將例如 U+03BB 對應到\texttheta
我認為應該是您想要的符號。
答案3
您似乎使用的是過時版本的ucs
.從 2012 年 4 月的 2.0 版開始,使用該mathletters
選項時,正常希臘字元和變體希臘字元都會對應到正確的巨集。請參閱我的部落格文章ucs LaTeX 套件的新版本。
如果您必須堅持使用舊ucs
版本,您還可以修改從字元到 TeX 代碼的映射,這比通過\let
.但是,\uc@dclc
不建議使用 ,如 David Carlisle 的回答所示。要使用的用戶級命令是\DeclareUnicodeCharacter
。看包文件。