TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

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 am trying to code the following;


where -> is \longrightarrow and |-> is \longmapsto. However, my problem is that I am unable to get the x directly underneath the X. I tried the following code:

\\* $f : X\longrightarrow Y$
\\* $\hphantom{<1>}   $x\longmapsto f(x)$\\

However this doesn't get it directly under the X as desired. Any help will be much appreciated.

share|improve this question
Sorry it didn't appear properly in this post, I wanted the small x directly under the big X – Eduardo Dec 13 '13 at 17:29
Use the align environment from amsmath package. – Thruston Dec 13 '13 at 17:31
Is this expression supposed to occur in a two-line displaymath context with both lines set in the same font size, or is supposed to occur in inline math and with x\longmapsto f(x) fairly small and set below f:X\longrightarrow Y? Please advise. – Mico Dec 13 '13 at 18:09
    f: & X\rightarrow Y ,\\
      & x\mapsto f(x).
share|improve this answer

I would personally prefer the alignment offered by a direct use of array:



    f: & X & \rightarrow & Y,   \\
       & x & \mapsto     & f(x).

The first argument of array (i.e. @{}r@{\;}c@{\;}c@{\;}l@{} in this case) is a specification for the alignment of the columns, as found in the tabular environment. The @{...} part specifies the space between the columns and I use it here (as suggested by @egreg in the comments) to make the spacing more uniform with the rest of the document.


share|improve this answer
IMO this gives too much space, and the X \to Y part end up looking inconsistent with other X\to Y in the normal text – daleif Dec 13 '13 at 18:05
\begin{array}{@{}r@{\;}c@{\;}c@{\;}c@{}} – egreg Dec 13 '13 at 18:06
@egreg Thanks that's exactly what I was going to propose in a moment! Spot on as always =) – Bordaigorl Dec 13 '13 at 18:08
Edited as suggested by @egreg – Bordaigorl Dec 13 '13 at 18:12

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.