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 would like to do the closest thing there is to opening an align* environment inside another align* environment. In other words: it would be great if there were an environment, call it Align, that allows you to use to symbols to align equations in math mode using a specified number of aligning symbols &1, &2, ..., &n. For example something that works like this:

\begin{Align*}[2] &1 1=1 \\ &1 4 &2= 2+2 \\ &2 = 1+1+1+1 \\ &1 7 = 7 \end{Align*} 

which I would want to look like

1 = 1
4 = 2+2 =
  = 1+1+1+1
7=7

Does there exist such an environment?

I tried looking in this guide but I couldn't find anything, and I'm just a beginner... thanks for any help!

share|improve this question
    
The amsmath package provides lots of useful environments for equations. Have a look at alignat. –  Ian Thompson May 3 '12 at 19:49
    
I had heard of alignat but it doesn't seem to have multiple symbols and I also couldn't find the documentation. If someone answers the question using alignat to show me how to write my (stupid) example I would be very grateful :D –  Emilio Ferrucci May 3 '12 at 20:00
2  
Welcome to TeX.SX! No, there isn't. Maybe if you make a more significant example we could suggest something good. Nice to meet another Italian mathematician! –  egreg May 3 '12 at 20:04
    
Is something like \begin{alignat*}{3} 1 &= 1 \4 &= 2+2 &&=\ &= 1+1+1+1 &&=4\7 &=7 \end{alignat*} yield what you are looking for? –  Peter Grill May 3 '12 at 20:12
1  
@Emilio: if you use TeX Live, you can run texdoc amsmath in a terminal to get the amsmath documentation. Following the link that Ian Thompson provided in his comment, you will also find (at the bottom of the page) links to the amsmath's documentation in several languages. –  Gonzalo Medina May 3 '12 at 20:23
show 2 more comments

1 Answer 1

up vote 3 down vote accepted

If you only have a single alignment position, a regular align would suffice. For multiple alignment positions, use alignat:

\documentclass{article}
\usepackage{amsmath}% http://ctan.org/pkg/amsmath
\begin{document}
\begin{alignat*}{3}
  1 &= 1             \\
  4 &= 2+2     & &=  \\
    &= 1+1+1+1 & &=4 \\
  7 &= 7
\end{alignat*} 
\end{document}

enter image description here

The alignat environment allows you to specify the number of alignment positions.

Herbert's mathmode document provides some informative examples on the different amsmath environments and usage. Specifically, see Part II amsmath package (p 43). An example of your output request is on p 46.

share|improve this answer
add comment

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.