1
\begin{eqnarray*}
M&=& \max{\left \{a,b,\frac{a+b}{2},\right}\\
&& a+b,a+b/2\Bigg\}
\end{eqnarray*}
CarLaTeX
  • 62,716
  • 2
    Welcome to TeX.SE. Please provide the document that causes the error, not the stuff that does compile 'separately'. And don't use eqnarray*, that's outdated –  Sep 17 '17 at 08:02
  • 2
    To get the code to compile, you must (a) delete the curly brace ({) after \max and (b) change \right} to \right. Moreover, you really shouldn't be using eqnarray -- it's badly deprecated! Load the amsmath package and use align instead. See the posting eqnarray vs align for further details. – Mico Sep 17 '17 at 08:14
  • 2
    It may show correct output when alone, but you get an error message, namely ! Missing delimiter (. inserted). Never disregard error messages. – egreg Sep 17 '17 at 09:37

2 Answers2

3

I recommend the use of package amsmath, some options with environment split:

\documentclass{article}
\usepackage{amsmath}

\begin{document}
\begin{gather*}
  \begin{split}
    M = {} & \max\biggl\{ a, b, \frac{a+b}{2},\\
           & a + b, a + \frac{b}{2} \biggr\}
  \end{split}
\end{gather*}

\begin{gather*}
  \begin{split}
    M = \max\biggl\{& a, b, \frac{a+b}{2},\\
                    & a + b, a + \frac{b}{2} \biggr\}
  \end{split}
\end{gather*}

\begin{gather*}
  \begin{split}
    M = {} & \max\{ a, b, (a+b)/2,\\
           & a + b, a + b/2\}
  \end{split}
\end{gather*}
\end{document}

Result

Heiko Oberdiek
  • 271,626
2

To answer the question, you get

! Missing delimiter (. inserted).

Why do you get “correct” output? Because TeX adds . after \right, which is missing a delimiter after it; then the } balances the { after \max and all gets in sync. You might fix it by adding the period yourself and removing the useless braces

\begin{eqnarray*}
M&=& \max\left \{a,b,\frac{a+b}{2},\right.\\
&& a+b,a+b/2\Bigg\}
\end{eqnarray*}

You get

enter image description here

but this is wrong to begin with.

Firstly, because eqnarray is buggy and should not be used for serious work: use amsmath environments instead (see eqnarray vs align). Secondly, it's apparent that the braces have different size.

When you split delimiters across lines, both should be given the same size, either automatically or manually. In the case of standard two story fractions the size is \bigg; but they should be \biggl and \biggr (for left and right) in order to get correct horizontal spacing. Hence

\begin{eqnarray*}
M&=& \max\biggl\{a,b,\frac{a+b}{2},\\
&& a+b,a+b/2\biggr\}
\end{eqnarray*}

might do, but if you look closely, the spaces around the equals sign are awfully big:

enter image description here

Do you notice the differences with the top picture? Here is what we get with \Bigl and \Bigr instead:

enter image description here

Depending on personal preference, you may want to use such smaller size.

Anyway, you should follow Heiko's suggestions as explained in his answer.

\documentclass[twocolumn]{article}
\usepackage{amsmath}

\usepackage{lipsum} % just for giving context

\begin{document}

\lipsum*[1]
\begin{equation*}
\begin{split}
M=\max\biggl\{ & a,b,\frac{a+b}{2},\\
              & a+b,a+\frac{b}{2}
      \biggr\}
\end{split}
\end{equation*}
\lipsum[2-15]

\end{document}

enter image description here

egreg
  • 1,121,712