[Tex/LaTex] How to compile latex even when pdf is open in windows using MiKTeX

kilemiktexpdftex

In Linux, you can edit the source .tex file and on compilation the changes reflect in the pdf file even if pdf file is open in some pdf viewer. I tried this on kile.

But the same doesn't happen in Windows. Either i have to close the open pdf or completely delete it in order to re-compile the .tex file using MiKTeX.

Can we do something about this, so that i can have same experience of linux while using latex on Windows?

Is this the problem of MiKTeX only? Will changing the MiKTeX to say kile libraries work?

Best Answer

Apparently there are numerous feasible solutions. Of course, the best solution is the one with which you are most comfortable. Following is my preferred approach for processing files LaTex files on Windows.

  1. Edit with emacs. This is well supported on Windows. Emacs is smart and context sensitive. Initiating the compile command with Ctl C, Ctl C invokes the MikTex pdflatex command.
  2. Of course, one must have loaded MikTex for this to work. MikTex is smart and, among other things, it will automatically go out to the web to find packages that are cited in the LaTex document but not already loaded on your computer.
  3. Preview with the Sumatrapdf pdf viewer. I used to use the pdf viewer that comes with the TeX-Works package, but it no longer seems to free up the pdf for editing. You might also want to turn off Windows Explorer preview; it can also lock up the pdf from editing or over-writing.

In implementation, I open the LaTeX file with emacs and invoke pdflatex. Now that a .pdf file exists, I open that pdf with Sumatrapdf (SP). I keep that SP window open and as I edit and compile the .tex file on emacs, the SP viewer window automatically updates to reflect the changes made to the document.

Again, whatever you use most comfortably is the right answer for you.