Write Two Equations at the Same Line in Latex

  • LaTeX
  • Thread starter EngWiPy
  • Start date
  • Tags
    Latex Line
In summary: Here they are:In summary, you can use latex to write two differents equations at the same line using Latex. For example:\begin{align}y_1(x)=&x^2\\y_2(x)=&2x+1\end{align}
  • #1
EngWiPy
1,368
61
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
 
Physics news on Phys.org
  • #2
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}
y_1(x) = x^2 & y_2(x) = 2x+1 \\
\end{array}
[/tex]
Code:
\begin{array}{cc}
y_1(x) = x^2 & y_2(x) = 2x+1 \\
\end{array}
 
  • #3
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}
y_1(x) = x^2 & y_2(x) = 2x+1 \\
\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?
 
  • #4
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}
\begin{tabular*}{20cm}{@{\extracolsep{\fill}} l r }
y_1(x) = x^2 & y_2(x) = 2x+1 \\
\end{tabular*}
\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:
  • #5
Have you thought of minipage environment. It should allow you to do such a thing.

Cheers
 
  • #6
my first reply

[tex]
P_h^a_n^i /, /, /, 985685
9//1//2
[/tex]
 
  • #7
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}
\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
 
  • #8
Oh you wanted the equations numbered seperately. Well glad you found it.
 

FAQ: Write Two Equations at the Same Line in Latex

1. How do I write two equations at the same line in LaTeX?

To write two equations at the same line in LaTeX, you can use the \begin{align} \end{align} environment. Place the first equation after \begin{align} and the second equation after &. Then, use \\ to separate the equations.

2. Can I align the equations at a specific point?

Yes, you can use the \begin{align*} \end{align*} environment to align the equations at a specific point. After the &, use the \hspace{length} command to add space between the equations.

3. How do I label the equations when writing two at the same line?

You can use the \label{label_name} command after each equation to label them. Then, use the \ref{label_name} command to reference the equations in your text.

4. Is it possible to add text between the equations?

Yes, you can use the \intertext{text} command to add text between the two equations. This will align the text at the center between the equations.

5. Can I use different equation numbering for each equation?

Yes, you can use the \notag command after the equation you do not want to be numbered. This will prevent the equation from being numbered and will not affect the numbering of the other equations.

Similar threads

Replies
1
Views
376
Replies
12
Views
1K
Replies
3
Views
3K
Replies
4
Views
12K
Replies
1
Views
1K
Replies
11
Views
5K
Replies
4
Views
2K
Back
Top