# How to Align Equation Exactly in Multiple Places

I want to align the below equations at the start and at each equal sign. I have already looked at some previous questions and used their suggestions. However when I tried it in the below code, the some of the equal signs are not exactly aligned with each other. I have no idea why that is the case.

\documentclass[a4paper, 11pt, letterpaper]{article}
\usepackage{fullpage}
\usepackage{mathtools,amsthm}
\begin{document}
\begin{alignat*}{4}
&\sin \theta &= \sin (180 ^{\circ}-\theta ) &= -\sin (270 ^{\circ} + \theta) &= - \sin (360 ^{\circ} - \theta)\\
&\cos \theta &= -\cos (180 ^{\circ}-\theta ) &= -\cos (270 ^{\circ} + \theta) &=  \cos (360 ^{\circ} - \theta)\\
&\tan \theta &= -\tan (180 ^{\circ}-\theta ) &= \tan (270 ^{\circ} + \theta) &=  -\tan (360 ^{\circ} - \theta)
\end{alignat*}
\end{document}


• – Werner Feb 7 '18 at 1:38

You possibly want a more symmetric alignment:

\documentclass[a4paper,11pt]{article}
\usepackage{fullpage}
\usepackage{mathtools}

\newcommand{\pl}[1]{(#1^{\circ}-\theta)}

\begin{document}

\begin{alignat*}{4}
% R          L     R              L    R               L    R
\sin \theta &={} & \sin \pl{180} &={} &-\sin \pl{270} &={} &-\sin \pl{360} \\
\cos \theta &={} &-\cos \pl{180} &={} &-\cos \pl{270} &={} & \cos \pl{360} \\
\tan \theta &={} &-\tan \pl{180} &={} & \tan \pl{270} &={} &-\tan \pl{360}
\end{alignat*}

\end{document}


The ={} bits are to coerce TeX into adding the right space after the relation symbol. I added markers for remembering the column alignment (pairs of Right and Left aligned columns).

The \pl macro avoids clumsy and error prone input.

Here's the complete table, with the error fixed (the tangent of theta is the cotangent of 270 minus theta).

\documentclass[a4paper,11pt]{article}
\usepackage{fullpage}
\usepackage{mathtools}

\newcommand{\pl}[1]{(#1^{\circ}-\theta)}

\begin{document}

\begin{alignat*}{5}
% R          L     R              L    R               L    R             L      R
\sin \theta &={} & \cos\pl{90} &={} & \sin \pl{180} &={} &-\sin \pl{270} &={} &-\sin \pl{360} \\
\cos \theta &={} & \sin\pl{90} &={} &-\cos \pl{180} &={} &-\cos \pl{270} &={} & \cos \pl{360} \\
\tan \theta &={} & \cot\pl{90} &={} &-\tan \pl{180} &={} & \cot \pl{270} &={} &-\tan \pl{360}
\end{alignat*}

\end{document}


• Wow. Very good for your wonderful works. +1 – Sebastiano Feb 7 '18 at 10:01

If you use the alignat environment then the entries will be aligned alternately to the right and to the left:   right-left-right-left -... (because we are constructing several equations of type a = b c = d ...)

In your code, the initial & of each line produces an unwanted effect (aligns to the left!). So you have to delete it. And, additionally, from the second =, you will have to correct the alignment with a double &.

However, it is probably more aesthetic to align also the functions, so in the negative entries it will be better to write &=-& (instead of &&-).

Here you have the two options:

\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{alignat*}{3}
\sin \theta &= \sin (180 ^{\circ}-\theta ) &&= -\sin (270 ^{\circ} + \theta) &&= - \sin (360 ^{\circ} - \theta)\\
\cos \theta &= -\cos (180 ^{\circ}-\theta )&&= -\cos (270 ^{\circ} + \theta) &&=  \cos (360 ^{\circ} - \theta)\\
\tan \theta &= -\tan (180 ^{\circ}-\theta )&&= \tan (270 ^{\circ} + \theta)  &&=  -\tan (360 ^{\circ} - \theta)
\end{alignat*}
\begin{alignat*}{4}
\sin \theta &= &\sin (180 ^{\circ}-\theta ) &= -&\sin (270 ^{\circ} + \theta) &= - &\sin (360 ^{\circ} - \theta)\\
\cos \theta &= -&\cos (180 ^{\circ}-\theta ) &= -&\cos (270 ^{\circ} + \theta) &=  &\cos (360 ^{\circ} - \theta)\\
\tan \theta &= -&\tan (180 ^{\circ}-\theta ) &= &\tan (270 ^{\circ} + \theta) &=  -&\tan (360 ^{\circ} - \theta)
\end{alignat*}
\end{document}