0

I have been using TeXworks and it worked fine. Recently, I am testing with Command Prompt to work with this line:

xelatex foo.tex

The content of the file is below:

\documentclass[a4paper,14pt,twoside]{book}
\usepackage{graphicx}
\graphicspath{ {./img/} }

\begin{document}
\includegraphics{38}
\end{document}

It is a tex file which worked perfectly on TeXwork (compiled with XeLaTeX), but not through Command Prompt. The error message was this:

! Unable to load picture or PDF file './img/38.png'.

Funny thing is, my corresponding line was

\includegraphics{38}

so it appears that it actually found my file '38.png'.

I am working on a Win10 workstation.

Working log-file from TeXwork:

This is XeTeX, Version 3.14159265-2.6-0.99999 (TeX Live 2018/W32TeX) (preloaded format=xelatex)
 restricted \write18 enabled.
entering extended mode
(./foo.tex
LaTeX2e <2018-12-01>
(d:/texlive/2018/texmf-dist/tex/latex/base/book.cls
Document Class: book 2018/09/03 v1.4i Standard LaTeX document class
(d:/texlive/2018/texmf-dist/tex/latex/base/bk10.clo))
(d:/texlive/2018/texmf-dist/tex/latex/graphics/graphicx.sty
(d:/texlive/2018/texmf-dist/tex/latex/graphics/keyval.sty)
(d:/texlive/2018/texmf-dist/tex/latex/graphics/graphics.sty
(d:/texlive/2018/texmf-dist/tex/latex/graphics/trig.sty)
(d:/texlive/2018/texmf-dist/tex/latex/graphics-cfg/graphics.cfg)
(d:/texlive/2018/texmf-dist/tex/latex/graphics-def/xetex.def)))

LaTeX Warning: Unused global option(s):
    [14pt].

(./foo.aux) [1] (./foo.aux) )
Output written on foo.pdf (1 page).
SyncTeX written on foo.synctex.gz.

Transcript written on foo.log.

The not-working log:

This is XeTeX, Version 3.14159265-2.6-0.99999 (TeX Live 2018/W32TeX) (preloaded format=xelatex)
 restricted \write18 enabled.
entering extended mode
(D:\Documents\LaTex/foo.tex
LaTeX2e <2018-12-01>
(d:/texlive/2018/texmf-dist/tex/latex/base/book.cls
Document Class: book 2018/09/03 v1.4i Standard LaTeX document class
(d:/texlive/2018/texmf-dist/tex/latex/base/bk10.clo))
(d:/texlive/2018/texmf-dist/tex/latex/graphics/graphicx.sty
(d:/texlive/2018/texmf-dist/tex/latex/graphics/keyval.sty)
(d:/texlive/2018/texmf-dist/tex/latex/graphics/graphics.sty
(d:/texlive/2018/texmf-dist/tex/latex/graphics/trig.sty)
(d:/texlive/2018/texmf-dist/tex/latex/graphics-cfg/graphics.cfg)
(d:/texlive/2018/texmf-dist/tex/latex/graphics-def/xetex.def)))

LaTeX Warning: Unused global option(s):
    [14pt].

(D:\Documents\LaTex/foo.aux)
! Unable to load picture or PDF file './img/38.png'.
<to be read again>
                   }
l.6 \includegraphics{38}

How should I solve it? Thanks!

11
  • 2
    As always on this site, please provide a full minimal example, we'd like to see what you have in that test file foo.tex. Unless you have anything else configured \includegraphics{38} will never find ./img/38.png, thus the request for the contents of foo.tex
    – daleif
    May 14, 2019 at 9:33
  • Thank you for your advice. I have included a simplified version of the document. This version is also tested on TeXworks and command prompt, and the same problem still stands(aka It works on TeXworks while command prompt cannot load the picture).
    – KAItO CHAN
    May 14, 2019 at 9:43
  • Does \graphicspath{{./img/}} make a difference? Also in texworks, are you 100% sure you are using xelatex there and not pdflatex?
    – daleif
    May 14, 2019 at 10:02
  • I just tested with TeXLive 2019, everything works as it should. Exactly which latex installation do you have and which version.
    – daleif
    May 14, 2019 at 10:05
  • 1
    You seem not to run xelatex foo on the command line but xelatex D:\Documents\LaTex/foo.tex. Are you sure that you are in the LaTeX-folder on the prompt? May 14, 2019 at 10:32

0

You must log in to answer this question.

Browse other questions tagged .