0

When I insert a figure in LaTex I get this error:

dfTeX error: pdflatex (file ./billeder/Metodeteori/nmr_spectra_ny.png): libpng: internal error.

I have checked that the file is correctly uploaded, in the right format, and that it is written correctly in the figure-code (shown below). I have uploaded more than 20 figures before this one, and it is done exactly the same way, so there should not be a problem - but suddenly it is a problem and no PDF is shown. I know the problem lies in this particular figure, as the errors disappear and the PDF comes back when I delete the figure. I have already tried re-uploading the figure in different formats, renaming it, writing the figure-code again but nothing works for me. I have tried google and LaTex' own guides but I cannot find the answer I need.

This is the code for the figure:

\begin{figure}[H]
    \centering
    \includegraphics[width=8cm]{billeder/Metodeteori/nmr_spectra_ny.png}
    \caption{Cool caption \cite{FID}.}
    \label{fig:NMR_spectra}
\end{figure}

Note: The text-source in the figure has been used many times before the figure and works perfectly, so the error in not found there.

This is some of the packages:

\usepackage{graphicx}

\usepackage[dvipsnames]{xcolor}

\usepackage{flafter}

\usepackage{float}

\let\newfloat\relax

This has not been a problem for me previously in my use of LaTex (neither in this project or previous projects) and therefore, I do not know how to solve it. Can anyone help me fix the problem? In am not sure what information is necessary, so please let me know if more is needed.

Thank you in advance.

4
  • Hi and welcome to TeX.SE, @Celilie, Please read about MWEs. What packages and classes are you using? For example, are you using graphicx? Have you tried to remove/comment some previous figure and the one with problem suddenly worked? You issue may be related with Too many unprocessed floats.
    – FHZ
    Apr 25 at 16:15
  • I use "\usepackage{graphicx}" amongst others. I have tried to remove other figures, which didn't help. I know the porblem is with this figure, as the errors disappear when i remove the figure - It has not been a problem with no other figure in my document. It has not been a problem with many figures in previous projects, as i have had more than now earlier
    – Cecilie
    Apr 25 at 16:19
  • And it doesn't seem like the problem is connected with the ones you referred to.
    – Cecilie
    Apr 25 at 16:25
  • The error indicates that pdfTeX has issues while reading the PNG file, but without access to the file it's unlikely that anyone will be able to figure out what causes this. Apr 28 at 15:58

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.