3

I have to use a line break in my equation. But the content in the extra line is squashed to the right. But If I try aligning it with "&" all the content gets massively pushed to the right. Here is the code without alignment:

\begin{align*}
  \phi_{ij}^{(k+1)} =\underset{\phi_{ij} \in \mathbb{R}^k}{\argmax} \langle \phi_{ij}, (\nabla\cdot(2u^{(k+1)}-u^{(k)}))_{ij} - (\nabla_G\cdot(2w^{(k+1)}-w^{(k)}))_{ij} - \lambda^0_{ij}+\lambda^1_{ij}\rangle \\
   - \frac{1}{2\tau}(\phi_{ij} -\phi_{ij}^{(k)})^2  \\
   \Rightarrow 0 \overset{!}{=} (\nabla\cdot(2u^{(k+1)}-u^{(k)}))_{ij} - (\nabla_G\cdot(2w^{(k+1)}-w^{(k)}))_{ij} - \lambda^0_{ij}+\lambda^1_{ij} \\
   + \frac{1}{\tau}(\phi_{ij} - \phi^{(k)}_{ij}) \\
   \phi^{(k+1)}_{ij}:=\phi_{ij} = \phi_{ij}^{(k)} + \tau ((\nabla\cdot(2u^{(k+1)}-u^{(k)}))_{ij} \\
   - (\nabla_G\cdot(2w^{(k+1)}-w^{(k)}))_{ij} - \lambda^0_{ij}+\lambda^1_{ij})
\end{align*}

This is the best I can do. But in red I marked, what I actually want to do. enter image description here

3
  • Off-topic: your MWE it is not complete. In fact missing all \documentclass and \DeclareMathOperator*{\argmax}{arg\,max}.
    – Sebastiano
    Sep 25, 2021 at 23:38
  • You can use alignat enviroment instead of align.
    – Sebastiano
    Sep 25, 2021 at 23:44
  • 4
    Your example doesn't contain a single &, which is the designated indicator for the alignment point. You seem to be aware of this because you have mentioned & in the title. The & is best placed before a sign of relation, and if a continuation line does not include a sign of relation, place the & at the beginning followed by \quad. If you omit the & from any line, that line will be assumed to be wanted on the left-hand side, shoving all other lines to the right. Sep 26, 2021 at 2:36

3 Answers 3

5

You can use the split environment within the align* environment along with ampersand(&).

\documentclass{article}

\usepackage{amsmath}
\usepackage{amsfonts}
\DeclareMathOperator*{\argmax}{arg\,max} %Assuming, as not defined in question 


\begin{document}
    \begin{align*}
        \begin{split}
        \phi_{ij}^{(k+1)} ={}& \underset{\phi_{ij} \in \mathbb{R}^k}{\argmax} \langle \phi_{ij}, (\nabla\cdot(2u^{(k+1)}-u^{(k)}))_{ij} - (\nabla_G\cdot(2w^{(k+1)}-w^{(k)}))_{ij} - \lambda^0_{ij}+\lambda^1_{ij}\rangle \\
        & - \frac{1}{2\tau}(\phi_{ij} -\phi_{ij}^{(k)})^2  \\
        \end{split}\\
        \begin{split}
         \Rightarrow 0 \overset{!}{=}{}& (\nabla\cdot(2u^{(k+1)}-u^{(k)}))_{ij} - (\nabla_G\cdot(2w^{(k+1)}-w^{(k)}))_{ij} - \lambda^0_{ij}+\lambda^1_{ij} \\
        &+ \frac{1}{\tau}(\phi_{ij} - \phi^{(k)}_{ij}) \\
        \end{split}\\
        \begin{split}
        {}&\phi^{(k+1)}_{ij}:=\phi_{ij} = \phi_{ij}^{(k)} + \tau ((\nabla\cdot(2u^{(k+1)}-u^{(k)}))_{ij} \\
        &- (\nabla_G\cdot(2w^{(k+1)}-w^{(k)}))_{ij} - \lambda^0_{ij}+\lambda^1_{ij})
        \end{split}
    \end{align*}
    
\end{document}

output

5

Edit:

Since your page layout is unknown, it is difficult to suggest a solution for your problem. For simple move second lines to the left at use of article document class with default page layout your equation protrude oft of text area:

By using article document class, mathtools package, align math environment and standard syntax for adding arguments to math functions:

\documentclass{article}
\usepackage{mathtools, amssymb}
\DeclareMathOperator*{\argmax}{arg\,max}

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

\begin{document}
    \begin{align*}
\phi_{ij}^{(k+1)} 
     = {}   &  \argmax_{\phi_{ij} \in \mathbb{R}^k} 
                \Bigl\langle \phi_{ij},
                \Bigl(\nabla\cdot\bigl(2u^{(k+1)}-u^{(k)}\bigr)\Bigr)_{ij}
                - \Bigl(\nabla_G\cdot\bigl(2w^{(k+1)}-w^{(k)}\bigr)\Bigr)_{ij}
                - \lambda^0_{ij}+\lambda^1_{ij}
                \Bigr\rangle \\
            & - \frac{1}{2\tau}\bigl(\phi_{ij} - \phi_{ij}^{(k)}\bigr)^2    \\[2ex]
%
\Rightarrow 0 \overset{!}{=}{}
            & \Bigl(\nabla\cdot\bigl(2u^{(k+1)}-u^{(k)}\bigr)\Bigr)_{ij} 
                - \Bigl(\nabla_G\cdot\bigl(2w^{(k+1)}-w^{(k)}\bigr)\Bigr)_{ij} - \lambda^0_{ij}+\lambda^1_{ij} \\
            & + \frac{1}{\tau}\bigl(\phi_{ij} - \phi^{(k)}_{ij}\bigr)       \\[2ex]
%
\phi^{(k+1)}_{ij}
\coloneqq {}&   \phi_{ij} = \phi_{ij}^{(k)} 
                + \tau \Bigl(\bigl(\nabla\cdot(2u^{(k+1)}-u^{(k)}\bigr)\Bigr)_{ij} \\
            & - \Bigl(\nabla_G\cdot\bigl(2w^{(k+1)}-w^{(k)}\bigr)\Bigr)_{ij} 
                - \lambda^0_{ij}+\lambda^1_{ij}\Bigr)
    \end{align*}
\end{document}

enter image description here

(red lines indicate part of page layout)

As you can see, first equation protrude right text area border. This can be solved by push one term more from the first line of the first equation to the second line:

\phi_{ij}^{(k+1)}
     = {}   &  \argmax_{\phi_{ij} \in \mathbb{R}^k}
                \Bigl\langle \phi_{ij},
                \Bigl(\nabla\cdot\bigl(2u^{(k+1)}-u^{(k)}\bigr)\Bigr)_{ij}  \\
            &    - \Bigl(\nabla_G\cdot\bigl(2w^{(k+1)}-w^{(k)}\bigr)\Bigr)_{ij}
                - \lambda^0_{ij}+\lambda^1_{ij}
                \Bigr\rangle 
              - \frac{1}{2\tau}\bigl(\phi_{ij} - \phi_{ij}^{(k)}\bigr)^2    \\[2ex]

which gives:

enter image description here

In the case, that you may define page layout with wider text area, for example by employ geometry package, a possible solution can be:

\documentclass{article}
\usepackage{geometry}
\usepackage{mathtools, amssymb}
\DeclareMathOperator*{\argmax}{arg\,max}

\begin{document}
    \begin{align*}
\phi_{ij}^{(k+1)} 
     = {}   &  \argmax_{\phi_{ij} \in \mathbb{R}^k} 
                \Bigl\langle \phi_{ij},
                \Bigl(\nabla\cdot\bigl(2u^{(k+1)}-u^{(k)}\bigr)\Bigr)_{ij}
                - \Bigl(\nabla_G\cdot\bigl(2w^{(k+1)}-w^{(k)}\bigr)\Bigr)_{ij}
                - \lambda^0_{ij}+\lambda^1_{ij}
                \Bigr\rangle \\
            & - \frac{1}{2\tau}\bigl(\phi_{ij} - \phi_{ij}^{(k)}\bigr)^2    \\[2ex]
%
\Rightarrow 0 \overset{!}{=}{}
            & \Bigl(\nabla\cdot\bigl(2u^{(k+1)}-u^{(k)}\bigr)\Bigr)_{ij} 
                - \Bigl(\nabla_G\cdot\bigl(2w^{(k+1)}-w^{(k)}\bigr)\Bigr)_{ij} 
                - \lambda^0_{ij}+\lambda^1_{ij} 
             + \frac{1}{\tau}\bigl(\phi_{ij} - \phi^{(k)}_{ij}\bigr)       \\[2ex]
%
\phi^{(k+1)}_{ij}
\coloneqq {}&   \phi_{ij} = \phi_{ij}^{(k)} 
                + \tau \Bigl(\bigl(\nabla\cdot(2u^{(k+1)}-u^{(k)}\bigr)\Bigr)_{ij} 
                - \Bigl(\nabla_G\cdot\bigl(2w^{(k+1)}-w^{(k)}\bigr)\Bigr)_{ij} 
                - \lambda^0_{ij}+\lambda^1_{ij}\Bigr)
    \end{align*}
\end{document}

which produce:

enter image description here

3

Here's a solution that re-arranges your layout to (a) keep any particular row from producing an "overfull \hbox" warning, (b) reduce the sizes of the "fences" (round parentheses and square brackets), and (c) organize the material somewhat consistently the three pairs of lines.

The frame lines in the following screenshot serve to denote the left had and right hand edges of the text block.

enter image description here

\documentclass{article}
\usepackage{mathtools} % for '\coloneqq' macro
\usepackage{amssymb}   % for '\mathbb' macro
\DeclareMathOperator*{\argmax}{arg\,max}

\begin{document}
\begin{align*}
\phi_{ij}^{(k+1)} 
     &=  \argmax_{\phi_{ij} \in \mathbb{R}^k} \,
         \Bigl\langle \phi_{ij},
               \bigl(\nabla\cdot(2u^{(k+1)}-u^{(k)})\bigr)_{ij}
             - \bigl(\nabla_{\!G}\cdot(2w^{(k+1)}-w^{(k)})\bigr)_{ij}\\
     &\quad  - \lambda^0_{ij}+\lambda^1_{ij} \Bigr\rangle 
             - \frac{1}{2\tau}(\phi_{ij} - \phi_{ij}^{(k)})^2  \\[2\jot]
%
\Rightarrow 0 
     &\overset{!}{=}
               \bigl(\nabla\cdot(2u^{(k+1)}-u^{(k)})\bigr)_{ij} 
             - \bigl(\nabla_{\!G}\cdot(2w^{(k+1)}-w^{(k)})\bigr)_{ij} \\
     &\quad  - \lambda^0_{ij}+\lambda^1_{ij} 
             + \frac{1}{\tau}(\phi_{ij} - \phi^{(k)}_{ij}) \\[2\jot]
%
\phi^{(k+1)}_{ij} 
     &\coloneqq\phi_{ij} = \phi_{ij}^{(k)} + \tau\bigl[        
               \bigl(\nabla\cdot(2u^{(k+1)}-u^{(k)})\bigr)_{ij} 
             - \bigl(\nabla_{\!G}\cdot(2w^{(k+1)}-w^{(k)})\bigr)_{ij} \\
     &\quad  - \lambda^0_{ij}+\lambda^1_{ij} \bigr]           
\end{align*}
\end{document}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.