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.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I would like to realize an alignment like the following:


So I would like formulaformula1 and formulaformulaformula2 to be left aligned, while formula3 and formula4 should be left aligned with a specific position in formulaformulaformula2.

Also I want to frame it with \fbox and put the box in the center.

share|improve this question

Assuming that you want this in a displaymath format \[...\], then you might just as well insert the equation in an array since it allows for easy bordering:

\usepackage{array}% http://ctan.org/pkg/array
\usepackage{lipsum}% http://ctan.org/pkg/lipsum
    a_0+a_1x+a_2x^2=b_2y^2-b_1y-b_0 \\
    c_3z^3\times c_4z^4\times c_5z^5\times c_6z^6\geq a+b+c+d+e \\
    \phantom{c_3z^3\times c_4z^4\times{}}c_5z^5-9pq+b\ell\alpha h \\
    \phantom{c_3z^3\times c_4z^4\times{}}E=mc^2 \\

Equation with alignment as specific location relative to other components

The goal here is to use \phantom{<stuff>} to duplicate <stuff> that you want to use as your alignment tool, but not typeset.

share|improve this answer
  • For multi-line formulas with alignment, amsmath environments such as align are useful. For example, alignat* could be used for equations with multiple alignment places. These environments are appropriate for aligning at relation signs such as equal signs, because of consistent spacing around the relation signs.

  • For boxing equations, the empheq package is useful. It offers amsmath support and various customizations.

Here's an example:

    &ax + by + c + {}&&x = 0 \\
    &ab = c &\\

The first two equations are left aligned, the third equation x is aligned with the x in the first equation. Alignment at equal signs is not even used yet.

aligned multiline formula with box

share|improve this answer
but the spacing of c+x of the first equation is pretty bad. Isn't it a weakness of the alignat environment? – pluton Aug 20 '11 at 13:04
@pluton: it can be easily fixed by inserting an empty word such as c + {}&&x: so the + gets spacing as a relation sign, I'll edit above. It's not a weakness of alignat. With alignat just be aware of the intention of typesetting in rl columns. – Stefan Kottwitz Aug 20 '11 at 13:13
What if the width of the second line(ab=c) is larger than the one of the first line? I want them to be left-justified... – SoftTimur Aug 28 '11 at 3:40

Your Answer


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.