This may be a standard question, but in 15 years of (la)TeX I still haven't found a proper solution to the following problem:
suppose I'm writing a long calculation of the form
X= X1
= X2
= X3
etc
I use amslatex align environment to get all the = signs aligned.
so far, so good.
now, what if one of the r.h.s., say X2, is too long to fit on a line?
I'd like to be able to split it in such a way that the first half is aligned due to the equal sign, and the second half is *shoved to the right*. but despite the plethora of (semi-useless) commands in amslatex, there seems to be no way to position that second half properly. I end up using something like
&=X2a \\ &\hskip{5cm} X2b \\
where the actual hskip has to be adjusted for each equation. This is a very unsatisfactory solution. Anyone know a better one?
Math & Science ⇒ Splitting formulae inside aligned equation
NEW: TikZ book now 40% off at Amazon.com for a short time.

-
- Posts: 274
- Joined: Fri Feb 05, 2010 10:15 pm
Re: Splitting formulae inside aligned equation
"Shoved to the right" On the same line?
Re: Splitting formulae inside aligned equation
no, shoved to the right on the next line (since it's too long to fit on one)
Re: Splitting formulae inside aligned equation
I have exactly the same problem...
Splitting formulae inside aligned equation
fine, I'll answer myself...
Here's a possibility, but clearly not optimal:
(in particular should probably do something about tags/eqnos)
Here's a possibility, but clearly not optimal:
Code: Select all
\newcommand\rightalign[1]{\noalign{\vbox{\hfill $\displaystyle #1$}}}
\begin{align*}
A&=B1
\\
&=B2a
\\
\rightalign{B2b}
&=B3
\end{align*}
Last edited by Stefan Kottwitz on Mon Dec 26, 2011 9:19 pm, edited 1 time in total.
- Stefan Kottwitz
- Site Admin
- Posts: 10345
- Joined: Mon Mar 10, 2008 9:44 pm
Re: Splitting formulae inside aligned equation
Great, thank you for posting the solution you found!
Stefan
Stefan
LaTeX.org admin