latex3 / unicode-math

XeLaTeX/LuaLaTeX package for using unicode/OpenType maths fonts
http://ctan.org/pkg/unicode-math
LaTeX Project Public License v1.3c
239 stars 28 forks source link

Conflict with operatorname symbol redifinition #575

Closed jebej closed 2 years ago

jebej commented 2 years ago

There is a conflict between unicode-math and here the redefinition of amsmath's \Re and \Im involving \operatorname

\renewcommand{\Re}{\operatorname{Re}}

The issue was originally noticed with the physics package, which does a similar redefinition.

When unicode-math is loaded, the old fraktur symbol is printed:

\documentclass{article}
\usepackage{unicode-math} % comment out for correct output
\usepackage{amsmath}

\renewcommand{\Re}{\operatorname{Re}}

\begin{document}
The real part of $z$ is $\Re{z}$.
\end{document}

image

The correct output should have the roman "Re":

image

davidcarlisle commented 2 years ago

unicode-math does almost all its definitions \AtBeginDocument (there are some issues open about that) but that means that any redefinitions also need to be delayed to that point either by putting them in the same hook, or putting them after \begin{document}

davidcarlisle commented 2 years ago

This is essentially a duplicate of #477

jebej commented 2 years ago

Thanks, I hadn't seen that issue. Is there any way of making the physics package work correctly then or must we use the manual solution here?

ArchangeGabriel commented 2 years ago

You must use the workaround (or make physics use it, but actually you should rather ditch the physics package —see https://tex.stackexchange.com/q/471532/56823, https://tex.stackexchange.com/q/471563/56823).

davidcarlisle commented 2 years ago

physics package has other issues I think... but

\documentclass{article}
\usepackage{unicode-math}
\AtBeginDocument{\usepackage{physics}}
\begin{document}

$\Re$
\end{document}

if you must

jebej commented 2 years ago

Thank you! I'll close this in favor of #477.