5

I am using XeTeX and need a text above the \mapsto arrow. So I googled for it and found the command for it. But unfortunately, this comes out:

enter image description here

So here's the code:

\documentclass[a4paper,10pt]{scrartcl}
\usepackage{unicode-math}
\usepackage[leqno]{mathtools}
\begin{document}
\begin{align*}
  F:\;\mathbb{K}^n \xmapsto{A} \mathbb{K}^m
\end{align*}
\end{document}
  • okay wait ill edit – Lillien Sabrina Gluch Jul 7 '18 at 13:41
  • Don't use fontenc with XeTeX or LuaTeX. (That does not solve your issue here, but you should still not do load fontenc.) – moewe Jul 7 '18 at 13:43
  • Although I use text in the document? I am writing my math lectures in one document and there are explanations. But thank you for the tip – Lillien Sabrina Gluch Jul 7 '18 at 13:44
  • 1
    Given that you're using XeLaTeX, why are you loading the times and lmodern packages? – Mico Jul 7 '18 at 13:51
  • 1
    Really? It doesn't work for me. Please post an answer if you got this to work. BTW: I just noticed that you already got an answer that suggested to load unicode-math after amssymb and other math-related packages (tex.stackexchange.com/q/434645/35864). You should definitely consider following the advice you get in answers. – moewe Jul 7 '18 at 14:26
3

So this worked out for me:

\documentclass[a4paper,10pt]{scrartcl}
\usepackage{unicode-math}
\usepackage[leqno]{mathtools}
\DeclareSymbolFont{pazosymbols}{OMS}{zplm}{m}{n}
\makeatletter
\ExplSyntaxOn %define \xmapsto
\DeclareMathSymbol \c_pazo_minus \mathbin { pazosymbols } 0
\DeclareMathSymbol \c_pazo_mapstochar \mathrel { pazosymbols } { "37 }
\DeclareMathSymbol \c_pazo_rightarrow \mathrel { pazosymbols } { "21 }
\cs_new_protected_nopar:Nn \pazo_relbar: {
  \mathrel {
    \mathpalette \mathsm@sh \c_pazo_minus
  }
}
\cs_set_protected_nopar:Nn \MT_mapsto_fill: {
  \arrowfill@ { \c_pazo_mapstochar \pazo_relbar: } \pazo_relbar: \c_pazo_rightarrow
}
\ExplSyntaxOff
\makeatother
\begin{document}
\begin{align*}
  F:\;\mathbb{K}^n \xmapsto{A} \mathbb{K}^m
\end{align*}
\end{document}
2

If you are willing to use LuaLaTeX:

\documentclass[a4paper,10pt]{scrartcl}
\usepackage[leqno]{mathtools}
\usepackage{unicode-math}

\makeatletter
\renewcommand{\xmapsto}[2][]{\mathrel{\mathpalette\xmapsto@{{#1}{#2}}}}
\newcommand{\xmapsto@}[2]{\xmapsto@@{#1}#2}
\newcommand{\xmapsto@@}[3]{%
  \begingroup
  \sbox\z@{$\m@th#1\mathop{}\limits_{\;#2\;}^{\;#3\;}$}%
  \mathop{\Uhextensible width \wd\z@ 0 "27FC}_{#2}^{#3}%
  \endgroup
}
\makeatother 

\begin{document}
\begin{gather*}
F\colon\mathbb{K}^n \xmapsto{A} \mathbb{K}^m \\
A \xmapsto[aaaaa]{bbbbbbbbbb} B
\end{gather*}
\end{document}

enter image description here

On the other hand, \mapsto is normally used not to denote a map with domain and codomain, but its action on elements.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.