5

I want to center the top equation and only align the next 2. How do i do this ?

\documentclass{article}
\usepackage[twocolumn,margin=2cm]{geometry}
\usepackage{amsmath}
\begin{document}

\begin{align}
  e_l = [0, \textbf{Emb}(l_\text{human}), \textbf{Emb}(l_1), ..., \textbf{Emb}(l_N)] \\
    [\hat{y}'^{t}, \ldots, \hat{x}'_m] &= \textbf{Transformer}(\bar{f} + e_l)\\
    [\hat{y}, \ldots, \hat{x}_m] &= [\hat{y}' + c_*, \ldots, \hat{x}'_m + c_*]
\end{align}

\end{document}

enter image description here

1 Answer 1

6

You could use align inside gather:

\documentclass{article}
\usepackage{amsmath}

\begin{document}

\begin{gather}
  e_l = [0, \mathbf{Emb}(l_{\mathrm{human}}), \mathbf{Emb}(l_1), \dots, \mathbf{Emb}(l_N)] \\
  \begin{align}
    [\hat{y}'^{t}, \dots, \hat{x}'_m] &= \mathbf{Transformer}(\bar{f} + e_l)\\
    [\hat{y}, \dots, \hat{x}_m] &= [\hat{y}' + c_*, \dots, \hat{x}'_m + c_*]
\end{align}
\end{gather}

\end{document}

enter image description here

This has a quirk, though. because you won't be able to label the equations inside align (a long standing bug of amsmath).

As an alternative, you can use IEEEeqnarray:

\documentclass{article}
\usepackage{amsmath}
\usepackage{IEEEtrantools}

\begin{document}

\begin{IEEEeqnarray}{rCl}
\IEEEeqnarraymulticol{3}{c}{
  \hidewidth
  e_l = [0, \mathbf{Emb}(l_{\mathrm{human}}), \mathbf{Emb}(l_1), \dots, \mathbf{Emb}(l_N)]
  \hidewidth
}\label{A} \\
  \relax
  [\hat{y}'^{t}, \dots, \hat{x}'_m] &=& \mathbf{Transformer}(\bar{f} + e_l) \label{B} \\
  \relax
  [\hat{y}, \dots, \hat{x}_m] &=& [\hat{y}' + c_*, \dots, \hat{x}'_m + c_*] \label{C}
\end{IEEEeqnarray}

\eqref{A}, \eqref{B}, \eqref{C}

\end{document}

The \hidewidth commands are necessary because otherwise you'd not get centering, as the line is longer than the other two.

The two \relax are necessary because the lines start with [.

enter image description here

Note that \textbf and \text aren't the correct commands for the intended job. I replaced them with \mathbf and \mathrm.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .