1

Overleaf uses pdflatex but I still get this error when I try to insert a .png image. \includegraphics{screenshots/AB4results.png}

In fact, Overleaf has a .png file in its template:

\documentclass{article}
\usepackage{graphicx}
\graphicspath{ {./images/} }

\begin{document}
The universe is immense and it seems to be homogeneous, 
in a large scale, everywhere we look at.

\includegraphics{universe}

There's a picture of a galaxy above
\end{document}

enter image description here

Here are all the packages I'm using.

\usepackage[english, greek]{babel}
\usepackage[T1, T2A]{fontenc}
\usepackage{mathtools}
\usepackage{amsmath}
\usepackage{listings}
\usepackage{color} %red, green, blue, yellow, cyan, magenta, black, white
\definecolor{mygreen}{RGB}{28,172,0} % color values Red, Green, Blue
\definecolor{mylilas}{RGB}{170,55,241}

%matlab
\usepackage{bigfoot} % to allow verbatim in footnote
\usepackage[numbered,framed]{matlab-prettifier}

%\usepackage{pdfpages}

\pagenumbering{gobble}

\setlength{\parindent}{0em}
\setlength{\parskip}{1em}
\renewcommand{\baselinestretch}{1.5}
\usepackage[margin=0.9in]{geometry}

\usepackage{natbib}

%inserting png images
\usepackage{graphicx}
\usepackage{wrapfig}


\usepackage{extarrows} 

Edit: I included the size in the code and the error disappeared: \includegraphics[width=0.8\textwidth,natwidth=489,natheight=436]{screenshots/AB4results.png}

However, the image still does not appear.

3
  • 6
    [Disclaimer: I'm a support personnel at Overleaf.] Could you click on the Overleaf menu icon above the file tree panel, and check that the project's Compiler option is indeed set to "pdflatex", not "LaTeX"?
    – imnothere
    Apr 29, 2020 at 9:05
  • 2
    And if you are indeed using pdflatex, then you should remove natwidth=489,natheight=436.
    – imnothere
    Apr 29, 2020 at 9:06
  • @LianTzeLim Many thanks. Apr 29, 2020 at 9:09

0

You must log in to answer this question.

Browse other questions tagged .