0

I´m trying to align multiple equations below each other using align. However the equations are aligned at the right end instead of centered and aligned at the equal sign.

My Latex code looks like this:

\begin{align}
\mathbf{i}_{t} = \sigma(\mathbf{W}_{xi}\mathbf{x}_{t} + 
\mathbf{W}_{hi}\mathbf{h}_{t-1} + \mathbf{W}_{ci}\circ\mathbf{c}_{t-1} + 
\mathbf{b}_{i})\\
\mathbf{f}_{t} = \sigma(\mathbf{W}_{xf}\mathbf{x}_{t} + 
\mathbf{W}_{hf}\mathbf{h}_{t-1} + \mathbf{W}_{cf}\circ\mathbf{c}_{t-1} + 
\mathbf{b}_{f})\\
\mathbf{c}_{t} = \mathbf{f}_{t}\circ\mathbf{c}_{t-1} + \mathbf{i}_{t}\circ 
tanh(\mathbf{W}_{xc}\mathbf{x}_{t} + \mathbf{W}_{hc}\mathbf{h}_{t-1} + 
\mathbf{b}_{c})
\end{align}

And the output generated looks like this:

enter image description here

However the equations should be aligned at the equal sign. I´ve already tried multiple approaches but I simply can´t get it to work.

Thank you for your help.

3
  • 4
    I'm voting to close this question as off-topic because it is solved in comments. Commented Feb 12, 2019 at 14:31
  • @campa Thank you. I´ve overlooked the & sign. With it it just works fine Commented Feb 12, 2019 at 14:41
  • 1
    @MaximilianSpeicher -- It seems that you are not really familiar with the niceties of amsmath. You should consider reading the user's guide -- texdoc amsldoc at a command line if you are using a TeX Live installation. Commented Feb 12, 2019 at 17:15

1 Answer 1

8

You should give & symbol, where you want to align:

\documentclass{book}
\usepackage{amsmath}
\begin{document}

\begin{align}
\mathbf{i}_{t} &= \sigma(\mathbf{W}_{xi}\mathbf{x}_{t} + 
\mathbf{W}_{hi}\mathbf{h}_{t-1} + \mathbf{W}_{ci}\circ\mathbf{c}_{t-1} + 
\mathbf{b}_{i})\\
\mathbf{f}_{t} &= \sigma(\mathbf{W}_{xf}\mathbf{x}_{t} + 
\mathbf{W}_{hf}\mathbf{h}_{t-1} + \mathbf{W}_{cf}\circ\mathbf{c}_{t-1} + 
\mathbf{b}_{f})\\
\mathbf{c}_{t} &= \mathbf{f}_{t}\circ\mathbf{c}_{t-1} + \mathbf{i}_{t}\circ 
\tanh(\mathbf{W}_{xc}\mathbf{x}_{t} + \mathbf{W}_{hc}\mathbf{h}_{t-1} + 
\mathbf{b}_{c})
\end{align}

\end{document}
1
  • @Raaja done :-)
    – MadyYuvi
    Commented Feb 12, 2019 at 15:09

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