Take the 2-minute tour ×
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.

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
add comment

2 Answers

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
add comment
    f: & X\rightarrow Y ,\\
      & x\mapsto f(x).
share|improve this answer
add comment

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.