TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I use $\xrightarrow{f}$ a lot and I found myself in need of the corresponding commands \xmapsto and \xhookrightarrow quite a few times and I was wondering if there is anything like it. I'd like to produce

(i) a labeled hookrightarrow

(ii) a labeled mapsto

Thanks in advance for any help.

share|improve this question
A tip: you can highlight commands and small portions of code by enclosing it between two backticks `` Please help us to help you and add a minimal working example (MWE) that illustrates your problem. It will be much easier for us to reproduce your situation and find out what the issue is when we see compilable code, starting with \documentclass{...} and ending with \end{document}. – Christian Hupfer Jun 27 '14 at 10:41
up vote 8 down vote accepted

I am not sure, whether you mean those commands with labels, but I think they could provide the relevant symbols:

\xmapsto{label}, \xhookrightarrow, all from mathtools package.



\xmapsto{\text{Look here}} &&  x\\
\xrightarrow{\text{Something}} && y \\
\xhookrightarrow{\text{Something completely different}} && z 


enter image description here

Please have also a look on http://mirrors.ctan.org/info/symbols/comprehensive/symbols-a4.pdf, which provides a (perhaps not complete, but near to it) overview of symbols in LaTeX

share|improve this answer
Ooh! mathtools was exactly what I needed! : ) Thank you very much for this helpful answer. It does make one wonder though why xrightarrowdoes not need the same package included as the other two commands. – Matt N. Jun 27 '14 at 11:08
@MattN. \xrightarrow is a command already available by ususal amsmath and perhaps redefined/improved in mathtools (I did not check for it now), but not \xmapsto and \xhookrightarrow (as far as I know). To make it work. If you include both amsmath and mathtools, amsmath must come before the other one. – Christian Hupfer Jun 27 '14 at 11:11
mathtools does not touch \xrightarrow, we only provide the extra ones. – daleif Jun 27 '14 at 11:16
@daleif: Ok, I already guessed that, therefore I wrote perhaps. Thank you. – Christian Hupfer Jun 27 '14 at 11:17
@ChristianHupfer Thank you for pointing that out to me. – Matt N. Jun 27 '14 at 12:09

A minimal implementation if you do not wish to import mathtools


  \ext@arrow 0395\xmapstofill@{#1}{#2}%

  \ext@arrow 0395\xhookrightfill@{#1}{#2}%

\[ A \xmapsto[under]{over} B \]
\[ A \xhookrightarrow[under]{over} B \]

AMSmath's \ext@arrow is the command that generates the extensible arrow composed of the chars defined in its fifth argument, in this case \xmapstofill@; in turn this defines the arrow to start with \mapstochar\relbar (|-) then repeat \relbar (-) as many times as needed to fit the label, then end with \rightarrow (->).

share|improve this answer
What about the same for \hookrightarrow? – Sigur Jul 2 '15 at 8:41
@Sigur there you go! – Bordaigorl Jul 2 '15 at 10:57

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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