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.

A file I can compile in Texmaker won't compile after editing in Vim. I am giving the error hw9problem1xplot can't be found. This is from an includegraphics command. However, the pdf image file is in the same folder as the tex file, and I was able to compile this file with the includegraphics from Texmaker.

What I have been doing is :w and :!pdflatex % but I am told that the pdf image file doesn't exist or it can't find it. How can this be? I can compile the file in Texmaker without an issue.

So I found the problem, Vim is saving the file elsewhere and not where I pulled the file from. So it is looking for the pdf in the wrong directory. How can I change where Vim saves the file?

What do I need to setup to correct this issue?

After vonbrand's a suggestion, I tried running :!pdflatex -shell-escape %. Unfortunately, I received the same error message.

! LaTeX Error: File `hw9problem1xplot' not found.

See the LaTeX manual or LaTeX Companion for explanation.
Type  H <return>  for immediate help.
...                                              

l.86 ...degraphics[width = 3in]{hw9problem1xplot}}

I have tried hw9problem1xplot with and without .pdf too.

I commented out the figure with the with the includegraphics and it compiled without an issue. I double checked the folder and the pdfs are present so I don't know what the problem is.

share|improve this question
    
There is the add-on vim-latexsuite, which you can install via apt. (I don't use vim myself, however.) Also you should be able to compile your file regardless of whether vim is visiting the file or not. –  jon Mar 24 '13 at 22:39
    
@jon I have the latex suite installed. I just started trying out Vim with the Latex suite so I don't know how run that yet and why I am enquiring. –  dustin Mar 24 '13 at 22:40
    
Unfortunately, I've never used it myself; but see here for the manual, etc. –  jon Mar 24 '13 at 22:44
    
I can't find the /.vimrc file to edit that is mentioned in all the documents so the manual hasn't helped me. I am on Ubuntu 12.04 –  dustin Mar 24 '13 at 22:46
1  
If you run pdflatex file.tex it should work, or give some error messages. In my experience the "easy to use" LaTeX systems add all sorts of horrible macros that have to be unraveled to get readable source, perhaps you are tripping over one of those? See if an unedited file can be processed on the command line. Look at the manual page for pdflatex, perhaps you need pdflatex -shell-escape file.tex (careful, that means Unix commands are allowed to be run from the .tex source!). –  vonbrand Mar 24 '13 at 23:15
show 8 more comments

closed as off topic by Jan Hlavacek, Aditya, lockstep, Kurt, Werner Mar 25 '13 at 4:12

Questions on TeX - LaTeX Stack Exchange are expected to relate to TeX, LaTeX or related typesetting systems within the scope defined by the community. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about reopening questions here.If this question can be reworded to fit the rules in the help center, please edit the question.

1 Answer

up vote 0 down vote accepted

Vim was saving to the home directory when I was working with a file in documents.

So I changed the the working directory to my documents by:

:cd %:p:h
share|improve this answer
1  
you might like to put set autochdir in your ~/.vimrc too :) –  cmhughes Mar 25 '13 at 1:21
    
@cmhughes can you walk me through the steps of creating that file and setting it up? I can't figure it out from the manual. –  dustin Mar 25 '13 at 1:23
    
@cmhughes which room? –  dustin Mar 25 '13 at 1:40
add comment

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