2

I'm using the following packages:

\usepackage{mathrsfs}
\usepackage{mathtools}
\usepackage{amsmath,latexsym}

in order to write the following equation.

\begin{eqnarray*}
\frac{\partial\mathscr{L}}{\partial(\partial_\nu A_\mu)} =-\frac{1}{4} \left[ 
\left(\frac{\partial(\partial_\sigma A_\omega)}{\partial(\partial_\nu A_\mu)}
 -\frac{\partial(\partial_\omega A_\sigma)}{\partial(\partial_\nu A_\mu)}\right)
(\partial_\alpha A_\beta-\partial_\beta A_\alpha) 
 + (\partial_\sigma A_\omega - \partial_\omega A_\sigma)
\left(\frac{\partial(\partial_\alpha A_\beta)}{\partial(\partial_\nu A_\mu)}
 -\frac{\partial(\partial_\beta A_\alpha)}{\partial(\delta_\nu A_\mu)}\right) 
\right]
\end{eqnarray*}

The problem is that the equation is too long for a single line. When I try to break it on the "plus" sign, it no longer recognizes the last \right] command, and my brackets do not close. I Checked the code several times, it seems correct.

Any Ideas?

Mico
  • 506,678

3 Answers3

3

it seems that for your long equation is multlined appropriate math environment:

\documentclass{article}
\usepackage{mathrsfs}
\usepackage{mathtools, amssymb}

%---------------- show page layout. don't use in a real document!
\usepackage{showframe}
\renewcommand\ShowFrameLinethickness{0.15pt}
\renewcommand*\ShowFrameColor{\color{red}}
%---------------------------------------------------------------%

\begin{document}
    \begin{multline*}
\frac{\partial\mathscr{L}}{\partial(\partial_\nu A_\mu)}
    = -\frac{1}{4} \left[\left(
            \frac{\partial(\partial_\sigma A_\omega)}
                 {\partial(\partial_\nu A_\mu)}
          - \frac{\partial(\partial_\omega A_\sigma)}
                 {\partial(\partial_\nu A_\mu)}\right)\right.
           (\partial_\alpha A_\beta-\partial_\beta A_\alpha)        \\
      + (\partial_\sigma A_\omega - \partial_\omega A_\sigma)
        \left.\left(
            \frac{\partial(\partial_\alpha A_\beta)}
                 {\partial(\partial_\nu A_\mu)}
          - \frac{\partial(\partial_\beta A_\alpha)}
                 {\partial(\delta_\nu A_\mu)}\right)\right]
    \end{multline*}
\end{document}

enter image description here

(red lines indicate text borders)

Zarko
  • 296,517
3

You wrote,

I Checked the code several times, it seems correct.

Actually, it is not correct: TeX syntax rules do not allow line breaks inside a \left[...\right] group. The solution is not to use \left and \right to begin with. Instead, do use \biggl[ and \biggr].

Here's a solution which uses an align* environment -- please don't use the badly deprecated eqnarray* environment -- and rearranges the multiplicative terms in the second row so that than can be aligned with the corresponding terms in the first row. And, all auto-sizing directives have been replaced with the explicit-sizing instructions \biggl and \biggr.

enter image description here

\documentclass{article}
\usepackage{mathrsfs}  % for '\mathscr' macro
\usepackage{mathtools}
\usepackage{%amsmath, % is loaded automatically by 'mathtools' package
            amssymb}   % not 'latexsym'!

\begin{document}

\begin{align*}
\frac{\partial\mathscr{L}}{\partial(\partial_\nu A_\mu)}
=-\frac{1}{4} \biggl[ 
&\biggl(\frac{\partial(\partial_\sigma A_\omega)}{\partial(\partial_\nu A_\mu)}
-\frac{\partial(\partial_\omega A_\sigma)}{\partial(\partial_\nu A_\mu)}\biggr)
(\partial_\alpha A_\beta-\partial_\beta A_\alpha)\\
{}+{} % make '+' act like a binary, not unary, operator
&\biggl(\frac{\partial(\partial_\alpha A_\beta)}{\partial(\partial_\nu A_\mu)}
-\frac{\partial(\partial_\beta A_\alpha)}{\partial(\delta_\nu A_\mu)}\biggr)
(\partial_\sigma A_\omega - \partial_\omega A_\sigma) 
\biggr]
\end{align*}
\end{document}
Mico
  • 506,678
1

For the sake of completeness I'd like to suggest an automated solution using breqn. It can break a display math equation respecting \left and \right delimiters. An example without any change inside the formula:

\documentclass{article}
\usepackage{amsmath}
\usepackage{mathrsfs}
\usepackage{breqn}
\begin{document}
\begin{dmath*}
\frac{\partial\mathscr{L}}{\partial(\partial_\nu A_\mu)}
  =-\frac{1}{4}\left[\left(
      \frac{\partial(\partial_\sigma A_\omega)}{\partial(\partial_\nu A_\mu)}
      -\frac{\partial(\partial_\omega A_\sigma)}{\partial(\partial_\nu A_\mu)}\right)
      (\partial_\alpha A_\beta-\partial_\beta A_\alpha) 
      + (\partial_\sigma A_\omega - \partial_\omega A_\sigma)
      \left(\frac{\partial(\partial_\alpha A_\beta)}{\partial(\partial_\nu A_\mu)}
        -\frac{\partial(\partial_\beta A_\alpha)}{\partial(\delta_\nu A_\mu)}
      \right)\right]
\end{dmath*}
\end{document}

The result mimics multline:

enter image description here

  • All answers really were really helpfull! Ended up using the {dmath*} enviroment becouse it was more convenient for the rest of the code. I like to use \left and \right, it feels more organized. I think it scales automatically with the size of the rest of the terms. Thank you, guys!

    OBS.: About my equation: I forgot about the metric tensor \eta^{\alpha\sigma}\eta^{\beta\omega} after the fraction 1/4. The rest shoud be all right!

    – Omar Silveira Mar 06 '19 at 20:46