2

I have this problem with this equation that i cannot find out:

    \documentclass{article}
    \usepackage{amsmath}
    \usepackage[makeroom]{cancel}   

    \begin{document} 
    \begin{eqnarray*} 

        -\rho U_{\infty}^{2}Lb+\int\limits_{0}^{L}\rho u^{2}bdy+U_{\infty}(\rho U_{\infty}Lb-\int\limits_{0}^{L}\rho ubdy=-D \Rightarrow \\ 

        -\cancel{\rho U_{\infty}^{2}Lb}+\int\limits_{0}^{L}\rho u^{2}bdy+\cancel{\rho U_{\infty}^{2}Lb}-U_{\infty}\int\limits_{0}^{L}\rho ubdy=-D \Rightarrow \\ 

        \frac{\rho\int\limits_{0}^{L}(u^{2}-uU_{\infty})bdy}{\frac{\rho}{2}U_{\infty}^{2}bc}=
        \frac{-D}{\frac{\rho}{2}U_{\infty}^{2}bc}\Rightarrow \\ 

        c_{D}=\frac{2}{c}\int\limits_{0}^{L}\frac{u}{U_{\infty}}(1-\frac{u}{U_{\infty}})dy \\

        \end{eqnarray*}
\end{document}
2
  • Could you please complete your code to provide a Minimal (non-)Working Example i.e. a complete, small document people can use to reproduce the error? Could you also explain what the problem actually is?
    – cfr
    Commented Nov 5, 2014 at 2:30
  • 1
    Remove the blank lines. Or put a comment character at the start of each one if you want to keep them to visually separate things.
    – cfr
    Commented Nov 5, 2014 at 2:35

2 Answers 2

3

Removing the blank lines will compile the code. However, it might be better to use one of the environments provided by the AMS packages since eqnarray has some issues. (See the AMS package manual for details.) For example:

\documentclass{article}
\usepackage{amsmath,mathtools,cancel}
\begin{document}

  \begin{gather*}
    -\rho U_{\infty}^{2}Lb+\int\limits_{0}^{L}\rho u^{2}bdy+U_{\infty}(\rho U_{\infty}Lb-\int\limits_{0}^{L}\rho ubdy=-D \Rightarrow \\
    -\cancel{\rho U_{\infty}^{2}Lb}+\int\limits_{0}^{L}\rho u^{2}bdy+\cancel{\rho U_{\infty}^{2}Lb}-U_{\infty}\int\limits_{0}^{L}\rho ubdy=-D \Rightarrow \\
    \frac{\rho\int\limits_{0}^{L}(u^{2}-uU_{\infty})bdy}{\frac{\rho}{2}U_{\infty}^{2}bc}=
    \frac{-D}{\frac{\rho}{2}U_{\infty}^{2}bc}\Rightarrow \\
    c_{D}=\frac{2}{c}\int\limits_{0}^{L}\frac{u}{U_{\infty}}(1-\frac{u}{U_{\infty}})dy
  \end{gather*}

\end{document}

gathering

0
1

The main issue with your code (the presence of blank lines) has already been addressed in @cfr's answer. I'll add a few notes on fine points of math typesetting and efficient coding in TeX:

  • To avoid having to write \limits after every single \int instruction, load with amsmath package with the option intlimits:

    \usepackage[intlimits]{amsmath}
    

    Note that this option only works on \int in displaystyle-mode.

  • It's customary -- probably because it enhances readability/parsability -- to insert a thinspace, \,, between the integrand and the "dy" part of an integral expression. Some (many?) also like to typeset the "d" symbol in an upright shape to highlight its "math operator" function; others, though, don't follow this stylistic rule.

  • In the final row, you should enlarge the parentheses that surround the term 1-\frac{u}{U_{\infty}}, say, by writing \Bigl( and \Bigr). In this case, \left( and \right) would create parentheses are too large, visually/aesthetically speaking.

  • It's probably a good idea to insert whitespace, say with \quad, before the \Rightarrow directives at the end of the first three lines. Doing so creates a bit more visual offset, making the \Rightarrow stand out a bit.

  • There's a stray ( symbol on the first line that should (probably?) be eliminated.

enter image description here

\documentclass{article}
\usepackage[intlimits]{amsmath}
\usepackage[makeroom]{cancel}   

\begin{document} 
\begin{gather*} 
-\rho U_{\infty}^{2}Lb+\int_{0}^{L}\rho u^{2}b\,dy+U_{\infty}\rho U_{\infty}Lb-\int_{0}^{L}\rho ub\,dy=-D \quad\Rightarrow \\ 
%
-\cancel{\rho U_{\infty}^{2}Lb}+\int_{0}^{L}\rho u^{2}b\,dy+\cancel{\rho U_{\infty}^{2}Lb}-U_{\infty}\int_{0}^{L}\rho ub\,dy=-D \quad\Rightarrow \\ 
%
\frac{\rho\int_{0}^{L}(u^{2}-uU_{\infty})b\,dy}{\frac{\rho}{2}U_{\infty}^{2}bc}=
\frac{-D}{\frac{\rho}{2}U_{\infty}^{2}bc}\quad\Rightarrow \\ 
%
c_{D}=\frac{2}{c}\int_{0}^{L}\frac{u}{U_{\infty}}
\Bigl(1-\frac{u}{U_{\infty}}\Bigr)\,dy \\
\end{gather*}
\end{document}

You must log in to answer this question.

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