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 ?

Learnmore
  • 134
  • 6

1 Answers1

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.

  • What does the command &; do ?Is this the one which helps us to achieve it – Learnmore Apr 02 '19 at 04: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. –  Apr 02 '19 at 04: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 Apr 02 '19 at 04: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 Apr 02 '19 at 04:57
  • What should I do now?Can you kindly help – Learnmore Apr 02 '19 at 04: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. –  Apr 02 '19 at 05:00