Line break within an align-environment

I want to write a long calculation with the align-environment. One of the lines is too long for one line though, so I want it to split into two lines , with the second line right-attached. Example: See picture. I tried every combination with equation, align, aligned, split, multline, multlined,... I could think of, sadly nothing worked so far. At the moment I solve the problem with &\hspace + ..., but I want to have a solution that is independent of the chosen font, margin, etc.

Here is a more specific example, where I need this function. It is a split cross product and I think that it looks weird if the second part of the cross product is left attached:

\documentclass{article}
\usepackage{mathtools}
\begin{document}
\begin{align*}
\mathcal{A} &= \int_0^T\int_{K_1}\left[c(\alpha,n)+\alpha|u|^2-\alpha^2(u\cdot(x-x_0))^2\left(|x-x_0|^2+h^2 \right)^{-1} \right]\\
&\hspace{7.2cm}\times\left[|x-x_0|^2+h^2 \right]^{\alpha}\tau~dx~dt\\
&\leq K\int_0^T\int_{K_1}\pi~dx~dt
\end{align*}
\end{document}


I want to replace the \hspace{7.2cm} with a margin-independent command.

• Welcome to TeX.SX! Please help us help you and add a minimal working example (MWE) that illustrates your problem. Reproducing the problem and finding out what the issue is will be much easier when we see compilable code, starting with \documentclass{...} and ending with \end{document}. – BambOo Aug 29 '18 at 12:54
• Have a look at this post, youn migh find the solutions there quite helpful – BambOo Aug 30 '18 at 10:16

IMHO, splitting long equations should always be done with more care from the author. So I always split my equations manually to get the desired output.

My preferred solution below uses the following tricks:

1. A \phantomrel command which creates a “phantom” relation symbol that occupies the same space as the underlying symbol, thus the \phantomrel{=}.
2. A \hphantom{\int_0^T \int_{K_1}} that creates a horizontal phantom space which serves as indent for the \times ... contents.
3. A \diff command dedicated for differentials.
4. A \abs command dedicated for absolute values, which must be created using \DeclarePairedDelimiter from the mathtools package. This \abs{...} has several advantages over |...|:

• Try typing $|-x|$ and $\abs{-x}$ to see the wrong spacing of the negative sign in the former expression.
• You get to enlarge the delimiters by variants \abs[\big]{-x}, \abs[\Big]{-x}, \abs[\bigg]{-x} and \abs[\Bigg]{-x}.
• There is another variant \abs*{-x} which extends delimiters automatically (like a \left and \right pair), but acts like \mathopen...\mathclose and not like \mathinner, which is better.
5. Please don’t abuse \left and \right. Sometimes they create delimiters that are too big or too small, and they create \mathinner. I used manual sizing throughout your example.

The environments you mentioned work perfectly fine.

\documentclass{article}
\usepackage{mathtools}% For multlined' and loads amsmath'
\newcommand*\phantomrel[1]{\mathrel{\phantom{#1}}}% My preferred typesetting
\newcommand*\diff{\mathop{}\!d}% Just in case your editor asks for \mathrm{d}
\DeclarePairedDelimiter\abs{\lvert}{\rvert}

\begin{document}
\noindent
Using \verb|align*| and \verb|multlined| works fine:
\begin{align*}
A & = \text{something something something} \\
& = \begin{multlined}[t][10cm]
\text{something something something anything anything} \\
+ \text{anything anything anything}
\end{multlined} \\
& = \text{anything anything anything anything}
\end{align*}
However, I~would typeset as follows instead:
\begin{align*}
A & = \text{something something something} \\
& = \text{something something something anything} \\
& \phantomrel{=} {} + \text{anything anything anything anything} \\
& = \text{anything anything anything anything}
\end{align*}
So your specific example becomes
\begin{align*}
\mathcal{A} & = \int_0^T \int_{K_1}
\Bigl[ c(\alpha,n) + \alpha\abs{u}^2
- \alpha^2 \bigl(u\cdot(x-x_0)\bigr)^2
\bigl(\abs{x-x_0}^2 + h^2\bigr)^{-1} \Bigr] \\
& \phantomrel{=} \hphantom{\int_0^T \int_{K_1}}
\times \bigl[\abs{x-x_0}^2 + h^2 \bigr]^\alpha \tau \diff x\diff t \\
& \leq K \int_0^T \int_{K_1} \pi \diff x\diff t
\end{align*}
\end{document}


• Thanks for your response! This just isn't quite what I'm looking for. I had a kind of similar solution before (using hspace in the align-environment instead of multlined plus a parameter). However, I would like to find a solution without a parameter, such that the first line of multlined in your example is left attached, the second line is right attached. So exactly like the multline environment behaves, except for that it is inside of an align environment – Carolin Aug 30 '18 at 9:35
• I attached a MWE. I have a lot of those terms in a document where I might need to change the font size or margin width. Would be a lot of work to change each parameter individually after each format change... – Carolin Aug 30 '18 at 10:14
• @Carolin Please check my updated answer. ;-) – Ruixi Zhang Aug 30 '18 at 16:35
• Thank you a lot, especially for the 'off-topic' hints. I will study them carefully and try to use them for better latex style. sometimes it is hard to let go of bad habits, if they kind of work :-D – Carolin Sep 1 '18 at 19:46
• one more question: what is the advantage of \phantomrel over \phantom ? I tried both and could not find a difference – Carolin Sep 1 '18 at 21:42

A few suggestions; the text before each of them should tell you what I'd prefer. ;-)

Another suggestion: don't use ~ for spacing differentials, but \,.

\documentclass{article}
\usepackage{mathtools}
\usepackage{showframe} % just for the example

\begin{document}

The ugly:
\begin{flalign*}
\mathcal{A}
&= \mathrlap{\int_0^T\int_{K_1}
\bigl[
c(\alpha,n)+\alpha|u|^2-\alpha^2(u\cdot(x-x_0))^2(|x-x_0|^2+h^2)^{-1}
\bigr]} &\\
&&&\mathllap{{}\times\bigl[\,|x-x_0|^2+h^2\bigr]^{\alpha}\tau\,dx\,dt}\\
&\leq \mathrlap{K\int_0^T\int_{K_1}\pi\,dx\,dt}
\end{flalign*}

\begin{flalign*}
&= \mathrlap{\int_0^T\int_{K_1}
\bigl[
c(\alpha,n)+\alpha|u|^2-\alpha^2(u\cdot(x-x_0))^2(|x-x_0|^2+h^2)^{-1}
\bigr]} &\\
&\leq \mathrlap{K\int_0^T\int_{K_1}\pi\,dx\,dt}
\end{flalign*}

The good:
\begin{align*}
\mathcal{A}
&= \int_0^T\int_{K_1}
\begin{aligned}[t]
&\bigl[
c(\alpha,n)+\alpha|u|^2-\alpha^2(u\cdot(x-x_0))^2(|x-x_0|^2+h^2)^{-1}
\bigr] \\

The showframe package makes the text block evident by drawing a frame around it.