Write Two Equations at the Same Line in Latex

  • Context: LaTeX 
  • Thread starter Thread starter EngWiPy
  • Start date Start date
  • Tags Tags
    Latex Line
Click For Summary

Discussion Overview

The discussion revolves around how to write two different equations on the same line in LaTeX, including considerations for formatting, alignment, and numbering. Participants explore various methods to achieve this layout.

Discussion Character

  • Technical explanation
  • Exploratory

Main Points Raised

  • One participant asks how to write two equations on the same line using LaTeX, providing an initial example with the align environment.
  • Another participant suggests using spacing characters or a matrix to place the equations side by side, providing examples of both methods.
  • A later reply indicates a desire for the equations to be aligned at the edges of the page and numbered separately, prompting further exploration of formatting options.
  • One participant proposes using the tabular environment for better column definition and flexibility, sharing a specific code snippet that utilizes the tabular* environment for alignment.
  • Another participant mentions the minipage environment as a potential solution for achieving the desired layout, which is later confirmed to work by the original poster.

Areas of Agreement / Disagreement

Participants explore multiple methods for formatting equations side by side, with no consensus on a single best approach. Various techniques are suggested and discussed without resolving which is superior.

Contextual Notes

Participants express different preferences for formatting styles and environments in LaTeX, indicating that the choice may depend on specific needs such as alignment and numbering.

EngWiPy
Messages
1,361
Reaction score
61
Hello,

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

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

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.
<br /> y_1(x) = x^2 \,\,\,\,\, y_2(x) = 2x+1<br />
Code:
y_1(x) = x^2 \,\,\,\,\, y_2(x) = 2x+1
Or a slightly more elegant
<br /> \begin{array}{cc}<br /> y_1(x) = x^2 &amp; y_2(x) = 2x+1 \\<br /> \end{array}<br />
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.
<br /> y_1(x) = x^2 \,\,\,\,\, y_2(x) = 2x+1<br />
Code:
y_1(x) = x^2 \,\,\,\,\, y_2(x) = 2x+1
Or a slightly more elegant
<br /> \begin{array}{cc}<br /> y_1(x) = x^2 &amp; y_2(x) = 2x+1 \\<br /> \end{array}<br />
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.
<br /> \begin{equation}<br /> \begin{tabular*}{20cm}{@{\extracolsep{\fill}} l r }<br /> y_1(x) = x^2 &amp; y_2(x) = 2x+1 \\<br /> \end{tabular*}<br /> \end{equation}<br />
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

<br /> P_h^a_n^i /, /, /, 985685<br /> 9//1//2<br />
 
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:

\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}

Thank you all guys.

Regards
 
Oh you wanted the equations numbered separately. Well glad you found it.
 

Similar threads

  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 12 ·
Replies
12
Views
4K
  • · Replies 12 ·
Replies
12
Views
3K
  • · Replies 2 ·
Replies
2
Views
6K
  • · Replies 3 ·
Replies
3
Views
4K
  • · Replies 4 ·
Replies
4
Views
13K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 11 ·
Replies
11
Views
9K
  • · Replies 9 ·
Replies
9
Views
6K
  • · Replies 4 ·
Replies
4
Views
4K