
(で定義されている)\QED
を呼び出すコマンドを定義しようとしています。次の MWE を検討してください。\square
amssymb
\documentclass{article}
\RequirePackage{amsmath}
\RequirePackage{amssymb}
\RequirePackage[scaled=0.96, sups, scosf, osf]{XCharter}
\RequirePackage[warnings-off={mathtools-colon,mathtools-overbracket}]{unicode-math}
\setmathfont{XCharter-Math.otf}
\def\QED{\ensuremath{{\square}}}
\begin{document}
\QED
$\square$
\end{document}
これは次のようにコンパイルされます。
$\square$
は正しく表示されますが、 は表示されません。\ensuremath{{\square}}
なぜでしょうか?
答え1
unicode-math
\QED
∎ は U+220E と定義されますが、その定義\AtBeginDocument
により の定義が上書きされ\QED
、選択したフォントにはその文字が含まれません。
\documentclass{article}
\RequirePackage{amsmath}
\RequirePackage{amssymb}
\RequirePackage[scaled=0.96, sups, scosf, osf]{XCharter}
\RequirePackage[warnings-off={mathtools-colon,mathtools-overbracket}]{unicode-math}
\setmathfont{XCharter-Math.otf}
\AtBeginDocument{\def\QED{\ensuremath{{\square}}}}
\begin{document}
X
\QED
$\square$
\end{document}