I have a very basic question. I am trying to use beamer to prepare a presentation and I need to put a figure and 2 line equation one under the other. I am able to put figure by itself but when I add the equation, I cannot see it on the output. I am using overleaf. I share the code I used in that frame below. The figure was an svg and I converted it to proper version as suggested here.


\begin{frame}[fragile]{ Recurrent Neural Networks(RNNs)}
    \caption{Recurrent Neural Network unfolded in time}
  h_{t} &=& f(W_{hx}x_{t} + W_{hh}h_{t-1} + b) \\
  y_{t} &=& g(W_{yh}h_{t} + c) 

Current output:

enter image description here

I am trying to achive something like that: enter image description here

  • please make your code fragment compilable for us. we haven't your image .... btw, instead of eqnarray rather use align from the package amsmath. – Zarko May 27 '18 at 9:02
  • @Zarko I put the link for the image I use as comment to your answer – zwlayer May 27 '18 at 9:47
  • 1
    @zwlayer: Regarding your edit: Please note, that there is no space in \includegraphics. – leandriis May 27 '18 at 10:24
  • @leandriis it was a very bad mistake :) Thank you for letting me know. I will undo last edit. – zwlayer May 27 '18 at 10:42

like this?

enter image description here

apparently your image is to high that in frame would have space image and equation. since your image is relatively simple i redraw it by use of the packagetikz:


\begin{frame}[fragile]{ Recurrent Neural Networks (RNNs)}
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);
    \caption{Recurrent Neural Network unfolded in time}
  h_{t} & = f(W_{hx}x_{t} + W_{hh}h_{t-1} + b) \\
  y_{t} & = g(W_{yh}h_{t} + c)

in case, that you have image as pdf files, than the simplest way to include them as follows:

\include graphics[height=4cm]{rnn} % adjust height so, that image and equation will fit in one frame
    \caption{Recurrent Neural Network unfolded in time}
  • thank your for your answer! I have an image saved as pdf. Is it possible to show both image and equation without drawing the image like you did ? It is not a problem for this case but I also have some complex images that I cannot draw so easly. – zwlayer May 27 '18 at 9:42
  • you can find the resources here: drive.google.com/open?id=1swYyITHxwKALTm70f-STalWgDRSsPkyc – zwlayer May 27 '18 at 9:47
  • if you have image as pdf file, why you not include it with \includegraphics[height=<desired height>]{<image name}? see edited answer – Zarko May 27 '18 at 9:56
  • I did not know I have such an option. I did exactly what you said. (Please see my edit) but It showed me a text rather than an image. What might be the problem ? – zwlayer May 27 '18 at 10:14
  • i haven't any idea :-(. i don't know your image, nor your document set up nor other necessary informations ... sorry, but my crystal ball is permanently-out-of-order :-) – Zarko May 27 '18 at 11:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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