unicode-math と組み込みの数学コマンドを再定義する

unicode-math と組み込みの数学コマンドを再定義する

私は、次のトリックを使用して、数学コマンド ( とします\int) を再定義して、常にさらに多くのこと ( とします) を実行できるようにしようとしています。\int lolhttps://tex.stackexchange.com/a/47353/15659

しかし、今私は LuaLaTeX でパッケージを使用したいのですunicode-mathが、もう動作しません。


最小限の動作例:

\documentclass[11pt,a4paper]{article}

\usepackage{unicode-math}

\let\oldint\int
\renewcommand\int{\oldint lol}

\begin{document}

\begin{equation}
\mathbf{B}\left(P\right)=\frac{\mu_0}{4\pi}\int\frac{\mathbf{I}\times\hat{r}'}{r'^2}dl
\end{equation}

\end{document}

答え1

unicode-math技術的な理由から、記号の意味の定義に関連する作業の多くは、文書の冒頭で行われます。特に、\intはそこで定義されている記号の1つです。したがって、

\AtBeginDocument{%
  \let\oldint\int
  \renewcommand\int{\oldint lol}%
}

関連情報