方程式 - 数値を方程式と同じ行に保つ

方程式 - 数値を方程式と同じ行に保つ

これらの方程式があり、その数値は同じ行にあります。

\begin{equation}
    i_t = \sigma(W_{xi} * X_t + W_ {hi} * H_{t-1} + W_{ci} \circ C_{t-1} + b_i)
\end{equation}
\begin{equation}
    f_t = \sigma(W_{xf} * X_t + W_ {hf} * H_{t-1} + W_{cf} \circ C_{t-1} + b_f)
\end{equation}
\begin{equation}
    C_t = f_t \circ C_{t-1} + i_t \circ \textnormal{tanh}(W_{xc} * X_t + W_{hc} * H_{t-1} + b_c)
\end{equation}
\begin{equation}
    o_t = \sigma(W_{xo} * X_t + W_ {ho} * H_{t-1} + W_{co} \circ C_{t} + b_o)
\end{equation}

ここに画像の説明を入力してください

しかし、このフォーマットを行うと、数字が同じ行に表示されなくなります。数字を強制的に同じ行に表示するにはどうすればよいでしょうか?

\begin{align}
  i_t &= \sigma(W_{\!\textit{xi}} * X_t + W_{\textit{hi}} * H_{t-1} + W_{\!\textit{ci}} \circ C_{t-1} + b_i)\\
  f_t &= \sigma(W_{\!\textit{xf}} * X_t + W_{\textit{hf}} * H_{t-1} + W_{\!\textit{cf}} \circ C_{t-1} + b_f)\\
  C_t &= f_t \circ C_{t-1} + i_t \circ \text{tanh}(W_{\!\textit{xc}} * X_t + W_{\!\textit{hc}} * H_{t-1} + b_c)\\
  o_t &= \sigma(W_{\!\textit{xo}} * X_t + W_{\!\textit{ho}} * H_{t-1} + W_{\!\textit{co}} \circ C_{t} + b_o)
\end{align}

ここに画像の説明を入力してください

答え1

式(3)の右側の部分を簡略化して短くする方法が見つからない限り、最善の解決策はその部分に意図的に改行を入れることです。

ここに画像の説明を入力してください

\documentclass{article}
\usepackage{amsmath} % for 'align' environment
\newcommand\vn[1]{\textit{#1}}
\usepackage{newtxtext,newtxmath} % optional
\setlength\textwidth{3in} % just for this example
\begin{document}

\begin{align}
  i_t &= \sigma(W_{\!\vn{xi}} * X_t + W_{\vn{hi}} * H_{t-1} + W_{\!\vn{ci}} \circ C_{t-1} + b_i)\\
  f_t &= \sigma(W_{\!\vn{xf}} * X_t + W_{\vn{hf}} * H_{t-1} + W_{\!\vn{cf}} \circ C_{t-1} + b_{\vn{f}})\\
  C_t &= f_t \circ C_{t-1} \notag \\
      &\qquad + i_t \circ \text{tanh}(W_{\!\vn{xc}} * X_t + W_{\vn{hc}} * H_{t-1} + b_c)\\
  o_t &= \sigma(W_{\!\vn{xo}} * X_t + W_{\vn{ho}} * H_{t-1} + W_{\!\vn{co}} \circ C_{t} + b_o)
\end{align}
\end{document}

関連情報