0
 \begin{align*}

(pq+p-3)^2-(3pq+p+q-6)(pq+p-3)+2(p^2q^2+p^2q+pq^2-7pq+p+q+2)\\

=(p^2q^2+p^2+9+2p^2q-6q-6pq)-(3p^2q^2+p^2q+pq^2-6pq+3p^6q+p^2+pq-6p-9pq-3p-3q+18)+2(p^2q^2+p^2q+pq^2-7pq+p+q+2)\\

=pq^2-6pq+5p+5q-5\\

=pq(q-6)+5(p+q-1)

\end{align*}

I ran the above code in LaTeX but unfortunately the output is not coming well. The same happens when I use gather* environment.

I am attaching the screenshot for this.

I want all the "=" signs to start from left. Also I want to start each line starting with "=" from a new line which is not happening in this code.

Further I dont want each line starting with "=" to come up with a new equation number but all these are happening.

Kindly suggest me some remedies for this.

Please find the output attached.

enter image description here

In other words my calculation looks very worse in my paper.How to align or make it look good ?

2
  • 1
    Why do you use align* inside gather*?
    – user156344
    Commented Apr 2, 2019 at 4:35
  • @JouleV;they both are producing same thing,both are having difficulty with the things I mentioned
    – Learnmore
    Commented Apr 2, 2019 at 4:38

1 Answer 1

0

My proposal, based on suggestions from this question's answers (package geometry added to have a nice-looking margin):

\documentclass{article}
\usepackage{amsmath}
\usepackage{geometry}
\begin{document}
\begin{align*}
&\;(pq+p-3)^2-(3pq+p+q-6)(pq+p-3)+2(p^2q^2+p^2q+pq^2-7pq+p+q+2)\\
=&\;(p^2q^2+p^2+9+2p^2q-6q-6pq)-(3p^2q^2+p^2q+pq^2-6pq+3p^6q+p^2+\\
&\quad+pq-6p-9pq-3p-3q+18)+2(p^2q^2+p^2q+pq^2-7pq+p+q+2)\\
=&\;pq^2-6pq+5p+5q-5\\
=&\;pq(q-6)+5(p+q-1)
\end{align*}
\end{document}

enter image description here

Don't add blank lines anywhere you want, unless you know what they are doing. For example, adding a single blank line inside align* in the above example can cause compilation error.

6
  • What does the command &\; do ?Is this the one which helps us to achieve it
    – Learnmore
    Commented Apr 2, 2019 at 4:46
  • @Learnmore & is a special character, its role in align can be found in the amsmath documentation. \; is for the seperation space between "=" and the right hand side.
    – user156344
    Commented Apr 2, 2019 at 4:48
  • Thank you very much but I have another doubt. I used your code in another set of equations but it failed,here is the code.
    – Learnmore
    Commented Apr 2, 2019 at 4:57
  • \begin{align*} (pq+q-3)^2-(3pq+p+q-6)(pq+q-3)+2(p^2q^2+p^2q+pq^2-7pq+p+q+2)\\ =&\;(p^2q^2+q^2+9+2pq^2-6q-6pq) +(-3p^2q^2-p^2q-pq^2+6pq-3pq^2-pq-q^2+6q+9pq+3p+3q-18)\\+2(p^2q^2+p^2q+pq^2-7pq+p+q+2)\\ =&\;p^2q-5-6pq+5p+5q\\ =&\;pq(p-6)+5(p+q-1)\\ \end{align*}
    – Learnmore
    Commented Apr 2, 2019 at 4:57
  • 1
    @Learnmore You forgot & (and \quad or \; or \qquad etc.) on the first line and the fourth line. To prevent margin exceeding, I think you should find another line-break point.
    – user156344
    Commented Apr 2, 2019 at 5:00

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .