\begin{document} 打破了 \Re 的重新定義

\begin{document} 打破了 \Re 的重新定義

要將哥德式實部運算子替換為普通的“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}}

但是,如果我交換最後兩行,我的重新定義\Re將無效。怎麼了?如何\begin{document}覆寫巨集重定義?

答案1

unicode-mathso 中包含許多命令,\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

相關內容