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

Write Two Equations at the Same Line in Latex

  1. Aug 19, 2009 #1
    Hello,

    How can I write two differents equations at the same line using Latex? for example:

    [tex]\begin{align}
    y_1(x)=&x^2\\
    y_2(x)=&2x+1
    \end{align}[/tex]

    Thanks in advance
     
  2. jcsd
  3. Aug 19, 2009 #2

    minger

    User Avatar
    Science Advisor

    You could either "jimmy" it by just putting spacing characters in between, or put them in a matrix.
    [tex]
    y_1(x) = x^2 \,\,\,\,\, y_2(x) = 2x+1
    [/tex]
    Code (Text):

    y_1(x) = x^2 \,\,\,\,\, y_2(x) = 2x+1
     
    Or a slightly more elegant
    [tex]
    \begin{array}{cc}
    y_1(x) = x^2 & y_2(x) = 2x+1 \\
    \end{array}
    [/tex]
    Code (Text):
    \begin{array}{cc}
    y_1(x) = x^2 & y_2(x) = 2x+1 \\
    \end{array}
     
  4. Aug 19, 2009 #3
    First, thank you for replying. Second, I want the equation numbers, and the two equations be at the two extreme edges (left and right) of the page. Can we do that?
     
  5. Aug 20, 2009 #4

    minger

    User Avatar
    Science Advisor

    OK, I got something. I had to switch to the tabular environment; it has some better column definition flexibility (furthermore, you really need to use the tabular* environment). Either way, you get the optional table width with you will typically want to use
    Code (Text):
    0.8\textwidth
    or something like that. For the purpose of displaying it proprely on this webpage, I have chosen an arbitrary width. The
    Code (Text):
    }{@{\extracolsep{\fill}}
    is important as it lets the columns have "rubber widths" so they decide how wide they should each be.
    [tex]
    \begin{equation}
    \begin{tabular*}{20cm}{@{\extracolsep{\fill}} l r }
    y_1(x) = x^2 & y_2(x) = 2x+1 \\
    \end{tabular*}
    \end{equation}
    [/tex]
    Code (Text):

    \begin{equation}
    \begin{tabular*}{20cm}{@{\extracolsep{\fill}} l r }
      y_1(x) = x^2 & y_2(x) = 2x+1 \\
    \end{tabular*}
    \end{equation}
     
    Hope that helps.

    edit: Check out thsi page for more information
    http://en.wikibooks.org/wiki/LaTeX/Tables
     
    Last edited: Aug 20, 2009
  6. Aug 20, 2009 #5
    Have you thought of minipage environment. It should allow you to do such a thing.

    Cheers
     
  7. Aug 20, 2009 #6
    my first reply

    [tex]
    P_h^a_n^i /, /, /, 985685
    9//1//2
    [/tex]
     
  8. Aug 20, 2009 #7
    Ok, thank you. you are right, minipage enviroment solves the issue. Here is the code:

    [tex]\begin{minipage}{0.5\linewidth}
    \begin{equation}
    y_1(x)=x^2
    \end{equation}
    \end{minipage}
    \hspace{0.5cm}
    \begin{minipage}{0.5\linewidth}
    \begin{equation}
    y_2(x)=2x+1
    \end{equation}
    \end{minipage}[/tex]

    Thank you all guys.

    Regards
     
  9. Aug 20, 2009 #8

    minger

    User Avatar
    Science Advisor

    Oh you wanted the equations numbered seperately. Well glad you found it.
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook




Similar Discussions: Write Two Equations at the Same Line in Latex
  1. Latex vs. writing math (Replies: 10)

Loading...