2

I write my text in Windows 10 and using TexStudio. I recently updated both my MikTeX and TeXstudio to the latest versions. After the update the tex files that were working before start throwing the error

Undefined control sequence. ...raphics[width=0.45\textwidth]{network.eps}

Then, I found the following questions

undefined control sequence \includegraphics

"Undefined control sequence \includegraphics" after TeXstudio update

It seems like the root of the problem is same but the solutions that are suggested in those did not work. I realized that the problem happens only for eps files and if I include epstopdf the problem seems to be solved.

However, the latex was running properly without calling epstopdf before. How can I fix this issue without \usepackage{epstopdf}. See the full code below

\documentclass[conference]{IEEEtran}

\usepackage{graphicx}
%\usepackage{epstopdf}

\begin{document}
\section{Introduction}

test

\begin{figure}[!htb]
    \centering
    \includegraphics[width=0.45\textwidth]{network.eps}
\end{figure}

\end{document}

UPDATE

The actual log message is as below

("C:\Users\XXX\AppData\Local\Programs\MiKTeX 2.9\tex/latex/epstopdf-pkg\ep
stopdf-base.sty"
Package: epstopdf-base 2019-12-09 v2.10 Base part for package epstopdf
Package epstopdf-base Info: Redefining graphics rule for `.eps' on input line 4
85.
)
! Undefined control sequence.
\ETE@program@epstopdf ->\epstopdf@sys@cmd 

l.13 ...raphics[width=0.45\textwidth]{network.eps}

The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.

Package epstopdf Info: Source file: <network.eps>
(epstopdf)                    date: 2019-03-28 04:44:41
(epstopdf)                    size: 141038 bytes
(epstopdf)             Output file: <network-eps-converted-to.pdf>
(epstopdf)             Command: < --outfile=network-eps-converted-to.pdf networ
k.eps>
(epstopdf)             \includegraphics on input line 13.
runsystem( --outfile=network-eps-converted-to.pdf network.eps)...disabled (rest
ricted).

Package epstopdf Info: Result file: <network-eps-converted-to.pdf>.
  • You cannot add long text to a comment, please add it to the question instead. Have you fully updaed your miktex both in miktex user mode and in miktex admin mode? – daleif Jan 24 '20 at 15:17
  • 1
    If you compile with pdflatex then you don't need epstopdf. Also you should remove the extension .eps, so just put \includegraphics[width=0.45\textwidth]{network}. – Marijn Jan 24 '20 at 15:18
  • @daleif I have even uninstalled miktex and texstudio completely (including configuration, preference, user files) and installed it only for one user. So I am sure that they are fully updated. – LaTeXMinion Jan 24 '20 at 15:24
  • the error you show is not the format of a tex error message, and does not show which command is undefined. Please show the actual tex error from the log file, in a code block so line endings preserved – David Carlisle Jan 24 '20 at 15:25
  • @Marijn that's my point. I shoud not need epstopdf if I compile with pdflatex but if I comment out the epstopdf, it does not work. I put the extension to be sure but without the extension the problem still exist – LaTeXMinion Jan 24 '20 at 15:26
  • MikTeX can leave stuff behind that are then picked up when you reinstall. Thus the importance of the contents of the actual log file – daleif Jan 24 '20 at 15:27
  • @DavidCarlisle I have updated the tex error message from the log file. – LaTeXMinion Jan 24 '20 at 15:29
  • your log shows you are missing epstopdf-sys.cfg in texlive that is /usr/local/texlive/2019/texmf-dist/tex/latex/latexconfig/epstopdf-sys.cfg I am not sure where it is in miktex or whetehr it is missing upstream in miktex or just in your installation – David Carlisle Jan 24 '20 at 15:36
  • You can also see the version of the miktex from the beginning of the log message

    This is pdfTeX, Version 3.14159265-2.6-1.40.20 (MiKTeX 2.9.7250) (preloaded format=pdflatex 2020.1.24) 24 JAN 2020 15:56 entering extended mode **./test.tex (test.tex LaTeX2e <2019-10-01> patch level 3

    – LaTeXMinion Jan 24 '20 at 15:36
  • @DavidCarlisle /usr/local/texlive/2019/texmf-dist/tex/latex/latexconfig/epstopdf-sys.cfg does not exist in my pc since I am a windows user. Besides, I can directly use \usepackage{epstopdf} to workaround the problem instead of \makeatletter \def\epstopdf@sys@cmd{repstopdf} \makeatother. I am after an answer which explains the reason of this problem. – LaTeXMinion Jan 24 '20 at 15:44
  • 1
    That is the reason, As I say that is the location of the file on texlive, I do not know the location in miktex, but the missing file is the reason for the error. I will change epstopdf-base.sty to default a definition in case the cfg file is missing. – David Carlisle Jan 24 '20 at 15:46
  • https://github.com/ho-tex/epstopdf/commit/5c937d4fe92063b1eb35de607b122d57858ae71a – David Carlisle Jan 24 '20 at 16:31

1 Answers1

4

epstopdf-base currently assumes the presence of a file epstopdf-sys.cfg which sets up a system command to do the external conversion of the EPS files to PDF.

In texlive this is

/usr/local/texlive/2019/texmf-dist/tex/latex/latexconfig/epstopdf-sys.cfg

but apparently miktex does not set this default.

It is not good that the package requires a cfg file anyway so I will update epstopdf-base so the default command is epstopdf.

texlive's cfg file will still over-ride this, as now, and make the default be repstopdf unless you use --shell-escape, in which case it will be set to epstopdf (MikTeX does not make this distinction, apparently).

Until the package is updated (it is updated at source), you can set this with

\makeatletter \def\epstopdf@sys@cmd{epstopdf} \makeatother
David Carlisle
  • 757,742