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'm trying to insert a file into my document. In the preamble I have

\usepackage{graphicx}

\usepackage{epstopdf}
Then in the text I have:

\begin{figure}[!ht]

\centering
\includegraphics[width={\textwidth}]{C:/..[full file path inserted]/DLSdiameter.eps}

\caption{Sizes of detergent micelles calculated by DLS.}

\label{fig:DLS_diameter}

\end{figure}

(note each command starts a new line, but I can't get that to display here without a linespace as well.)

This inserts the figure but leaves a large blank space above the figure in which parts of the file path are displayed twice. I also get two errors: 'File'C:/filepath' not found' and 'Cannot determine size of graphic in 'C:/filepath''. I initially used the Insert>Figure options in TeXnicCentre with some modifications to the code from internet searches. I am also using the conversion LaTeX=>PS=>PDF, as this is the only option which seems to display the figure. Any suggestions would be welcome. Thanks.

share|improve this question
    
As far as I remember (not using Windows for a while) the usual folder separator is \ not / (as on unix/mac). –  Ronny Dec 21 '12 at 12:44
    
Welcome to tex.sx, you can mark up code blocks using the {} button (just highlight the text first) or simply indent by 4 spaces. For inline code you can use bacticks like this –  David Carlisle Dec 21 '12 at 12:47
3  
@Ronny windows tex implementations (like most windows programs) can use / as the separator (and this is easier as it avoids other uses of \ ) –  David Carlisle Dec 21 '12 at 12:48
    
If you are using latex/dvips then you don't want the eps2pdf package, just graphicx. Hard to tell why you would get a repeated ath displayed, please try to make a complete small document so theproblem may be reproduced –  David Carlisle Dec 21 '12 at 12:51
add comment

2 Answers

TeX and related programs can be fooled when the path to a file to be read in (such as your graphic file) contains spaces.

There is a simple remedy:

\usepackage{graphicx}
\usepackage{grffile}
\usepackage{epstopdf}

The grffile package I added should solve the problem.

share|improve this answer
add comment

For a hassle free solution, just copy the file to the same folder as your document, then call the command.

\includegraphics[width={\textwidth}]{DLSdiameter.eps}

If you are getting too much space above, try this:

\vspace{-Xem} %change X to an number of your liking.
\includegraphics[width={\textwidth}]{DLSdiameter.eps}
share|improve this answer
    
Thanks - is there something about the windows Filepath that latex can't read? –  Mark Dec 21 '12 at 13:06
    
Running Windows 7, I can never work out how to deal with spaces in applications such as Latex. If your filename is void of spaces, the following format works if you want to go direct to the folder. C:/folderA/folderB/folderC/file.png –  Nicholas Hamilton Dec 21 '12 at 13:13
add comment

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.