2

I'm trying to redefine a math command (let's say \int) so that it will always do more (let's say \int lol) using the following trick: https://tex.stackexchange.com/a/47353/15659

BUT, now I want to use the package unicode-math in LuaLaTeX and it don't work any more.


Minimal working example:

\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 Answers1

6

For technical reasons, much of the work of unicode-math related to defining the meaning of symbols is performed at begin document. In particular, \int is among the symbols defined there. So use

\AtBeginDocument{%
  \let\oldint\int
  \renewcommand\int{\oldint lol}%
}
egreg
  • 1,121,712