0

I have the following code:

        \begin{equation}
            \frac{\partial S}{\partial \epsilon^M} =
            \underbrace{ \frac{1}{2S} }_{\text{square root }} \cdot 
            \frac{1}{N} \cdot 
            \underbrace{ 2\sum_{i=1}^{N} \left[ \left( \log(\epsilon^M_i)-\log(\epsilon^S_i) \right) }_{\text{power}} \cdot 
            \underbrace{ \frac{1}{\epsilon^M_i}  }_{\text{logarithm}}
            \right]
        \end{equation}

That returns the following output:

It seems to me that \underbrace has some conflict with left[-right] type of commands.

How can I fix the code?

6
  • What did you expect? I see no conflict (just a very confusing formula).
    – egreg
    May 25, 2016 at 12:24
  • 1
    Do you want all your underbraces on the same level? Use \vphantom to make them all the same vertical size. May 25, 2016 at 12:26
  • @egreg the right] bracket is missing -.-'
    – shamalaia
    May 25, 2016 at 12:32
  • 1
    @A_C You certainly get at least an error from this code; the final \right] is completely misplaced.
    – egreg
    May 25, 2016 at 12:34
  • 2
    Matching \left and \right must be at the same level of grouping. You can't have \left[ in the argument to \underbrace and the matching \right] outside it. Use \biggl[ instead of \left[ and \biggr] instead of \right]. Remove the inner \left and \right that serve no purpose.
    – egreg
    May 25, 2016 at 12:43

1 Answer 1

1

Matching \left and \right must be at the same level of grouping. You can't have \left[ in the argument to \underbrace and the matching \right] outside it. Use \biggl[ instead of \left[ and \biggr] instead of \right]. Remove the inner \left and \right that serve no purpose.

According to your input you seem to want something like this:

\documentclass{article}
\usepackage{amsmath}

\begin{document}

\begin{equation}
\newcommand{\eqstrut}{\vphantom{2\sum_{i=1}^{N}}}
\frac{\partial S}{\partial \epsilon^M} =
{\underbrace{\eqstrut \frac{1}{2S} }
  _{\substack{\text{square} \\ \text{root}}}} \cdot
\frac{1}{N} \cdot
{\underbrace{ 2\sum_{i=1}^{N} \biggl[ ( \log(\epsilon^M_i)-\log(\epsilon^S_i) ) }
  _{\text{power}}} \cdot
{\underbrace{\eqstrut \frac{1}{\epsilon^M_i}  }_{\text{logarithm}}}
\!\biggr]
\end{equation}

\end{document}

enter image description here

I don't think this markup has a sensible meaning, though.

You must log in to answer this question.

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