# align* environment. beautification.

#### caffeinemachine

##### Well-known member
MHB Math Scholar
Using the align* environment I have the following output.
\begin{align*}
\bigcap_{i=1}^{r}(\sigma_i\circ\varphi_i)^{-1}(j)&=\bigcap_{i=1}^{r}(\tau_i\circ\varphi_i)^{-1}(l)\neq\emptyset\\
\Rightarrow(\sigma_i\circ\varphi_i)^{-1}(j)&=(\tau_i\circ\varphi_i)^{-1}(l),\forall i\in\{1,\ldots,r\}~~~(\text{from prop. 9})\\
\Rightarrow\varphi_i^{-1}(\sigma_i^{-1}(j))&=\varphi_i^{-1}(\tau_i^{-1}(l))\\
\Rightarrow\sigma_i^{-1}(j)&=\tau_i^{-1}(l)
\end{align*}

This looks ugly. How can I make it look better?

#### Opalg

##### MHB Oldtimer
Staff member
Using the align* environment I have the following output.
\begin{align*}
\bigcap_{i=1}^{r}(\sigma_i\circ\varphi_i)^{-1}(j)&=\bigcap_{i=1}^{r}(\tau_i\circ\varphi_i)^{-1}(l)\neq\emptyset\\
\Rightarrow(\sigma_i\circ\varphi_i)^{-1}(j)&=(\tau_i\circ\varphi_i)^{-1}(l),\forall i\in\{1,\ldots,r\}~~~(\text{from prop. 9})\\
\Rightarrow\varphi_i^{-1}(\sigma_i^{-1}(j))&=\varphi_i^{-1}(\tau_i^{-1}(l))\\
\Rightarrow\sigma_i^{-1}(j)&=\tau_i^{-1}(l)
\end{align*}

This looks ugly. How can I make it look better?
Is this any better?

Code:
\begin{array}{rr@{\; = \;}l}
&\bigcap_{i=1}^{r}(\sigma_i\circ\varphi_i)^{-1}(j)&\bigcap_{i=1}^{r}(\tau_i\circ\varphi_i)^{-1}(l)\neq\emptyset\\
\Longrightarrow&(\sigma_i\circ\varphi_i)^{-1}(j)&(\tau_i\circ\varphi_i)^{-1}(l),\forall i\in\{1,\ldots,r\}~~~(\text{from prop. 9})\\
\Longrightarrow&\varphi_i^{-1}(\sigma_i^{-1}(j))&\varphi_i^{-1}(\tau_i^{-1}(l))\\
\Longrightarrow&\sigma_i^{-1}(j)&\tau_i^{-1}(l)
\end{array}
It does not compile properly here, because Mathjax does not understand the @{\; = \;} specifier in the array description, and so the = signs get left out altogether. But it looks good in TeXShop.

The best I can do using Mathjax is

Code:
\begin{array}{rrcl}
&\bigcap_{i=1}^{r}(\sigma_i\circ\varphi_i)^{-1}(j)&=&\bigcap_{i=1}^{r}(\tau_i\circ\varphi_i)^{-1}(l)\neq\emptyset\\
\Longrightarrow&(\sigma_i\circ\varphi_i)^{-1}(j)&=&(\tau_i\circ\varphi_i)^{-1}(l),\forall i\in\{1,\ldots,r\}~~~(\text{from prop. 9})\\
\Longrightarrow&\varphi_i^{-1}(\sigma_i^{-1}(j))&=&\varphi_i^{-1}(\tau_i^{-1}(l))\\
\Longrightarrow&\sigma_i^{-1}(j)&=&\tau_i^{-1}(l)
\end{array}
That compiles under Mathjax as $$\begin{array}{rrcl} &\bigcap_{i=1}^{r}(\sigma_i\circ\varphi_i)^{-1}(j)&=&\bigcap_{i=1}^{r}(\tau_i\circ\varphi_i)^{-1}(l)\neq\emptyset\\ \Longrightarrow&(\sigma_i\circ\varphi_i)^{-1}(j)&=&(\tau_i\circ\varphi_i)^{-1}(l),\forall i\in\{1,\ldots,r\}~~~(\text{from prop. 9})\\ \Longrightarrow&\varphi_i^{-1}(\sigma_i^{-1}(j))&=&\varphi_i^{-1}(\tau_i^{-1}(l))\\ \Longrightarrow&\sigma_i^{-1}(j)&=&\tau_i^{-1}(l) \end{array}$$

which does not look good to me because there is too much space on each side of the = signs.

#### caffeinemachine

##### Well-known member
MHB Math Scholar
Is this any better?

Code:
\begin{array}{rr@{\; = \;}l}
&\bigcap_{i=1}^{r}(\sigma_i\circ\varphi_i)^{-1}(j)&\bigcap_{i=1}^{r}(\tau_i\circ\varphi_i)^{-1}(l)\neq\emptyset\\
\Longrightarrow&(\sigma_i\circ\varphi_i)^{-1}(j)&(\tau_i\circ\varphi_i)^{-1}(l),\forall i\in\{1,\ldots,r\}~~~(\text{from prop. 9})\\
\Longrightarrow&\varphi_i^{-1}(\sigma_i^{-1}(j))&\varphi_i^{-1}(\tau_i^{-1}(l))\\
\Longrightarrow&\sigma_i^{-1}(j)&\tau_i^{-1}(l)
\end{array}
It does not compile properly here, because Mathjax does not understand the @{\; = \;} specifier in the array description, and so the = signs get left out altogether. But it looks good in TeXShop.

The best I can do using Mathjax is

Code:
\begin{array}{rrcl}
&\bigcap_{i=1}^{r}(\sigma_i\circ\varphi_i)^{-1}(j)&=&\bigcap_{i=1}^{r}(\tau_i\circ\varphi_i)^{-1}(l)\neq\emptyset\\
\Longrightarrow&(\sigma_i\circ\varphi_i)^{-1}(j)&=&(\tau_i\circ\varphi_i)^{-1}(l),\forall i\in\{1,\ldots,r\}~~~(\text{from prop. 9})\\
\Longrightarrow&\varphi_i^{-1}(\sigma_i^{-1}(j))&=&\varphi_i^{-1}(\tau_i^{-1}(l))\\
\Longrightarrow&\sigma_i^{-1}(j)&=&\tau_i^{-1}(l)
\end{array}
That compiles under Mathjax as $$\begin{array}{rrcl} &\bigcap_{i=1}^{r}(\sigma_i\circ\varphi_i)^{-1}(j)&=&\bigcap_{i=1}^{r}(\tau_i\circ\varphi_i)^{-1}(l)\neq\emptyset\\ \Longrightarrow&(\sigma_i\circ\varphi_i)^{-1}(j)&=&(\tau_i\circ\varphi_i)^{-1}(l),\forall i\in\{1,\ldots,r\}~~~(\text{from prop. 9})\\ \Longrightarrow&\varphi_i^{-1}(\sigma_i^{-1}(j))&=&\varphi_i^{-1}(\tau_i^{-1}(l))\\ \Longrightarrow&\sigma_i^{-1}(j)&=&\tau_i^{-1}(l) \end{array}$$

which does not look good to me because there is too much space on each side of the = signs.
Thank you opalg. I want to use the first script since you say its better.. but my editor ain't able to compile it because of {rr@{\; = \;}l}. I am using TeXworks. Is there some package I need to download?

#### Opalg

##### MHB Oldtimer
Staff member
Thank you opalg. I want to use the first script since you say its better.. but my editor ain't able to compile it because of {rr@{\; = \;}l}. I am using TeXworks. Is there some package I need to download?
I don't know why some compilers fail to process the @-expression in an array environment. It is listed in the LaTeX User's Guide as a standard part of the system (see here, for example). On my Mac, the TeXShop compiler renders that code as

(Click on that thumbnail to see what it really looks like.)

#### caffeinemachine

##### Well-known member
MHB Math Scholar
I don't know why some compilers fail to process the @-expression in an array environment. It is listed in the LaTeX User's Guide as a standard part of the system (see here, for example). On my Mac, the TeXShop compiler renders that code as
(Click on that thumbnail to see what it really looks like.)
Hmm.. It'd be great if we could "center" the LHS and RHS. This "inverted-triangular" shape it making it look bad. Any solution?

#### caffeinemachine

##### Well-known member
MHB Math Scholar
I don't know why some compilers fail to process the @-expression in an array environment. It is listed in the LaTeX User's Guide as a standard part of the system (see here, for example). On my Mac, the TeXShop compiler renders that code as
(Click on that thumbnail to see what it really looks like.)
Now I understand how the array environment works. Centering makes it look worse. I'll go with the same as you have in the quoted text. Thanks.

#### caffeinemachine

##### Well-known member
MHB Math Scholar
I don't know why some compilers fail to process the @-expression in an array environment. It is listed in the LaTeX User's Guide as a standard part of the system (see here, for example). On my Mac, the TeXShop compiler renders that code as
(Click on that thumbnail to see what it really looks like.)
I ran into another problem. The array environment works well when I want to manipulate my text.. but I am not able to tag my equations. \tag doesn't work. I also tried \hfill but that fails too. The only thing which seems to work is '~' but this is not practical. What can I do to label equations in the array environment?

#### dwsmith

##### Well-known member
I ran into another problem. The array environment works well when I want to manipulate my text.. but I am not able to tag my equations. \tag doesn't work. I also tried \hfill but that fails too. The only thing which seems to work is '~' but this is not practical. What can I do to label equations in the array environment?

You can pretty much tag anything if you add (below to your preamble):
Code:
\newcommand{\tagthisaux}{%
\refstepcounter{equation}%
(\theequation)%
}
\newcommand{\tagthisline}{\\tagthisaux}
Then at the end you would add:

Code:
\tagthisline
Example:
Code:
\begin{array}{ccc}
& = & \tagthisline\\
& = &
\end{array}`
The first line would be numbered and the second wouldn't. Additionally, the numbering convetion will follow in order to what you already have. That is, if you were on equation (1.2), that line would be (1.3).

I haven't looked at this post previously since it was marked solved. If it wasn't marked solved, I would have answered your last question sooner.

Last edited:

#### Klaas van Aarsen

##### MHB Seeker
Staff member
I usually prefer left aligned and to columnize everything:

\begin{array}{clclll}
&\bigcap_{i=1}^{r}(\sigma_i\circ\varphi_i)^{-1}(j)&=&\bigcap_{i=1}^{r}(\tau_i\circ\varphi_i)^{-1}(l)&\neq\emptyset\\
\Longrightarrow&(\sigma_i\circ\varphi_i)^{-1}(j)&=&(\tau_i\circ\varphi_i)^{-1}(l)&\forall i\in\{1,\ldots,r\}&~~~(\text{from prop. 9})\\
\Longrightarrow&\varphi_i^{-1}(\sigma_i^{-1}(j))&=&\varphi_i^{-1}(\tau_i^{-1}(l))\\
\Longrightarrow&\sigma_i^{-1}(j)&=&\tau_i^{-1}(l)
\end{array}