Welcome to our community

Be a part of something great, join today!

Practice latex

Casio

Member
Feb 11, 2012
86
$y=2x+1$

$y=2x^2+3x+5$

$ a+3b=1$
$2a - b=1$

Multiply through by 3

$6a - 3b = 3$

Subtract equation (3) from (1)

$6a - 3b = 3$
$ a + 3b = 1$
$7a - 0b = 4$

a =$\frac{4}{7}$

Just learning latex on here and trying to understand how I can keep everything in line, which seems difficult with some parts above, is there something I am missing out?

Please advise

Kind regards

Casio
 

Evgeny.Makarov

Well-known member
MHB Math Scholar
Jan 30, 2012
2,492
Just learning latex on here and trying to understand how I can keep everything in line, which seems difficult with some parts above, is there something I am missing out?
What do you mean by difficulties of keeping everything in line? You should include the complete formula between the dollar signs, i.e., write $a=\frac{4}{7}$ instead of a =$\frac{4}{7}$. Also, from the typography viewpoint, it is arguably better to write fractions in inline formulas and in sub- and superscripts using a slash instead of \frac: \(4/7\) instead of \(\frac{4}{7}\). The command \frac is convenient for large display formulas (i.e., formulas that take their own line). However, this remark is probably more appropriate for fine book typesetting rather than online forums.
 

Ackbach

Indicium Physicus
Staff member
Jan 26, 2012
4,192
$y=2x+1$

$y=2x^2+3x+5$

$ a+3b=1$
$2a - b=1$

Multiply through by 3

$6a - 3b = 3$

Subtract equation (3) from (1)

$6a - 3b = 3$
$ a + 3b = 1$
$7a - 0b = 4$

a =$\frac{4}{7}$

Just learning latex on here and trying to understand how I can keep everything in line, which seems difficult with some parts above, is there something I am missing out?

Please advise

Kind regards

Casio
To add to Evgeny.Makarov's comments, you can use the align environment (among many, many possibilities in $\LaTeX$) to align equations by the equals sign. For example, the code

Code:
\begin{align*}
a&=x+y\\
b&=x-y
\end{align*}
produces

\begin{align*}
a&=x+y\\
b&=x-y
\end{align*}
 

Casio

Member
Feb 11, 2012
86
$\begin{align}r^2=(x + 5)^2 + (y - 3)^2\end{align}$
$\begin{align}r^2=(x - 1)^2 + (y + 1)^2\end{align}$
$\begin{align}r^2=(x - 0)^2 + (y + 2)^2\end{align}$

${2}/{3} + {4}/{6}=$

How is this?

Better
 

Ackbach

Indicium Physicus
Staff member
Jan 26, 2012
4,192
$\begin{align}r^2=(x + 5)^2 + (y - 3)^2\end{align}$
$\begin{align}r^2=(x - 1)^2 + (y + 1)^2\end{align}$
$\begin{align}r^2=(x - 0)^2 + (y + 2)^2\end{align}$

${2}/{3} + {4}/{6}=$

How is this?

Better
It is better, but only by accident. There are three things you could do to improve this code.

1. Use only one align environment.
2. Use ampersands to control how things are aligned.
3. Leave off the dollar signs. The align environment is automatically math mode.

For example, suppose you wanted to type these:

Code:
$\begin{align}r^2+x^{2}=(x + 5)^2 + (y - 3)^2\end{align}$
$\begin{align}r^2=(x - 1)^2 + (y + 1)^2\end{align}$
$\begin{align}r^2=(x - 0)^2 + (y + 2)^2\end{align}$
produces

$\begin{align}r^2+x^{2}=(x + 5)^2 + (y - 3)^2\end{align}$
$\begin{align}r^2=(x - 1)^2 + (y + 1)^2\end{align}$
$\begin{align}r^2=(x - 0)^2 + (y + 2)^2\end{align}$

Not aligned the way we want!

Try this code:

Code:
\begin{align}r^2+x^{2}&=(x + 5)^2 + (y - 3)^2\\
r^2&=(x - 1)^2 + (y + 1)^2\\
r^2&=(x - 0)^2 + (y + 2)^2\end{align}
producing

\begin{align}r^2+x^{2}&=(x + 5)^2 + (y - 3)^2\\
r^2&=(x - 1)^2 + (y + 1)^2\\
r^2&=(x - 0)^2 + (y + 2)^2.\end{align}

Much better. Notice the double backslashes at the end of each line marking where the code should begin the next line.

Incidentally: as a defensive $\LaTeX$ programming habit, I always put curly braces around exponents and subscripts, even if it's only one character. That way, if I want to insert another character in the exponent or subscript later, I won't wonder why I get this sort of thing: $x^45$ instead of $x^{45}$.