Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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.

share|improve this question
    
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 at 9:59
    
Probably the multlined environment of mathtools can help. –  egreg Apr 11 at 9:59

2 Answers 2

up vote 6 down vote accepted

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

share|improve this answer
    
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 at 10:20
    
@daleif I agree, but it depends on the expressions which we don't know the content of. –  egreg Apr 11 at 10:22
    
Multilined did the trick thank you. –  magu_ Apr 11 at 11:19

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

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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