# Question regarding a mathmode definition layout

I have been trying to get

S0    = 0
Si+1  =   { .... }
U { ........}
U { ... }


definition layout in LaTeX, but have been unsuccessful for hours.

My main problem is that the unions have to be aligned differently than the =.

I hope there is anyone that can help me.

-
Hi codd, welcome to tex exchange! I inserted the code snippet for you using the {}. I also removed the thanks- it seems strange, but it helps to keep the forum in a 'Question and Answer' format :) Have you tried the various environments from the amsmath package? It seems your problem could be solved using one of align, aligned, etc –  cmhughes Apr 2 '12 at 20:05

This is another case where (as an exception to the general rule) putting the relation symbol before the & can help:

\begin{align}
S_{0}={}  & 0\\
\begin{split}
S_{i+1}={}& \mathbin{\hphantom{\cup}}\{...\}\\
& \cup\{...\}\\
& \cup\{...\}
\end{split}
\end{align}


If you don't need to number the formulas, you can omit the \begin{split} and \end{split} and change align into align*.

The reason why this is needed is to ensure correct spacing after the \cup symbols.

-
I like the combined alignand split. Also, less code clutter. –  Christoph Apr 2 '12 at 20:30
does the OP want the Ss aligned? if so, the following will do it (it's a kludge): S_{0\hphantom{+i}} –  barbara beeton Apr 2 '12 at 20:33
\mathbin was new to me, so I searched and found this: tex.stackexchange.com/questions/38982/… I think it might be useful to others reading the answers given here. –  Christoph Apr 2 '12 at 20:55
@barbarabeeton thanks! I did want that as well. –  codd Apr 3 '12 at 12:46

I used amsmath's split environment and a phantom for the missing U in the second equation:

\documentclass[varwidth,fleqn]{standalone}
\usepackage{amsmath}
\begin{document}
\noindent
$$\begin{split} S_0 = & 0 \\ S_{i+1} = & \phantom{U} \left\{ \ldots \right\}\\ & U \left\{ \ldots \right\} \end{split}$$
\end{document}


You can leave out the subscripts if you wish.

I just noticed that this is a possible duplicate of Multi horizontal alignment in mathmode

Updated - after applying the recommendations from the comments, here's my second take:

\documentclass[varwidth,fleqn]{standalone}
\usepackage{amsmath}
\begin{document}
\noindent
$$\begin{split} S_{0\phantom{+1}} & = 0 \\ S_{i+1} & = \phantom{\cup} \left\{ \ldots \right\}\\ & \mathrel{\phantom{=}} \cup \left\{ \ldots \right\} \end{split}$$
\end{document}


-
Please note: first the separator than the relation: tex.stackexchange.com/questions/50445/… –  Marco Daniel Apr 2 '12 at 20:14
I'd recommend moving the alignment character to the left of the equal, adding the appropriate \phantom to get the S terms aligned left as desired by the OP, and using an appropriate symbol for union. In which case I can delete my answer. –  Peter Grill Apr 2 '12 at 20:15
@Peter: Your answer is closer to what the OP wants, isn't it? Anyway, I'll edit my answer according to the recommendations - they're good, after all. –  Christoph Apr 2 '12 at 20:17
Christoph, thanks for the (quick) answer. I will upvote your answer, but I am accepting egreg's because I am using it (because I find it more comprehensive). –  codd Apr 2 '12 at 20:28
two problems: (1) in the first line, the spacing after the = is too tight (add an empty group {} as a kludge; (2) it's not a U, but a union \cup. better would be to put the & before the = and adjust spacing manually. not straightforward. –  barbara beeton Apr 2 '12 at 20:30

You current ASCII alignment suggests both "columns" to be left-aligned. As such, here's an array approach to achieve your output:

\documentclass{article}
%\usepackage{amsmath}% http://ctan.org/pkg/amsmath
\begin{document}
$\begin{array}{l@{\;}c@{\;}l} S_0 &=& 0 \\ S_{i+1} &=& \phantom{\cup}\:\{\ldots\} \\ & & \cup\:\{\ldots\} \\ & & \cup\:\{\ldots\} \end{array}$
\end{document}


Instead of using U for set union, use \cup. The spacing adjustments (using \; and \: corrects any problems introduced by array due to column spacing.

You'll notice that the vertical alignment is slightly different (tighter) to that of the other solutions using align from amsmath. To obtain a similar alignment, use \\[\jot] for line endings rather than just \\.

-