
關於間距的預設定義\not\models
不令人滿意:
\documentclass{article}
\usepackage{unicode-math}
\begin{document}
$a\models b$
$a\not\models b$
\end{document}
給出
我認為這是因為它缺少一個\mathrel
:手動添加它可以提供正確的間距。當然,每次都輸入此內容是不可接受的,因此我嘗試定義 a\notmodels
來執行此操作。
我發現 unicode-math 對舊的進行了一些更改\not
並提供了\NewNegationCommand
.
然而,也許天真
\documentclass{article}
\usepackage{unicode-math}
\NewNegationCommand\models{\mathrel{\not\models}}
\begin{document}
$a\models b$
$a\notmodels b$
\end{document}
給出:超出 TeX 容量,抱歉 [語意巢狀大小=500]。 $a\not模型
懷疑無限遞歸,我試過
\documentclass{article}
\usepackage{unicode-math}
\edef\ysnm{\not\models}
\NewNegationCommand\models{\mathrel{\ysnm}}
\begin{document}
$a\models b$
$a\notmodels b$
\end{document}
但它給了:缺少 { 已插入。 $a\not模型,我覺得這很令人不安。
第三次嘗試
\documentclass{article}
\usepackage{unicode-math}
\AtBeginDocument{
\newbox\boxnm
\setbox\boxnm=\hbox{$\not\models$}
\NewNegationCommand\models{\mathrel{\copy\boxnm}}
}
\begin{document}
$a\models b$
$a\notmodels b$
\end{document}
作品…
但我覺得這很令人費解。
我怎樣才能以更好的方式擺脫這個困境?
答案1
否定符號是一種痛苦unicode-math
。:-(
但還有一條出路。:-)
\documentclass{article}
\usepackage{unicode-math}
\Umathchardef\altnot=3 \symsymbols "0338
\NewNegationCommand{\models}{\models\mathrel{\mkern1mu}\altnot\mkern-1mu}
\begin{document}
$a\models b$
$a\not\models b$
$a\notmodels b$
\end{document}
的語法\NewNegatedCommand
是
\NewNegatedCommand{\foo}{<code>}
其中\foo
是要求反的關係符號。這定義了組合\not\foo
和命令\notfoo
。
這裡我使用一個小的緊排以避免衝突。
順便說一句,這似乎是 XeTeX for 中的一個錯誤\mathoverlayaccent
,因為該組合\not\models
在 LuaLaTeX 中有效(儘管給出了錯誤的間距),這可以透過以下方式解決:
\NewNegationCommand{\models}{\mathrel{\notaccent\models}}
但輸出並不令人滿意
此解決方案\altnot
適用於 XeLaTeX 和 LuaLaTeX。
答案2
不要問為什麼,但以下方法有效(基本上手動進行一次擴展):
\documentclass{article}
\usepackage{unicode-math}
\NewNegationCommand{\models}{\mathrel{\not⊧}}
\begin{document}
$a\models b$
$a\notmodels b$
\end{document}