I have tried to compile the next equation on the overleaf.com :

           \frac{1}{h} \left(\frac{3}{2} y_{n}-4y_{n+1} +\frac{5}{2} y_{n+2} \right.    \nonumber \\
           + \left. h^{3} \left(\frac{61}{6720}f_{n} +\frac{599}{840}f_{n+1} +\frac{353}{336}f_{n+2} \right.\right. \nonumber \\
           - \left.\left. \frac{27}{2240}f_{n+\frac{8}{3}} +\frac{61}{840}f_{n+3}\right)\right),
           & x_{n} \le x\le x_{n+3}, \\
           \frac{1}{h} \left(-\frac{3}{2} y_{n+3} +2y_{n+4} -\frac{1}{2} y_{n+5} \right. \nonumber \\
           +\left. h^3 \left(\frac{13}{224}f_{n+3} +\frac{1399}{4200}35f_{n+4}\right.\right.\nonumber \\
           -\left.\left.\frac{23}{168}f_{n+5} +\frac{783}{5600}f_{n+\frac{17}{3}}
           -\frac{17}{280}f_{n+6} \right)\right),
           & x_{n+3} < x\le x_{n+6}

but I have the compile error:

Argument of \frac has an extra }. \par l.314 \frac {1}{h} \left(\frac{3}{2} y_{n}-4y_{n+1} +\frac{5}{2} y...

Unfortunatly, I can't see this equation here but I have tried to type it on stats.stackexchange.com and result is below:

enter image description here

Question: How to fix the error on the overleaf's editor?

  • 3
    I can't replicate your error. Are you loading amsmath? – Werner Jul 21 '17 at 2:21
  • For MathJax preview I recommend mathb.in. – Henri Menke Jul 21 '17 at 2:24
  • @Werner, thank for comment, I don't load this package. – Nick Jul 21 '17 at 2:32

Besides the need for amsmath, I fixed the order of brackets [], and parentheses() and used \biggl/\biggr instead of \left/\right.

From the point of view of styles, it is recommended to use two equations instead of cases environment when the cases span multiple lines (see section 12.35 of The Chicago Manual of Style which discusses cases). You are free to follow that advice or just stick to your original representation.


\delta(x)&=\frac{1}{h}\biggl[\frac{3}{2} y_{n}-4y_{n+1} +\frac{5}{2} y_{n+2} \nonumber \\
         &\phantom{={}}+ h^{3}\biggl(\frac{61}{6720}f_{n} +\frac{599}{840}f_{n+1} +\frac{353}{336}f_{n+2}\nonumber \\
         &\phantom{={}}-\frac{27}{2240}f_{n+\frac{8}{3}} +\frac{61}{840}f_{n+3}\biggr)\biggr],\quad x_{n}\le x\le x_{n+3},\\
\delta(x)&=\frac{1}{h}\biggl[-\frac{3}{2} y_{n+3} +2y_{n+4} -\frac{1}{2} y_{n+5} \nonumber \\
         &\phantom{={}}+h^3\biggl(\frac{13}{224}f_{n+3} +\frac{1399}{4200}35f_{n+4}-\frac{23}{168}f_{n+5}\nonumber \\
         &\phantom{={}}+\frac{783}{5600}f_{n+\frac{17}{3}}-\frac{17}{280}f_{n+6}\biggr)\biggr],\quad x_{n+3} < x\le x_{n+6}.


enter image description here


Cross Validated's use of MathJax comes pre-loaded with the necessary components to allow for using equation, cases, and other environments. That's why it shows as expected when typing math on that site. Without it - on Overleaf - you need to explicitly load amsmath to achieve the desired output.

So, add to your preamble


enter image description here

Here would be a minimal example that obtained the above output:




  \delta(x) = \begin{cases}
    \frac{1}{h} \bigl[\frac{3}{2} y_n-4y_{n+1} +\frac{5}{2} y_{n+2} \\
    \quad {}+ h^3 \bigl(\frac{61}{6720}f_n +\frac{599}{840}f_{n+1} +\frac{353}{336}f_{n+2} \\
    \quad {}- \frac{27}{2240}f_{n+\frac{8}{3}} +\frac{61}{840}f_{n+3}\bigr)\bigr],
    & x_n \leq x \leq x_{n+3}, \\
    \frac{1}{h} \bigr[-\frac{3}{2} y_{n+3} +2y_{n+4} -\frac{1}{2} y_{n+5} \\
    \quad {}+h^3 \bigl(\frac{13}{224}f_{n+3} +\frac{1399}{4200}35f_{n+4} \\
    \quad {}-\frac{23}{168}f_{n+5} +\frac{783}{5600}f_{n+\frac{17}{3}}
     -\frac{17}{280}f_{n+6} \bigr)\bigr],
    & x_{n+3} < x \leq x_{n+6}

  • Note sure what the factor 35 is doing in the expression... – Werner Jul 21 '17 at 3:51
  • open and close parenthesis sizes don't match. – barbara beeton Jul 21 '17 at 22:13
  • @barbarabeeton: Indeed. Eeeck! I made some more changes. – Werner Jul 21 '17 at 22:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.