[Tex/LaTex] Right align in eqnarray

alignequations

I have a MWE where I use eqnarray for multiline equations. I want to right align those two text, but \hfill is not working here.

I think I may use align, but here just want to know how to do it with eqnarray.

\documentclass[]{beamer}

\begin{document}

\begin{frame}
\frametitle{Example}
\begin{eqnarray*}
A &=& B + C \hfill (\Leftarrow \text{from Theorem 1}) \\
  &=& D + E \hfill (\Leftarrow \text{from Corollary 2}) \\
  &=& F 
\end{eqnarray*}
\end{frame}

\end{document}

Best Answer

Try this with align:

enter image description here

\documentclass[]{beamer}

\begin{document}

\begin{frame}
\frametitle{Example}
\begin{align*}
A &= B + C && (\Leftarrow \text{from Theorem 1}) \\
  &= D + E && (\Leftarrow \text{from Corollary 2}) \\
  &= F &&
\end{align*}
\end{frame}

\end{document}

Or alternatively exploiting the \tag{<content>} command:

enter image description here

\documentclass[]{beamer}

\begin{document}

\begin{frame}
\frametitle{Example}
\begin{align}
A &= B + C  \tag{$\Leftarrow$ from Theorem 1} \\
  &= D + E  \tag{$\Leftarrow$ from Corollary 2} \\
  &= F \notag
\end{align}
\end{frame}