0

I've seen this question asked multiple times but I think I have already trouble-shoot all possible problems, when using \Includegraphics I get the error Undefined control sequence.

I am working with MikTex in Windows. Here is my code. I already included the package and the path. I really do not know what else to do.

\documentclass[oneside,11pt]{report}
\usepackage[a4paper,left=3cm,right=2cm,top=2cm,bottom=2cm]{geometry}
\usepackage[english]{babel}
\usepackage{indentfirst}
\usepackage[square,numbers]{natbib}
\usepackage{amsmath}
\usepackage{graphicx}
\usepackage[T1]{fontenc}
\usepackage{lmodern} 
\graphicspath{ {C:\folder1\folder2} }

\begin{document}

\linespread{1.25}

\begin{titlepage}

\begin{center} \vspace*{1cm} \Large \includegraphics[width=0.4\textwidth]{image} \end{center}

\end{titlepage}

\end{document}

egreg
  • 1,121,712
  • Welcome to TeX.SE! Your example works fine. No warnings, no errors. – Zarko Dec 11 '22 at 13:08
  • Welcome! Can you please show the actual error message you get? Note that you talk about \Includegraphics in the text above the code. – egreg Dec 11 '22 at 13:08
  • 2
    use slashes not backslashes in pathes:C:/folder1/folder2 – Ulrike Fischer Dec 11 '22 at 13:10
  • But in code use \includegraphics, what is correct – Zarko Dec 11 '22 at 13:10
  • Thank you! Changed the slashes for backslashes and same error. In the console output is: "The log file hopefully contains the information to get MiKTeX going again: C:\Users\User\AppData\Local\MiKTeX\miktex\log\miktex-epstopdf.log miktex-epstopdf: major issue: ! Package pdftex.def Error: File `C:/Users/...' not found: using draft setting. See the pdftex.def package documentation for explanation. Type H for immediate help. ...
    l.28 ...raphics[width=0.4\textwidth]{image} ?"
    – ALB_BUV Dec 11 '22 at 13:23
  • 1
    that is a different error, not undefined command, but file not found. presumably you have the wrong file name. It is unrelated to the question title – David Carlisle Dec 11 '22 at 13:28
  • Sorry for the confusion, the error like that appears when I change the slashes for backslashes. Then I noticed that another person said it should not do a difference. When I put it back, I get this:

    "Undefined control sequence. C:\Users \User.... l.28 ...raphics[width=0.4\textwidth]{image}

    ?"

    I doubled check everything, to be honest I am really lost....

    – ALB_BUV Dec 11 '22 at 13:33
  • Maybe more light to the issue. I simply changed the .eps for a .png file and it worked like a charm. However, I thought the preferred option in Latex was .eps Does anybody what the problem could have been? – ALB_BUV Dec 11 '22 at 14:10
  • eps files work fine with latex (going through dvi->ps->pdf), but not so much with pdflatex. After correcting \graphicspath to use slashes (this is necessary to avoid an undefined control sequence error unrelated to your graphics problem) you get file not found, because a suitable graphics file is not found. – Dai Bowen Mar 11 '23 at 23:34

0 Answers0