1

I'm trying to insert an image to my file, but I can't figure out how to do it. I've added

\usepackage{graphicx}

to my preamble and when I drag and drop an image to my file (I'm working with TeXStudio), the following code appears:

\begin{figure}
\centering
\includegraphics[width=0.7\linewidth]{"My Pretty Image"}
\end{figure}

However, this doesn't want to work.

What did I do wrong and how can I solve this?

5
  • 1
    The last parameter to \includegraphcs needs to be the file name. May 13, 2014 at 8:29
  • @PeterGrill: The filename is Oefening 1a_tabel AB.png. Using that with or without the extention doesn't work...
    – Jeroen
    May 13, 2014 at 8:31
  • 1
    Don't use spaces in filenames. And remove the quotes. May 13, 2014 at 8:33
  • 1
    Remove the " around the filename
    – user31729
    May 13, 2014 at 8:33
  • @UlrikeFischer: Great, that solved my problem!
    – Jeroen
    May 13, 2014 at 8:38

2 Answers 2

1
A complete answer for just reference.
\bigskip % Add an empty line
%These are optional parameters to finetune the placement of tables and figures, with the following meaning:
%
%h, here
%t, top
%b, bottom
%p, page of float
%e.g. \begin{figure}[!htb]
\begin{figure}[ht!]
\centering
\includegraphics[width=90mm]{imagename.png}
\caption{This is the caption}
\label{overflow}
\end{figure}
1

Thanks to @Ulrike Fischer to answer this question in the comments: "Don't use spaces in filenames. And remove the quotes."

The correct code is therefore:

\begin{figure}
\centering
\includegraphics[width=0.7\linewidth]{MyPrettyImage}
\end{figure}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .