Graphics, Figures & TablesNo Graphics Extension recognized

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
nicoo
Posts: 4
Joined: Thu Jul 28, 2011 6:22 pm

No Graphics Extension recognized

Post by nicoo »

Hello all!

I am using PDFLaTeX to compile a document. Until now it was working fine, but suddenly it stopped recognizing any graphics extension.

Code: Select all

\documentclass{article}
\usepackage{graphicx}

\begin{document} 
  \begin{figure}[h]
    \includegraphics[width=0.3\linewidth]{anusha.jpg }  
  \end{figure}
\end{document}
and I get this error:

Code: Select all

! LaTeX Error: Unknown graphics extension: .jpg .

See the LaTeX manual or LaTeX Companion for explanation.
Type  H <return>  for immediate help.
 ...                                              
                                                  
l.192 ...raphics[width=0.3\linewidth]{anusha.jpg }
                                                  
? 
And this for whatever extension .jpg,.pdf,.eps etc.

What is happening?

Thank you for your attention!
Last edited by localghost on Mon Oct 21, 2013 7:28 pm, edited 1 time in total.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

Johannes_B
Site Moderator
Posts: 4182
Joined: Thu Nov 01, 2012 4:08 pm

No Graphics Extension recognized

Post by Johannes_B »

A wild guess would be that you are now compiling with latex instead of pdflatex. Additionally, you should leave out the file extension. The white space at the end of the file name could be something that confuses LaTeX as well. EDIT: It's definitely the extra space in the MWE above.

Best regards
Johannes
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

No Graphics Extension recognized

Post by localghost »

Johannes' assumption is correct. And the error message also indicates the reason.

Code: Select all

! LaTeX Error: Unknown graphics extension: .jpg .
Note the blank space after the suffix. The compiler searches for a file with the suffix ".jpg␣". And as Johannes already mentioned, you can drop suffixes completely. The graphicx package will search for acceptable file formats on its own.

By the way, with LaTeX almost nothing happens suddenly. Most problems are caused due to user action.


Thorsten
nicoo
Posts: 4
Joined: Thu Jul 28, 2011 6:22 pm

Re: No Graphics Extension recognized

Post by nicoo »

Wow, I can't believe a simple extra space can mess everything up! Anyway, I hope this post will help other people not going through this trouble. Thank you for the quick response!
Post Reply