\right) doesn't work on LaTeX multiline equation

20,309

This is happening because the paired \left( and \right) cannot be broken over different lines in multi-line environments. So one cannot start \left( on one line of a multi-line equation and pair it with \right) on another line.

You can trick it, though, by giving it a fake matching paren: \left( \right. The period . matches any kind of bracket. Now it will accept this on its own, and simply produce a left parenthesis. You have to remember to do the same with the right paren, and you have to adjust sizes yourself since the automatic resizing won't work. I find that for your example you may want \Bigg( \Bigg. paired with \Bigg. \Bigg)

\begin{equation*}
\begin{split}
 & \bigtriangledown h=
 \Bigg( \Bigg. 
    \frac{1}{2}\cdot \cos \left(\frac{1}{2}\cdot x\right) \cdot \cos(y)
        + \cos(x) \cdot \cos(y), 
    \frac{-1}{2} \cdot  \cos\left(\cos \left(\frac{1}{2}\cdot y\right)\right)\cdot \\ 
 & \sin\left(\frac{1}{2} \cdot y\right) 
        - \sin\left(\frac{1}{2}\cdot x\right) \cdot \sin(y) 
        - \sin(x) \cdot \sin(y) 
\Bigg. \Bigg) 
\end{split}
\end{equation*}

This now works, but I'd move the alignment point to after = so the next line is indented (or, rather, after the opening parenthesis). However, I'd first suggest to look into yet other options availed by amsmath package.

Since you do not want numbering any way, and may want to align precisely, one option that gives more control is the align environment. With your equations, rearranged a little

\usepackage{amsmath}

\begin{align*}
    \bigtriangledown h = \Bigg( \Bigg. & 
        \frac{1}{2}\cdot \cos \left(\frac{1}{2}\cdot x\right) \cdot \cos(y)
            + \cos(x) \cdot \cos(y), \\
    & -\frac{1}{2} \cdot  \cos\left(\cos \left(\frac{1}{2}\cdot y\right)\right)\cdot
        \sin\left(\frac{1}{2} \cdot y\right) \\
    &   - \sin\left(\frac{1}{2}\cdot x\right) \cdot \sin(y) 
        - \sin(x) \cdot \sin(y) \Bigg. \Bigg)
\end{align*}

There is a number of other environments for multi-line equations, to suit different cases. Here is a clear page on Aligning Equations and here is the official amsmath User's Guide (pdf).


This is the image of both examples above, first the one using align, wrapped together with

\documentclass[12pt]{article}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage{amsmath}

\begin{document}
% ... example using align environment, a line of text, example with split
\end{document}

equations

I kept the second example as in the OP but consider aligning after the = sign, as mentioned.

Share:
20,309
Admin
Author by

Admin

Updated on July 09, 2022

Comments

  • Admin
    Admin almost 2 years

    I'm writing an equation on LaTeX and when I want to close the formula with \right) it doesn't work. I'll post my code here to see if anyone can help me:

    \begin{equation*}
    \begin{split}
     &\bigtriangledown h=\left( \frac{1}{2}\cdot \cos \left(\frac{1}{2}\cdot x\right) \cdot \cos(y) + \cos(x) \cdot \cos(y),
     \frac{-1}{2} \cdot  \cos\left(\cos \left(\frac{1}{2}\cdot y\right)\right)\cdot \\ &\sin\left(\frac{1}{2} \cdot y\right) - \sin\left(\frac{1}{2}\cdot x\right) \cdot \sin(y) - \sin(x) \cdot \sin(y) \right) 
    \end{split}
    \end{equation*}