Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Question about latex

  1. Jan 10, 2012 #1

    quasar987

    User Avatar
    Science Advisor
    Homework Helper
    Gold Member

    How would I go about to write in latex (not the PF version, the actual thing) a function? By that, I mean when you go

    [tex]f:A\rightarrow B[/tex]
    [tex]a\mapsto f(a)[/tex]

    but how to write the code so that the arrows are all just right in length?

    Thx!
     
  2. jcsd
  3. Jan 10, 2012 #2

    Pengwuino

    User Avatar
    Gold Member

    What do you meany by "just right in length"?
     
  4. Jan 10, 2012 #3

    quasar987

    User Avatar
    Science Advisor
    Homework Helper
    Gold Member

    I am looking for a command, if it exist, that will make it so a and f(a) will automatically have the right alignment with A and B respectively, and this, independantly of what A,B,a and f(a) are.
     
  5. Jan 10, 2012 #4

    Pengwuino

    User Avatar
    Gold Member

    Do you mean aligning the arrows like the equal signs are lined up here:

    2vkbvb6.jpg

    If so, simply surround whatever you want everything to align to with &'s. So for this, it was putting "&=&" to align all the equal signs.
     
  6. Jan 10, 2012 #5

    quasar987

    User Avatar
    Science Advisor
    Homework Helper
    Gold Member

    No. For instance, if I take A to be very long, the formula will look ugly:

    [tex]f:A set that's very long to write outtttt\rightarrow B[/tex]
    [tex]a\mapsto f(a)[/tex]

    Here, the problem is that f(a) is not aligned with B. I could fix this my making the mapsto arrow longer, but I was hoping for a command like \definefunction{f}{A}{B}{a}{f(a)} that would set everything right automarically.
     
  7. Jan 10, 2012 #6

    quasar987

    User Avatar
    Science Advisor
    Homework Helper
    Gold Member

    Oh, I see what you mean: aligning the arrows would align all. That's clever, thanks :)
     
  8. Jan 10, 2012 #7

    AlephZero

    User Avatar
    Science Advisor
    Homework Helper

    I'm not sure exactly what you are trying to do, but the \phantom{} macro works out what size its argument would be if it was typeset, and then creates an invisible object the same size. Maybe you could use that to extend your arrow using a \phantom copy of the long definition.

    EDIT: simultaneous post with your #6 !
     
  9. Jan 11, 2012 #8

    jhae2.718

    User Avatar
    Gold Member

    The amsmath align environment should work for that.
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook




Similar Discussions: Question about latex
  1. Question about LaTeX (Replies: 4)

  2. Question About Latex (Replies: 3)

Loading...