[Tex/LaTex] Cannot determine the size of the image

bounding boxerrorsgraphicssize;

I have this code in LaTeX, I compile with "latex+dvips+ps2pdf+See PDF"

\documentclass[a4paper,12pt]{article}
\usepackage[spanish]{babel}
\usepackage[utf8]{inputenc}
\usepackage{graphicx}
\begin{document}
\begin{figure} [h]
\centering
\includegraphics [width=8cm]{CircuitoRC.pdf} 
\caption{Carga de un condensador en un circuito RC.}
\label{fig:circuito}
\end{figure}
\end{document}

In \includegraphics it says me this:

LaTeX Error: Cannot determine size of graphic in CircuitoRC.pdf (no BoundingBox).See the LaTeX manual or LaTeX Companion for explanation.Type H for immediate help…. \includegraphics [width=8cm]{CircuitoRC.pdf}

I don't know why.

Best Answer

When you are using LaTeX, that is in the commandline

 latex myfile

you only can use PostScript-File with \includegraphics. PostScript-files usually end in .ps or .eps. Using .pdf or .png will give the error.

In your case, use the following commandline in your shell

 pdflatex myfile

In that case, you will be able to use \includegraphics with the following graphics files

  1. JPEG-files ending in .jpg
  2. Portable Network Graphics, ending in .png
  3. PDF-files ending in .pdf

You should leave the file name ending. LaTeX will append them as listed above. This is, to have both an PostScript and an JPEG/PNG/PDF-file, which share the same file name and only differ in the file type and their corresponding file extension. So you could either run good old latex and include the .ps-file, while the younger pdflatex will search for the .jpg, .png and .pdf-file.