2

I'm quite new to LaTex and I guess I need some help. I'm writing a report and I need to display a specific formula. If I use the simple equation environment the formula gets too long for one line. Therefore I tried to use the split envornment inside the equation environment. Here is my code:

\begin{equation} 
\begin{split}

K_{b}   &=  \sqrt{ \max \left( 0, \sum_{k} \max \left( CVR_{k},0\right)^{2}\\
    &+  \sum_{k} \sum_{k\neq l} \rho_{kl} CVR_{k}CVR_{l}\psi \left(CVR_{k},CVR_{l}\right)
    \right)
}
\end{split}
\end{equation}

If I apply this code I'm getting the following error message:

Missing } inserted. \end{split}

Do you have any idea how to display the formula correctly?

Thanks in advance!!

Kind regards, Felix

1

2 Answers 2

3
  • I used the align environment.
  • In addition, using \left( and \right. to open a bracket and close it invisible to be able to split.
  • I used \notag to avoid the equation number in the first line.
  • I avoided the sqrt by using ^{1/2}.
  • Make sure to read Big Parenthesis in an Equation, see \biggl and \biggr as an alternative approach to the automatic bracket size (\left and \right).
  • You can use \vphantom to force the same size for all brackets in different lines, see Linebreak between \left and \right for example.
  • I think that most of my code needs the amsmath package (or mathtools which builds on amsmath).

\documentclass{article}

\usepackage{amsmath}

\begin{document}

\section*{Original}

\begin{equation} 
K_{b}   =   \left(\max 
            \left( 0, \sum_{k} \max 
            \left( CVR_{k},0
            \right)^{2}
            + 
            \sum_{k} \sum_{k\neq l} \rho_{kl} CVR_{k}CVR_{l} \psi 
            \left(CVR_{k},CVR_{l}
            \right)
            \right)
            \right)^{1/2}
\end{equation}

\section*{Basic Idea}

\begin{align} 
K_{b}   = &     \left( \max \left( \right. \right. \\
            & + 
            \left. abc \left. \right) \right)           
\end{align}

\section*{Proposal}

\begin{align} 
K_{b}   = &     \left( \max  \left(  
            0, \sum_{k} \max \left( CVR_{k},0 \right)^{2}
            \right. \right.
            +
            \notag
            \\
            & +
            \left. \left.
        \sum_{k} \sum_{k\neq l} \rho_{kl} CVR_{k}CVR_{l} \psi   \left(CVR_{k},CVR_{l}       \right) 
            \right) \right)^{\frac{1}{2}}           
\end{align}


\end{document}

enter image description here


(added by daleif)

In a case like this auto scaling should not be used as it easily comes out in the wrong size. Here are two example with manual scaling. The latter use the fact that are are a bit away whatever is tall, so we do not need the fences that all, plus using different inner braces makes it a lot easier to match what ever goes together.

\begin{align} 
K_{b}   = &     \biggl( \max  \biggl(  
            0, \sum_{k} \max ( CVR_{k},0 )^{2}
            +
            \notag
            \\
            & +
            \sum_{k} \sum_{k\neq l} \rho_{kl} CVR_{k}CVR_{l} \psi   (CVR_{k},CVR_{l}       ) 
            \biggr) \biggr)^{\frac{1}{2}}           
\end{align}
\begin{align} 
K_{b}   = &     \Bigl( \max  \Bigl\{  
            0, \sum_{k} \max ( CVR_{k},0 )^{2}
            +
            \notag
            \\
            & +
            \sum_{k} \sum_{k\neq l} \rho_{kl} CVR_{k}CVR_{l} \psi   (CVR_{k},CVR_{l}       ) 
            \Bigr\} \Bigr)^{\frac{1}{2}}           
\end{align}

enter image description here

3
  • I'd probably make the ()'s smaller as they are far from whatever is tall.
    – daleif
    Jul 14, 2017 at 9:52
  • @daleif I see what you mean :). I have to work now (proper work) -- feel free to edit the question. Jul 14, 2017 at 10:09
  • 1
    Added a little extra
    – daleif
    Jul 14, 2017 at 10:23
0

You can easily avoid having to split your equation, in two ways:

Replacing the double sum with a single sum with a double index and using the \mediummath command from nccmath (ca 80 % of \displaystyle):

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{mathtools}
\usepackage[showframe]{geometry}

\begin{document}
\vspace*{1cm}

\begin{equation}
  K_{b} = \sqrt{\max \Bigl( 0, \sum_{k} \max \left( CVR_{k},0\right)^{2}
    +\smashoperator{ \sum_{k, l ~k \neq l}} \rho_{kl} CVR_{k}CVR_{l}\psi \left(CVR_{k},CVR_{l}\right)
    \Bigr)}
\end{equation}

\end{document} 

enter image description here

If you don't use margin notes, loading the geometry package will give you more decent default margins, which are enough to have the formula in displaystyle:

 \documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{mathtools, nccmath}
\usepackage{showframe}
\renewcommand{\ShowFrameLinethickness}{0.3pt}

\begin{document}
\vspace*{1cm}

\begin{equation}
  \medmath{K_{b} = \sqrt{\max \Bigl( 0, \sum_{k} \max \left( CVR_{k},0\right)^{2}
      +\smashoperator{ \sum_{k, l ~k \neq l}} \rho_{kl} CVR_{k}CVR_{l}\psi \left(CVR_{k},CVR_{l}\right)
      \Bigr)}}
\end{equation}

\end{document} 

enter image description here

You must log in to answer this question.

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