5

I have multiple lines of equations in align environment, some of those are to long and I have to split them. How can I make the second line rightbound? What I do now is:

\documentclass[oneside,a4paper]{hepthesis}
\usepackage{amssymb}

\begin{document}
    \begin{align}
    a &= blabla
    a &= loooooooooooooooooooooooooooongexpression \notag \\
    & + \text{~~~~~~~~~~~} loooooooooooooooooooooooooooongexpression
\end{align}
\end{document}

Which is of course quite ugly and in now way as it supposed to be done.

  • A dirty trick is to use \hspace{1000pt} and then check the size of the resulting overfull hbox in the log file. If it's overfull by n points, change 1000 to 1000 - n. – Ian Thompson Apr 11 '14 at 9:59
  • Probably the multlined environment of mathtools can help. – egreg Apr 11 '14 at 9:59
6

There is no concept of “right bound”. You can use two strategies that differ for how the equation number is placed.

multlined (from the mathtools package)

\documentclass[oneside,a4paper]{hepthesis}
\usepackage{mathtools,amssymb}

\begin{document}

\begin{align}
  a &= blabla \\
  a &= \begin{multlined}[t]
       loooooooooooooooooooooooooooongexpression \\
       loooooooooooooooooooooooooooongexpression
       \end{multlined}
\end{align}

\end{document}

enter image description here

split inside align

Note the tbtags option for amsmath. Without it, the number would be placed vertically centered with respect to the split.

\documentclass[oneside,a4paper,tbtags]{hepthesis}
\usepackage{amssymb}

\begin{document}

\begin{align}
  a &= blabla \\
  \begin{split}
  a &= loooooooooooooooooooooooooooongexpression \\
    &\qquad\qquad loooooooooooooooooooooooooooongexpression
  \end{split}
\end{align}

\end{document}

enter image description here

  • In my view, the indentation should depend on the expression, if the break is at a non-fenced binary (like a +), then I don't think there should be any extra indentation (other than getting the + aligned on the right of the =. – daleif Apr 11 '14 at 10:20
  • @daleif I agree, but it depends on the expressions which we don't know the content of. – egreg Apr 11 '14 at 10:22
1

If you want to "right bind" the last part ot an equation, you'll have to play with flalign and the \mathllap (and incidentally \mathrlap) command defined by the mathtools package:

\documentclass[11pt, oneside,a4paper]{report}
\usepackage{mathtools}
\usepackage[showframe, nomarginpar]{geometry}

\begin{document}

    \begin{flalign}
 &  &     a &= blabla  &  & \mbox{\,}\\
  &  &    a &= loooooooooooooooooooooooooooongexpression   \notag \\[-4pt]
 &  &     & &&\mathllap{+ ~~~~~~~~~~~loooooooooooooooooooooooooooongexpression}
\end{flalign}

    \begin{flalign}
 &  &     a &= blabla  &  & \mbox{\,}\\
  &  &    a &= loooooooooooooooooooooooooooo\mathrlap{ngexpression}  &  & {\,}  \notag \\[-4pt]
 &  &     & &&\mathllap{+ ~~~~~~~~~~~loooooooooooooooooooooooooooongexpression}
\end{flalign}

\end{document} 

enter image description here

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.