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.

Hope I didn't forget any. These are the packages I want to use on my computer for typesetting pdf files. Up to date I'm using vim (without any plugin but integrated syntax highlighting for .tex files) in console (cmd.exe) for typing .tex files. Then I close it (:wq), close PDF-XChange tab with typesetted document, issue pdflatex file.tex, open explorer, click on generated .pdf file (anyhow it opens at the page and zoom configuration left in PDF-XChange) check for convenience, close, edit, compile, open, etc.

I would love to skip the "close .pdf file - reopen .pdf file" cycle! Any ideas? Thanks.

share|improve this question
    
I would like to use vim for my editing to keep the vim training up and running ;) So, this is a good point and I believe there are real convenient ways (no surprise) to editing and viewing .tex files, .pdf output - but my issue here is with getting vim running in this to experience what the strenghts of it are and what it has to offer, what the benefits are while editing, I'm a bit biased in this and curious. –  panny Jun 22 '11 at 9:11
add comment

4 Answers 4

You could easily issue that series of actions from inside vim. You could even make it a macro to do it in one keystroke. If you hit ! inside vim, you can ten enter a command to be executed in the shell. You could do something like this:

:w !pdflatex % && acroread %.pdf

The % should expand to the current file name. You could type in your own file names there too. You should be able to go back in vim command history to hit that again. If you do this often, you could make a macro out of the whole save, generate and open routine.

share|improve this answer
    
Thanks @Caleb. Unfortunately on windows the .pdf file does not open. I tried :w !pdflatex % && pdfxcview %.pdf and pdfxcview opens but without the document. Outside of vim I can open the document with pdfxcview mydocument.pdf. Also keeping pdfxcview open would be great, since I have multiple .pdf files open in it (pgf manual, symbols reference). I just want mydocument.pdf to refresh for me. –  panny Jun 22 '11 at 9:15
    
@panny: It looks like pdflatex is stripping the .tex extension and adding pdf, so the expansion I have you is giving "filename.tex.pdf", so you will have to fill that file name in manually. As for keeping pdfxcview open, it might have some sort of remote function where you could send new files to a running process and it would just open or refresh it. –  Caleb Jun 22 '11 at 9:20
    
@Caleb thank you, this works perfect for opening the document, still I think the reload problem is a pdflatex issue - not a pdfxcview problem. The problem is, pdflatex cannot write in a .pdf file that is already open and it insists on a new name. Do you know any workaround to that? –  panny Jun 22 '11 at 12:25
1  
@panny: No that sounds like a very Windows specific file locking problem and I'm a *nix guy. You might ask that as a separate question on SuperUser. The question would be how to make pdfxcview not lock files it opens or force pdflatex to overwrite locks. –  Caleb Jun 22 '11 at 14:30
    
@panny, I agree with Caleb, I don't think it's pdflatex issue, AFAIK PDF-XChange Viewer doesn't have any mechanism which enables it to refresh the PDF file. Actually, I even experienced crashes if the file is changed outside it. –  Meho R. Jun 22 '11 at 19:59
show 1 more comment

You can't really skip the close-reopen cycle with PDF-XChange viewer, because it locks pdf file (just like Adobe Reader does), so pdflatex can't update it. But you can automate that cycle (the /close command line switch to pdfxcview is the key here):

pdfxcview /close:discard somefile.pdf
pdflatex somefile.tex
pdfxcview somefile.pdf

Of course for easier use you can wrap that in a batch script or vim macro, but you get the idea. See also this thread.

share|improve this answer
add comment

I would consider choosing a PDF viewer, which does not lock the PDF file and has a 'reload on change' function. Example: Sumatra. See here: Output viewers for use with LaTeX

share|improve this answer
add comment

This is a potentially unsatisfying fix, in that it requires Cygwin. Install xpdf under Cygwin if you don't already have it, then put the following in ~/.xpdfrc:

    bind ctrl-p any "run(xterm -e 'pdflatex %b')" reload

Then you can use control-p to recompile and reload your document without having to close and reopen xpdf. I've written it so it pops up an xterm where you can see the compilation messages, but you could get rid of xterm -e and the single quotes if you like to live dangerously.

The same thing works under Linux, but the questioner asked about Windows.

share|improve this answer
1  
See amoura's answer. Sumatra sounds like a much better solution under Windows, and I'm probably going to switch to that myself. –  matt Dec 5 '11 at 21:34
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.