ゴシック型の実数部演算子を単純な「Re」に置き換えるには、次のようにします。
\documentclass[a4paper,11pt,twoside,fleqn]{report}
[...]
\usepackage{amsmath}
\usepackage{mathtools}
\usepackage[bold-style=ISO]{unicode-math} % must come after ams and symbols
[...]
\begin{document}
\def\Re{\operatorname{Re}}
しかし、最後の 2 行を入れ替えると、 の再定義は\Re
無効になります。何が起こっているのでしょうか?\begin{document}
マクロの再定義を上書きするにはどうすればよいですか?
答え1
には、処理がコマンドに到達した時点で最初に実行されるコマンドが多数unicode-math
含まれています。同じトリックを使用して、定義をオーバーライドすることもできます。\AtBeginDocument
\begin{document}
\documentclass[a4paper,11pt,twoside,fleqn]{report}
\usepackage{mathtools}
\usepackage[bold-style=ISO]{unicode-math}
\AtBeginDocument{\renewcommand{\Re}{\operatorname{Re}}}
\begin{document}
\( \Re z \)
\end{document}
などの類似のコマンドも\AtEndOfPackage
コア LaTeX で定義されています。 などの追加コマンドはパッケージ\AtBeginEnvironment
内にありますetoolbox
。