Document Classesbeamer figures

Information and discussion about specific document classes and how to create your own document classes.
Post Reply
workerbee
Posts: 43
Joined: Sat Nov 22, 2008 1:53 am

beamer figures

Post by workerbee »

Hi all,

I'm having some issues with inserting figures using the Beamer class. Mainly, the problem is that a pdf file won't compile and there's an error message saying that there's missing information. I placed the images (which are pdf files) in the same folder as the Latex for the beamer-class document but nothing comes up. Here's the code I used. Can someone tell me where I went wrong?

Code: Select all

\begin{frame}
\frametitle{Figure 2: Schizophrenia Trial}
\begin{center}
\begin{figure}
$$\includegraphics[width=4.94in,height=3.99in]{schizophrenia-plot.pdf}$$
\end{figure}
\end{center}
\end{frame}

attached is a pdf of what the figure looks like.
Attachments
schizophrenia-plot.pdf
(29.32 KiB) Downloaded 412 times

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

phi
Posts: 577
Joined: Tue Oct 21, 2008 8:10 pm

beamer figures

Post by phi »

please provide a minimum example and tell us which program (pdflatex or something else) you are using to compile the TeX document. When including PDF graphics, you have to use pdfLaTeX in PDF mode.
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

beamer figures

Post by localghost »

workerbee wrote:[...] Mainly, the problem is that a pdf file won't compile and there's an error message saying that there's missing information. [...]
This is a very poor effort of describing the problem. Please give the exact error message which can be found in the log file. Reading your code I stumbled over a mysterious line.

Code: Select all

$$\includegraphics[width=4.94in,height=3.99in]{schizophrenia-plot.pdf}$$
If you could explain why you try to include a graphics file in math mode we would be a step further.


Best regards
Thorsten¹
phi
Posts: 577
Joined: Tue Oct 21, 2008 8:10 pm

beamer figures

Post by phi »

localghost wrote:

Code: Select all

$$\includegraphics[width=4.94in,height=3.99in]{schizophrenia-plot.pdf}$$
If you could explain why you try to include a graphics file in math mode we would be a step further.
And why the primitive displaymath syntax is used instead of AMS environments. Anyway, that is not the problem, the following compiles without errors:

Code: Select all

\documentclass{beamer}

\begin{document}

\begin{frame}
\frametitle{Figure 2: Schizophrenia Trial}
\begin{center}
\begin{figure}
$$\includegraphics[width=4.94in,height=3.99in]{schizophrenia-plot.pdf}$$
\end{figure}
\end{center}
\end{frame}

\end{document}
User avatar
Stefan Kottwitz
Site Admin
Posts: 10324
Joined: Mon Mar 10, 2008 9:44 pm

Re: beamer figures

Post by Stefan Kottwitz »

Hi,

I wouldn't use the figure environment inside a presentation, the images are probably not intended to float.

Stefan
LaTeX.org admin
workerbee
Posts: 43
Joined: Sat Nov 22, 2008 1:53 am

Re: beamer figures

Post by workerbee »

Thanks for all the replies. I figured out my errors (I actually removed the math mode before but for some reason copied an older version of the text) and fixed everything.
Post Reply