(unicode-math หรือ newtxmath) + \ newcommand {\ nmodels} {\ not \ models} + $\not\models$ = แผงลอย

Sep 16 2020

ป้อนข้อมูล

\RequirePackage{ifthen}
\RequirePackage{ifxetex,ifluatex}
\newif\ifxetexorluatex
\ifxetex
  \xetexorluatextrue
\else
  \ifluatex
    \xetexorluatextrue
  \else
    \xetexorluatexfalse
  \fi
\fi
\documentclass{standalone}
\ifxetexorluatex
\usepackage{unicode-math}
\else
\usepackage{newtxmath}
\fi
\newcommand{\nmodels}{\not\models}%%% or \providecommand, or \providecommand* instead of \newcommand; the effect is the same.
\begin{document}
\(\nmodels\) %%% or \(\not\models\); the effect is the same.
\end{document}

ใด ๆpdflatex, xelatexหรือlualatexทำให้เกิดวง จำกัด ในกรณีของXeLaTeX + unicode-math จะเข้าสู่ infinite loop หากกำหนด \ nin? คุณสามารถใช้\notinแทนได้\not\inแต่คุณจะทำอย่างไรถ้าคุณชอบรูปร่างของ\models(แทนที่จะเป็น\vDash) ต้องการรูปแบบที่ถูกลบและต้องการเรียกมันว่า\nmodels? รูปแบบ\nvDashแตกต่างกันดังนั้นจึงไม่แนะนำให้ใช้ทั้งสองอย่าง\modelsและ\nvDashในเอกสารเดียวกัน การใช้ MnSymbols (ทั้งหมด) ไม่เป็นปัญหา: มันอาจยังมีข้อบกพร่องอยู่ (ฉันรู้ว่ามันมีประมาณ 10 ปีที่แล้วและหยุดใช้ไปแล้ว) เปลี่ยนสัญลักษณ์ค่อนข้างน้อยและขัดแย้งกับแบบอักษร NewTX

คำตอบ

4 egreg Sep 16 2020 at 15:10

การดำเนินงานในปัจจุบันของ\notไม่เป็นหลักเดียวกันในpdflatexตาม (Xe | Lua) unicode-mathน้ำยางด้วย

อย่างแม่นยำยิ่งขึ้น\notใช้โทเค็นถัดไปพูด\fooและตรวจสอบก่อนว่า\notfooมีการกำหนดไว้หรือไม่ หากการทดสอบสำเร็จ\notfooจะใช้ มิฉะนั้นการตรวจสอบครั้งต่อไปจะ\nfooถูกกำหนดไว้หรือไม่ อีกครั้งหากการทดสอบนี้สำเร็จ\nfooจะใช้ \n@tch@r\fooมิฉะนั้นน้ำยางไม่

ตอนนี้คุณเห็นว่าทำไมวง จำกัด จะเริ่มต้น: \nmodelsไม่\not\models; เนื่องจาก\nmodelsมีการกำหนดจึงใช้ซึ่งไม่\not\models...

คุณสามารถหลีกเลี่ยงปัญหานี้ได้โดยใช้\notการ\relax(หวังว่าไม่ว่า\notrelaxมิได้\nrelaxมีการกำหนดซึ่งไม่น่า)

\documentclass{standalone}
\usepackage{iftex}
\iftutex
  \usepackage{unicode-math}
\else
  \usepackage{newtxmath}
\fi

\newcommand{\nmodels}{\not\relax\models}%

\begin{document}

\(\nmodels\)

\(\not\models\)

\end{document}

\modelsอย่างไรก็ตามนี้ไม่ได้เป็นวิธีที่ดีโดยเฉพาะอย่างยิ่งจะลบล้าง เปรียบเทียบกับสิ่งต่อไปนี้

\documentclass[border=4]{standalone}
\usepackage{iftex}
\iftutex
  \usepackage{unicode-math}
\else
  \usepackage{newtxmath}
\fi
\usepackage{centernot}

\newcommand{\nmodels}{\centernot\models}%

\begin{document}

\(\nmodels\)

\(\not\models\)

\end{document}

4 Davislor Sep 16 2020 at 10:55

คำจำกัดความของ\notการฉลาดเกินครึ่งโดยการค้นหาว่ามีอยู่แล้ว\nmodelsหรือ\notmodelsยัง

ใช้งานได้ถ้าคุณเปลี่ยนชื่อ:

\documentclass{standalone}
\usepackage{iftex}

\iftutex
  \usepackage{unicode-math}
\else
  \usepackage{newtxmath}
\fi

%\newcommand{\aintmodel}%
  %{\mathrel{\ooalign{\(\models\)\cr\hidewidth\(\mathslash\)\hidewidth}}}

\newcommand\aintmodel{\not\models}

\begin{document}
\( \aintmodel \)
\end{document}

การค้นหานี้จะดำเนินการทุกครั้งที่ใช้สัญลักษณ์และคำจำกัดความของ\notไม่สามารถขยายได้เต็มที่ดังนั้นคุณจึงไม่สามารถกำหนดสัญลักษณ์โดยใช้\letหรือ\edefและหลีกเลี่ยงสิ่งนี้ได้

อย่างไรก็ตามคุณสามารถสร้างสัญลักษณ์\ooalignแทนได้ (ใช้/กับnewtxmathแทน\mathslash.)

เห็นได้ชัดว่าขณะนี้ความต้องการในการค้นหาคำนำหน้าunicode-mathaint

อัปเดต

คุณยังสามารถโทรได้\notโดยไม่ต้องใช้ชื่อ\modelsเพื่อป้องกันการค้นหา ตัวอย่างเช่น,

\documentclass{standalone}
\usepackage{iftex}

\usepackage{unicode-math}


\newcommand\nmodels{\mathrel{\not\symbol{"22A7}}}

\begin{document}
\( \nmodels \)
\end{document}