Align* environment. beautification.

  • MHB
  • Thread starter caffeinemachine
  • Start date
In summary: Yes, you will need to use the array package. In your preamble, add \usepackage{array} and then the script should compile properly.
  • #1
caffeinemachine
Gold Member
MHB
816
15
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?
 
Physics news on Phys.org
  • #2
caffeinemachine said:
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.
 
  • #3
Opalg said:
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?
 
  • #4
caffeinemachine said:
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.)
 

Attachments

  • tex.gif
    tex.gif
    6.3 KB · Views: 74
  • #5
Opalg said:
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?
 
  • #6
Opalg said:
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.
 
  • #7
Opalg said:
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?
 
  • #8
caffeinemachine said:
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:
  • #9
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}
 

FAQ: Align* environment. beautification.

What is the purpose of using the Align* environment?

The Align* environment is used to align multiple equations or mathematical expressions in a single line. It is commonly used in typesetting mathematical equations in a document.

How do you beautify equations using the Align* environment?

To beautify equations using the Align* environment, you can use various formatting commands such as \quad, \qquad, \hspace, or \hfill to add spacing between equations. You can also use the \limits command to change the limits of a summation or integral symbol.

Can you align equations with different operators using the Align* environment?

Yes, the Align* environment allows you to align equations with different operators, such as addition, subtraction, multiplication, and division. You can use the & symbol to indicate the alignment point for each equation.

How do you add labels to equations in the Align* environment?

To add labels to equations in the Align* environment, you can use the \label command before or after the equation you want to label. Then, you can refer to the label using the \ref command to add a reference number to the equation.

Is the Align* environment compatible with all LaTeX packages?

Yes, the Align* environment is compatible with most LaTeX packages, including amsmath and mathtools. However, some packages may not work well with the Align* environment, so it is always best to check the package documentation before use.

Similar threads

Replies
1
Views
830
Replies
7
Views
1K
Replies
13
Views
2K
Replies
18
Views
1K
Replies
7
Views
2K
Replies
8
Views
2K
Back
Top