\NewNegationCommand を使用して否定記号に mathrel を適切に設定する

\NewNegationCommand を使用して否定記号に mathrel を適切に設定する

のデフォルトの定義は、\not\models間隔に関して満足していません:

\documentclass{article}
\usepackage{unicode-math}
\begin{document}
$a\models b$

$a\not\models b$
\end{document}

与える

デフォルトの間隔

が不足しているためだと思います\mathrel。手動で追加すると、適切な間隔が確保されます。もちろん、これを毎回入力するのは適切ではないので、これを行うために を定義しようとしています\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\notmodels

無限再帰を疑って、私は試した

\documentclass{article}
\usepackage{unicode-math}
\edef\ysnm{\not\models}
\NewNegationCommand\models{\mathrel{\ysnm}}
\begin{document}
$a\models b$

$a\notmodels b$
\end{document}

しかし、それは次のようになります:挿入された{がありません。$a\notmodels、これは私にとって非常に不安なことです。

3回目の試み

\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の のバグのようです\mathoverlayaccent。なぜなら、この組み合わせは\not\modelsLuaLaTeXでは機能しますが(スペースが間違っています)、これは次のように修正できます。

\NewNegationCommand{\models}{\mathrel{\notaccent\models}}

しかし、結果は満足できるものではない

ここに画像の説明を入力してください

このソリューションは、\altnotXeLaTeX と LuaLaTeX の両方で機能します。

答え2

理由は聞かないでください。以下は機能します (基本的に手動で 1 つの展開を実行します)。

\documentclass{article}
\usepackage{unicode-math}
\NewNegationCommand{\models}{\mathrel{\not⊧}}
\begin{document}
$a\models b$

$a\notmodels b$
\end{document}

関連情報