Write Two Equations at the Same Line in Latex

  • Context: LaTeX 
  • Thread starter Thread starter EngWiPy
  • Start date Start date
  • Tags Tags
    Latex Line
Join the discussion
Ask a follow-up here, or get your own question answered by working scientists, mathematicians and engineers — people, not an autocomplete.
Real named experts · corrections over time · the nuance an AI answer skips
7 replies · 77K views
EngWiPy
Messages
1,361
Reaction score
61
Hello,

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

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

Thanks in advance
 
Physics news on Phys.org
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:
y_1(x) = x^2 \,\,\,\,\, y_2(x) = 2x+1
Or a slightly more elegant
[tex] \begin{array}{cc}<br /> y_1(x) = x^2 & y_2(x) = 2x+1 \\<br /> \end{array}[/tex]
Code:
\begin{array}{cc}
y_1(x) = x^2 & y_2(x) = 2x+1 \\
\end{array}
 
minger said:
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:
y_1(x) = x^2 \,\,\,\,\, y_2(x) = 2x+1
Or a slightly more elegant
[tex] \begin{array}{cc}<br /> y_1(x) = x^2 & y_2(x) = 2x+1 \\<br /> \end{array}[/tex]
Code:
\begin{array}{cc}
y_1(x) = x^2 & y_2(x) = 2x+1 \\
\end{array}

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?
 
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:
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:
}{@{\extracolsep{\fill}}
is important as it let's the columns have "rubber widths" so they decide how wide they should each be.
[tex] \begin{equation}<br /> \begin{tabular*}{20cm}{@{\extracolsep{\fill}} l r }<br /> y_1(x) = x^2 & y_2(x) = 2x+1 \\<br /> \end{tabular*}<br /> \end{equation}[/tex]
Code:
\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:
Have you thought of minipage environment. It should allow you to do such a thing.

Cheers
 
my first reply

[tex] P_h^a_n^i /, /, /, 985685<br /> 9//1//2[/tex]
 
fatra2 said:
Have you thought of minipage environment. It should allow you to do such a thing.

Cheers

Ok, thank you. you are right, minipage environment solves the issue. Here is the code:

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

Thank you all guys.

Regards