Graphics, Figures & TablesInserting a PDF file into Exam class

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
megatunnage
Posts: 1
Joined: Mon Mar 06, 2017 11:45 pm

Inserting a PDF file into Exam class

Post by megatunnage »

Hi, I'm writing a quiz using the Exam class, and I want to insert a pdf of a vector field. The file is called 'vfield1' and it's located in the same directory as my tex file. I'm using WinEdt 8.1 and compiling with the 'PDFTexify' button.

However, I keep getting the error message, "Package pdftex.def Error: File 'vfield1.pdf' not found." Here's the code that I have:

Code: Select all

\documentclass[addpoints, 12pt]{exam}
\usepackage{amsmath}
\usepackage[utf8]{inputenc}
\usepackage{graphicx}
\pagestyle{headandfoot}

\firstpageheader{Name:}{Quiz 8}{Tues 7-Mar-2017}
\extrafootheight{-3in}

\begin{document}

\begin{center}
\vspace{0.2in}
\fbox{
\parbox{6in}
{\centering
    To receive full and partial credit, ALL work must be shown. }}
\end{center}

\begin{questions}
\question 
Determine and justify which differential equation matches the following direction field: 
\includegraphics{vfield1.pdf}
\end{questions}

\end{document}
What's interesting is that if I use the Article class, I don't get any errors and it compiles fine:

Code: Select all

\documentclass{article}
\usepackage{amsmath}
\usepackage{graphicx}

\begin{document}

\includegraphics{vfield1.pdf}

\end{document}
Any ideas what's causing the problem in the Exam class code?

Thank you for your help

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

Stefan Kottwitz
Site Admin
Posts: 10324
Joined: Mon Mar 10, 2008 9:44 pm

Inserting a PDF file into Exam class

Post by Stefan Kottwitz »

Welcome to the forum!

That's actually strange, because it writes pdfTeX is used but cannot read PDF. Are you really sure that the main document is in the same folder as the pdf image? I sometimes think I'm working in a folder but the document I'm working on was saved to another place. Perhaps explicitly save again to that folder with another name.

Please post the .log file of the compiler run here, as attachment.

Stefan
LaTeX.org admin
Post Reply