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!
foo.tex. Unless you have anything else configured\includegraphics{38}will never find./img/38.png, thus the request for the contents offoo.tex– daleif May 14 '19 at 09:33\graphicspath{{./img/}}make a difference? Also in texworks, are you 100% sure you are using xelatex there and not pdflatex? – daleif May 14 '19 at 10:02xelatex fooon the command line butxelatex D:\Documents\LaTex/foo.tex. Are you sure that you are in the LaTeX-folder on the prompt? – Ulrike Fischer May 14 '19 at 10:32foo.tex. Bothpdflatexandxelatexfails if using running from a different folder – daleif May 14 '19 at 10:33