latex3 / mathtools

Mathematical tools to use with amsmath
LaTeX Project Public License v1.3c
57 stars 7 forks source link

xmapsto #45

Closed KuznetsovAleksey closed 9 months ago

KuznetsovAleksey commented 2 years ago

mathtools 2022/06/29 v1.29 unicode-math 2020/01/31 v0.8q

\documentclass{article} \usepackage{mathtools} \usepackage{unicode-math} \begin{document}

[ \xmapsto[1]{2} ]

\end{document}

\xmapsto provides 7→ instead of \mapsto symbol

daleif commented 2 years ago

I'm not sure this is a mathtools issue since (1) it works just fine without unicode-math and the issue persists if we define \xmapsto without mathtools (it is exactly the same definition)

Here is a much smaller MWE

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

Using unicode-math under lualatex this gives 7, without unicode-math
it gives the proper symbol

\[  \mapstochar \]

\end{document}

\mapstochar is the left end part of \mapsto. It is defined in the latex kernel, apparently not remapped in unicode-math

daleif commented 2 years ago

Relevant thread from unicode-math (thanks to Ulrike)

https://github.com/wspr/unicode-math/issues/197

So basically the issue is that \mapstochar does not exist in unicode fonts. Not sure why it then ends up as a 7

KuznetsovAleksey commented 2 years ago

The problem is related to \xmapsto since lualatex + unicode-math for $\mapsto$ print the mapsto symbol.

Please, note the problem in next issue of the mathtools manual. unicode-math is rarely updated and it's bug list is long.

daleif commented 2 years ago

Yes, but \mapsto (as a symbol) exists in unicode. \xmapsto needs to build |-> and gets the | from \mapstochar which is not defined in unicode and thus is missing from the font. Note that amsmath defines \mapsto as \mapstochar\righarrow, unicode-math just overwrites \mapsto to point at the unicode char.

KuznetsovAleksey commented 2 years ago

Dear Lars, sorry, if this request is in the wrong place. Would you like to add to mathtools something similar

\newcommand\stack[2]{\genfrac{}{}{0pt}{}{#2}{#1}} \newcommand\tstack[2]{\genfrac{}{}{0pt}{1}{#2}{#1}} \newcommand\dstack[2]{\genfrac{}{}{0pt}{0}{#2}{#1}}

These constructions are similar to binoms without parenthesis or fractions without delimiting lines. They complement the \overset an \underset constructions.

Kind regards, Alexey

daleif commented 2 years ago

Please post those as a separate issue/request. Though, it don't see how they are much use to other than very few people.

And I don't see how they complement \overset etc, it is two different things

daleif commented 9 months ago

As this is not a mathtools problem per se, I'm closing this.