Closed e-kwsm closed 6 years ago
unicode-math
does most of its job at begin document, so you should delay such redefinitions.
\documentclass{article}
\usepackage{amsmath}
\usepackage{unicode-math}
\AtBeginDocument{%
\renewcommand\Re{\operatorname{Re}}%
}
\begin{document}
\[
\Re z
\]
\end{document}
@eg9 Thank you, \AtBeginDocument
works.
@eg9 — given this comes up relatively often, I wonder if I should have a more "clever" system in place here to first define all unicode-math symbols to something like
\cs_set:Npn \Re { \__um_placeholder_symbol:N \Re }
and then inside the \AtBeginDocument
definition check that the placeholder is as-expected and keep the user definition. I think there would be negligible speed issues, but I'd need to benchmark to be sure.
The problem is: what's the expected meaning of \Re
? Maybe not for \Re
, but for other commands the issue might be relevant.
Well there’s the unicode-math version of \Re, and then there’s everything else :) If a user wants to redefine \Re, perhaps unicode-math should have a package option to
(a) silently overwrite the user definition (current behaviour, fastest) (b) allow the user definition with a warning (c) overwrite the user definition with a warning
The warnings could be turned off with the usual l3msg-based process.
It seems hard to select which macros to support user's redefinition.
I think it is good enough that a user redefines a macro by \AtBeginDocument
(or its wrapper provided by unicode-math) and that the documentation describes it.
Description
Unable to redefine (
\def
,\renewcommand
, etc)\Re
and\Im
—real and imaginary parts of a complex number. Fraktur letters (ℜ and ℑ) are always printed.Check/indicate
Minimal example demonstrating the issue
My environment: frozen TeX Live 2017
Further details
Commenting out the following lines enables to redefine
\Re
and\Im
.https://github.com/wspr/unicode-math/blob/2d9705623f340551357ba07d443eb2e442545e18/unicode-math-table.tex#L179
https://github.com/wspr/unicode-math/blob/2d9705623f340551357ba07d443eb2e442545e18/unicode-math-table.tex#L187