search fix

Tuesday, 12 May 2015

How to get = to align in LaTeX

There may be instances where a few lines of equations look bad because their equal signs are not aligned, like this one:


The way to do it is to start by declaring you are starting LaTeX:

[latex]

Then tell it you are using \begin{align}

[latex]
\begin{align}

Then put in the first line of LaTeX code with an & where you want to align it, so in our case, before the = sign:

[latex]
\begin{align}
y &= 3(x)^4(2x -5)

At the end of the line, put a space backslash backslash ( \\). This makes a line break.


[latex]
\begin{align}
y &= 3(x)^4(2x -5) \\

Then you might want an empty line to separate the next line more, put another space backslash backslash ( \\).

[latex]
\begin{align}
y &= 3(x)^4(2x -5) \\
 \\

Put in the next lines of math similarly, remembering the & before the =.

[latex]
\begin{align}
y &= 3(x)^4(2x -5)\\
\\
\dfrac {\delta y}{\delta x}&=3x^4(2)+(2x-5)12x^3 \\
\\
&=6x^4+24x^4-60x^3 \\
\\
&=30x^4-60x^3 \\

At the end, close alignment with \end{align} and close LaTeX with [/latex]

[latex]
\begin{align}
y &= 3(x)^4(2x -5)\\
\\
\dfrac {\delta y}{\delta x}&=3x^4(2)+(2x-5)12x^3 \\
\\
&=6x^4+24x^4-60x^3 \\
\\
&=30x^4-60x^3 \\
\end{align}
[/latex]

The finished product will look like this: