1

I'm having troubles inserting an image in LaTex. This is what I wrote:

\begin{figure}[H]
  \centering 
    \includegraphics[scale=0.3]{hi}
    {desktop/hi.jpg}
    \caption{Placering og budget}
\end{figure}

'hi' is the name of the image (pretty random, I know :)). I've tried saving it as both jpg and npg, but nothing works. LaTex says that the problem is within that line, but I'm not sure what the problem is. All it says is: undefined control sequence. Anyone got an idea?

closed as unclear what you're asking by Paul Gessler, cmhughes, Mico, Thorsten, Svend Tveskæg Jan 18 '15 at 20:38

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • Welcome to TeX.SX! Please make your code compilable (if possible), or at least complete it with \documentclass{...}, the required \usepackage's, \begin{document}, and \end{document}. That may seem tedious to you, but think of the extra work it represents for TeX.SX users willing to give you a hand. Help them help you: remove that one hurdle between you and a solution to your problem. A suggestion: Do us a favour and change your username to something more telling than "user1234". – Martin Schröder Nov 19 '14 at 16:46
  • It would help if you would include the complete error message. Anyway: \includegraphics has only one mandatory argument, so your {desktop/hi.jpg} is not passed to \includegraphics. – Martin Schröder Nov 19 '14 at 16:48
  • 3
    You have not given many clues such as telling us which command was undefined, but if it is \includegraphics then you have not used \usepackage{graphicx} in the preamble of your document. Also note [H] should only be used as a last resort (and needs the float package before it is defined) – David Carlisle Nov 19 '14 at 16:57
0

I don't think you should use both {hi} and {desktop/hi.jpg} in your code.

Try

\begin{figure}
    \centering
    \includegraphics[scale=0.3]{hi.jpg}
    \caption{Placering og budget}
    \label{fig:hi}
\end{figure}

The hi.jpg should be located in same directory as the *.tex file you are running. If it is located on the desktop you can use {../../Desktop/hi.jpg} instead.

If it is located in a sub directory use {Folder/hi.jpg}.

  • You can safely omit also the extension of the image file. That is, \includegraphics[scale=0.3]{hi} also should work if the image is in the working directory. – Fran Nov 20 '14 at 7:22

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