Unable to load picture or pdf file, XeTeX, Win 8

10,564

It seems that the problem lies in a missing / at the end of the absolute path. Note as well that the default font features were wrong. I've cleaned your MWE, and it should work. Change the absolute path and the image name to test.

\documentclass[11pt,a4paper]{article}
\usepackage{grffile}
\graphicspath{{/home/test/images/}} % Change the path
\usepackage{fontspec}
\defaultfontfeatures{RawFeature=+cpsp,
    RawFeature=+mark,
    RawFeature=+mkmk,
    RawFeature=+ccmp,
    RawFeature=+kern,
    RawFeature=+liga,
    RawFeature=+pnum,
    RawFeature=+case,
    RawFeature=+cpsp}
\setmainfont{Linux Libertine O}
\usepackage{lipsum}
\begin{document}
\begin{figure}
    \includegraphics[width=\textwidth]{sample.png} % Change the image name
\end{figure}
\lipsum
\end{document}
Share:
10,564

Related videos on Youtube

Milad O.
Author by

Milad O.

Updated on August 01, 2022

Comments

  • Milad O.
    Milad O. over 1 year

    I was A-OK with my previous Win 7. I have been having this problem ever since I changed to Win 8. I use TeXstudio to edit my files. I get the error below:

    Unable to load picture or PDF file 'intro.png'. ^^I^^I^^I\includegraphics{intro.png}

    I have a file named 'intro.png' in the directory called.

    Some of my code:

    \documentclass[11pt,a4paper]{article}
    \author{Milad O.}
    \title{A Literature Review on\\ Data Partitioning}
    \usepackage[T1]{fontenc}
    \usepackage{textcomp}
    \usepackage{indentfirst}
    \usepackage{amsmath}
    \usepackage{amsfonts}
    \usepackage{amssymb}
    \usepackage{grffile}
    \usepackage{graphicx}
    \graphicspath{{D:/Textbooks/LaTeX/Figures}}
    \usepackage{fontspec}
    \defaultfontfeatures{RawFeature= +cpsp,+mark,+mkmk,+ccmp,+kern,
    +liga,+pnum,+case,+cpsp}}
    \setmainfont{Linux Libertine O}
    \begin{document}
        \maketitle
    \begin{abstract}
    Bla bla bla  
    \end{abstract}
        
    \section{Introduction}
    bla bla bla
    \begin{figure}
        \centering
        \includegraphics{intro.png}
    \end{figure}
    \end{document}
    
    • egreg
      egreg almost 9 years
      GIF files can't be included.
    • Joseph Wright
      Joseph Wright almost 9 years
      Your error message doesn't match anything in your MWE: that makes it a bit hard to help!
    • Milad O.
      Milad O. almost 9 years
      @JosephWright Well, that's what I'm talking about. I tested everything to the best my knowledge. Is there something wrong with the TeXLive 2014?
    • Juri Robl
      Juri Robl almost 9 years
      You have to end your graphicspath with a /, try \graphicspath{{D:/Textbooks/LaTeX/Figures/}}. If that doesn't work, are you sure your file is there?
    • Milad O.
      Milad O. almost 9 years
      @JuriRobl I dont believe it! My problem was a /! I was expecting a major issue with TeXLive 2014! haha. Thanks by the way.
  • Milad O.
    Milad O. almost 9 years
    Your answer is correct. The problem was the missing / which I never suspected all this time! However, the code works with the current \defaultfontfeatures. Thanks anyway.