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.

closed as off-topic by Raaja, Steven B. Segletes, Phelype Oleinik, Tiuri, Mensch Feb 12 at 15:31

  • This question does not fall within the scope of TeX, LaTeX or related typesetting systems as defined in the help center.
If this question can be reworded to fit the rules in the help center, please edit the question.

  • 4
    I'm voting to close this question as off-topic because it is solved in comments. – Raaja Feb 12 at 14:31
  • @campa Thank you. I´ve overlooked the & sign. With it it just works fine – Maximilian Speicher Feb 12 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. – barbara beeton Feb 12 at 17:15
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}
  • @Raaja done :-) – MadyYuvi Feb 12 at 15:09

Not the answer you're looking for? Browse other questions tagged or ask your own question.