公式超出了 LaTeX 中 IEEE 模式的一列,我该如何纠正?请帮忙,代码随附于此。
\begin{equation}\label{eq11}
p\left( {v,h|u,y,...} \right) = {\rm{RelU}}\left( {\left[ {\hat b + {w^h}\left\{ {\left( {{v^T}{w^v}} \right) \circ \left( {{y^T}{w^y}} \right)} \right\}} \\ \right]*\left[ {\hat a + {w^v}\left\{ {\left( {{h^T}{w^h}} \right) \circ \left( {{y^T}{w^y}} \right)} \right\}} \right]} \right)
\end{equation}
答案1
环境中不能换行equation
。可能有几种方法可以做到这一点,一种是使用multline
from amsmath
,另一种是使用split
内部的环境equation
。请注意,\left
/\right
不能跨越换行符,并且您有很多不需要的括号对。
\documentclass{IEEEtran}
\usepackage{lipsum}
\usepackage{amsmath}
\DeclareMathOperator{\RelU}{RelU}
\begin{document}
\lipsum*[1]
\begin{multline}\label{eq11}
p(v,h|u,y,...) =
\RelU\bigl( \bigl[ \hat b + w^h \{ ( v^T w^v ) \circ ( y^T w^y ) \} \bigr]* \\
\bigl[ \hat a + w^v \{ ( h^T w^h ) \circ ( y^T w^y ) \} \bigr] \bigr)
\end{multline}
\lipsum[2]
\begin{equation}\label{eq12}
\begin{split}
p(v,h|u,y,...) &=
\RelU\bigl( \bigl[ \hat b + w^h \{ ( v^T w^v ) \circ ( y^T w^y ) \} \bigr]* \\
&\phantom{{}=\RelU\bigl(} \bigl[ \hat a + w^v \{ ( h^T w^h ) \circ ( y^T w^y ) \} \bigr] \bigr)
\end{split}
\end{equation}
\lipsum
\end{document}
答案2
我建议使用multline
。我借此机会改进并简化了代码:
\documentclass{ieeetran}
\usepackage{mathtools}
\usepackage{lipsum}
\begin{document}
\lipsum[1]
\begin{multline}\label{eq11}
p\bigl(v,h\mid u,y\dots \bigr) = \\
\mathrm{RelU}\Bigl( \Bigl[ {\hat b + {w^h}\bigl\{\bigl(v^T w^v \bigr) \circ \bigl(y^T w^y \bigr) \bigr\}}\Bigr] \\ *
\Bigl[ {\hat a + {w^v}\bigl\{ \bigl(h^Tw^h \bigl) \circ \bigl( y^T w^y \bigr) \bigr\}} \Bigr] \Bigr)
\end{multline}
\end{document}
答案3
我更喜欢equation
环境,因为split
它可以自动垂直对齐方程编号并且稍微更紧凑。
\documentclass{article}
\usepackage[a4paper, total={3in, 9in}]{geometry}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\begin{document}
\textbf{this is with multiline package}
\begin{multline}\label{eq11}
p\bigl(v,h\mid u,y\dots \bigr) = \\
\mathrm{RelU}\Bigl( \Bigl[ {\hat b + {w^h}\bigl\{\bigl(v^T w^v \bigr) \circ \bigl(y^T w^y \bigr) \bigr\}}\Bigr] \\ *
\Bigl[ {\hat a + {w^v}\bigl\{ \bigl(h^Tw^h \bigl) \circ \bigl( y^T w^y \bigr) \bigr\}} \Bigr] \Bigr)
\end{multline}
\textbf{this is with equation package}
\begin{equation}\label{eq11}
\begin{split}
p\bigl(v,h\mid u,y\dots \bigr) = \\
\mathrm{RelU}\Bigl( \Bigl[ {\hat b + {w^h}\bigl\{\bigl(v^T w^v \bigr) \circ \bigl(y^T w^y \bigr) \bigr\}}\Bigr] \\ *
\Bigl[ {\hat a + {w^v}\bigl\{ \bigl(h^Tw^h \bigl) \circ \bigl( y^T w^y \bigr) \bigr\}} \Bigr] \Bigr)
\end{split}
\end{equation}
\end{document}