LaTeX forum ⇒ Text FormattingShowing error - in equationarray -

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
sachinrajsharma
Posts: 35
Joined: Sun Apr 08, 2012 5:48 am

Showing error - in equationarray -

Postby sachinrajsharma » Wed May 15, 2013 8:50 am

Hi,
Good Day!

I have been trying the following source code but unable to get the output showing error " missing \endgroup inserted"

  1. $$\begin{eqnarray*}
  2. \int_{0}^{\pi /2}f(x)dx &=&\int_{0}^{\pi /2}\sin ^{7}x\cos ^{5}xdx \\
  3. &=&\int_{0}^{\pi /2}\sin ^{7}x\cdot \cos xdx-2\int_{0}^{\pi /2}\sin
  4. ^{9}x\cdot \cos xdx \\
  5. &&+\int_{0}^{\pi /2}\sin ^{11}x\cdot \cos xdx \\
  6. &=&\frac{1}{8}-2\cdot \frac{1}{10}+\frac{1}{12}=\frac{1}{120}.
  7. \end{eqnarray*}$$


Please guide how to resolve this.

Regards,

Sachin Sharma
Last edited by cgnieder on Wed May 15, 2013 11:28 am, edited 1 time in total.
Reason: added code markup

Tags:

User avatar
Johannes_B
Site Moderator
Posts: 4044
Joined: Thu Nov 01, 2012 4:08 pm

Postby Johannes_B » Wed May 15, 2013 9:27 am

Please, always provide a compilable and complete Minimal Working Example using the code-button. This makes testing much easier.

$$ are TeX-Syntax and not to be used with LaTeX. The right expression would be \[ E = mc^2 \].

The environment equationarray is not used anymore, use align instead.



  1. \documentclass{scrartcl}
  2.  
  3. \usepackage{mathtools}
  4.  
  5. \begin{document}
  6. \begin{align}
  7. \int_{0}^{\pi /2}f(x)dx &=&\int_{0}^{\pi /2}\sin ^{7}x\cos ^{5}xdx \\
  8. &=&\int_{0}^{\pi /2}\sin ^{7}x\cdot \cos xdx-2\int_{0}^{\pi /2}\sin
  9. ^{9}x\cdot \cos xdx \\
  10. &&+\int_{0}^{\pi /2}\sin ^{11}x\cdot \cos xdx \\
  11. &=&\frac{1}{8}-2\cdot \frac{1}{10}+\frac{1}{12}=\frac{1}{120}.
  12. \end{align}
  13. \end{document}
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.

User avatar
cgnieder
Site Moderator
Posts: 1988
Joined: Sat Apr 16, 2011 7:27 pm

Postby cgnieder » Wed May 15, 2013 11:38 am

I like to repeat: {eqnarray} really should be avoided. Also, $$...$$ is plain TeX syntax and should not be used in a LaTeX document.

The &=& is {eqnarray} syntax and doesn't hold for {align} which uses &= instead. Also the splitted line beginning with + should at least be indented with \quad:

  1. \documentclass{scrartcl}
  2.  
  3. \usepackage{mathtools}
  4.  
  5. \begin{document}
  6.  
  7. \begin{align*}
  8. \int_{0}^{\pi /2}f(x)dx
  9. &= \int_{0}^{\pi /2} \sin ^{7}x \cos^{5}xdx \\
  10. &= \int_{0}^{\pi /2} \sin ^{7}x \cdot \cos xdx - 2\int_{0}^{\pi /2}\sin^{9}x \cdot \cos xdx \\
  11. &\quad +\int_{0}^{\pi /2}\sin ^{11}x\cdot \cos xdx \\
  12. &= \frac{1}{8} - 2\cdot \frac{1}{10} + \frac{1}{12} \\
  13. &= \frac{1}{120}.
  14. \end{align*}
  15.  
  16. \end{document}


I would also recommend to take a look at mathmode, a document by Herbert Voß which explains many details about math mode and the various environments available.

Regards
Clemens
------------------------------
chemmacros · chemformula · leadsheets · xsim


Return to “Text Formatting”

Who is online

Users browsing this forum: Baidu [Spider] and 3 guests