Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I write my text in Mac OS X and every thing was fine but when I want compile my code with Winedt in Windows 7 Environment I got this error:

undefined control sequence \includegraphics[width=0.30/textwidth]{Hypercube}

I change \ to / but Still got the error. And also I use package graphicx.

% GRAPHICS RELATED PACKAGES   
%  
 \ifCLASSINFOpdf   
   \usepackage[pdftex]{graphicx}     
 % declare the path(s) where your graphic files are       
   \graphicspath{{../pdf/}{../jpeg/}{./image/}}    
  % and their extensions so you won't have to specify these with    
  % every instance of \includegraphics      
 \DeclareGraphicsExtensions{.pdf,.jpeg,.png,.jpg}   
 \else   
   % or other class option (dvipsone, dvipdf, if not using dvips). graphicx     
 % will default to the driver specified in the system graphics.cfg if no   % driver is specified.    
  % \usepackage[dvips]{graphicx}   
   % declare the path(s) where your graphic files are     
 % \graphicspath{{../eps/}}    
  % and their extensions so you won't have to specify these with   
   % every instance of \includegraphics    
  % \DeclareGraphicsExtensions{.eps}   
\fi

\begin{figure}[htpb]   
    \label{Figure::Hypercube}      
  \begin{center}    
 \includegraphics[width=0.30/textwidth]{Hypercube}    
    \caption{a Hypercube with 8 nodes}      
  \end{center}     
   \end{figure}
share|improve this question
2  
You need \textwidth since that refers to the width of the text block. /textwidth does not exist. –  Werner Aug 14 '11 at 6:36
    
@Werner I change it to \textwidth but got the same error! –  Am1rr3zA Aug 14 '11 at 6:46
    
@Am1rr3zA: put the \label{..} after the caption otherwise your reference will be wrong –  Herbert Aug 14 '11 at 6:51
    
You should provide a Minimal Working Example to make others to reproduce the problem. And don't change the error message, just copy it. –  Leo Liu Aug 14 '11 at 9:24
add comment

1 Answer

use it this way:

\ifCLASSINFOpdf   
   \usepackage[pdftex]{graphicx}     
   % declare the path(s) where your graphic files are       
   \graphicspath{{../pdf/}{../jpeg/}{./image/}}    
   % and their extensions so you won't have to specify these with    
   % every instance of \includegraphics      
   \DeclareGraphicsExtensions{.pdf,.jpeg,.png,.jpg}   
 \else   
   % or other class option (dvipsone, dvipdf, if not using dvips). graphicx     
   % will default to the driver specified in the system graphics.cfg if no   % driver is specified.    
   \usepackage[dvips]{graphicx}   
   % declare the path(s) where your graphic files are     
   \graphicspath{{../eps/}}    
  % and their extensions so you won't have to specify these with   
  % every instance of \includegraphics    
  % \DeclareGraphicsExtensions{.eps}   
\fi

or even better, use for the complete above code only

\usepackage{graphicx}

and give the path with the image name

\includegraphics{pdf/image}
share|improve this answer
    
it doesn't solve my problem. –  Am1rr3zA Aug 14 '11 at 6:30
9  
then make a complete example and do not show only fragments of the code ... –  Herbert Aug 14 '11 at 6:49
    
@Am1rr3zA: Herbert's answer allows the compiler to switch between certain settings/options used by the graphicx package. This depends on whether you compile following a latex->dvips or pdflatex sequence. Which are you using? –  Werner Aug 14 '11 at 6:58
    
@Herbert I can't put all the code here, and also when I open the file with TeXWork everything is ok. I just have problem with WinWdt. –  Am1rr3zA Aug 14 '11 at 6:59
2  
@Am1rr3zA: Then it is assumed that Hypercube has an extension .pdf, .jpeg, .png, .jpg and is located in the main .tex folder, or in ../pdf/, ../jpeg/, or image/. If this is the case, then undefined control sequence could refer to something else. Either way, as always, provide more context by means of an MWE. –  Werner Aug 14 '11 at 7:07
show 3 more comments

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.