我有一个非常基本的问题。我正在尝试使用 beamer 准备演示文稿,我需要将一个图形和 2 行方程放在另一个图形下方。我可以单独放置图形,但当我添加方程时,我无法在输出中看到它。我正在使用 overleaf。我在下面分享了我在该框架中使用的代码。该图形是一个 svg,我按照建议将其转换为正确的版本这里。
代码:
\begin{frame}[fragile]{ Recurrent Neural Networks(RNNs)}
\begin{figure}
\centering
\def\svgwidth{\columnwidth}
\input{rnn.pdf_tex}
\caption{Recurrent Neural Network unfolded in time}
\end{figure}
\begin{eqnarray}\label{rnn-eq}
h_{t} &=& f(W_{hx}x_{t} + W_{hh}h_{t-1} + b) \\
y_{t} &=& g(W_{yh}h_{t} + c)
\end{eqnarray}
\end{frame}
电流输出:
答案1
像这样?
显然你的图像太高了,框架中会有空间图像和方程。因为你的图像相对简单,所以我使用包重新绘制它tikz
:
\documentclass{beamer}
\usepackage{amsmath}
\usepackage{tikz}
\usetikzlibrary{chains,
positioning,}
\begin{document}
\begin{frame}[fragile]{ Recurrent Neural Networks (RNNs)}
\begin{figure}
\centering
\begin{tikzpicture}[
node distance = 6mm and 8mm,
start chain = A going right,
box/.style = {draw, rounded corners,
minimum size=8mm, outer sep=0pt},
circ/.style = {circle, draw, dashed,
minimum size=10mm, inner sep=1pt, outer sep=0pt},
]
\foreach \i/\j/\k [count=\n] in {h_{t-1}/y_{t-1}/x_{t-1}, h_{t}/y_{t}/x_{t}, h_{t+1}/y_{t+1}/x_{t+1}}
{
\node[circ,on chain=A,join=by -stealth] {$\i$};
\node[box, above=of A-\n] (y\n) {$\j$};
\node[box, below=of A-\n] (x\n) {$\k$};
\draw[-stealth] (A-\n) -- (y\n);
\draw[-stealth] (A-\n) -- (x\n);
}
\node[circ, left =of A-1] (A-0) {$h_{({\dots})}$};
\node[circ, right=of A-3] (A-4) {$h_{({\dots})}$};
%
\draw[-stealth,dashed] (A-0) -- (A-1);
\draw[-stealth,dashed] (A-3) -- (A-4);
\end{tikzpicture}
\caption{Recurrent Neural Network unfolded in time}
\end{figure}
\begin{align}\label{rnn-eq}
h_{t} & = f(W_{hx}x_{t} + W_{hh}h_{t-1} + b) \\
y_{t} & = g(W_{yh}h_{t} + c)
\end{align}
\end{frame}
\end{document}
如果您有图像文件pdf
,则最简单的包含它们的方法如下:
\begin{figure}
\centering
\include graphics[height=4cm]{rnn} % adjust height so, that image and equation will fit in one frame
\caption{Recurrent Neural Network unfolded in time}
\end{figure}