SublimeText / LaTeXTools

LaTeX plugin for Sublime Text
https://latextools.readthedocs.io/
2.01k stars 364 forks source link

On idle #312

Open stephenll opened 10 years ago

stephenll commented 10 years ago

Any thoughts about or how to invoke the build for latex when idle? Texpad on OSX does this really nice. When you stop typing it automatically triggers a rebuild of the pdf.

Thanks for your addin.

msiniscalchi commented 10 years ago

Yes, it's on my todo list, but I'm so hopelessly behind :( Anyway, I do like that feature; the Textmate bundle had a similar one.

On Wed, Jan 15, 2014 at 4:53 PM, stephenll notifications@github.com wrote:

Any thoughts about or how to invoke the build for latex when idle? Texpad on OSX does this really nice. When you stop typing it automatically triggers a rebuild of the pdf.

Thanks for your addin.

— Reply to this email directly or view it on GitHubhttps://github.com/SublimeText/LaTeXTools/issues/312 .

Marciano Siniscalchi Economics Department, Northwestern University http://faculty.wcas.northwestern.edu/~msi661

chid commented 10 years ago

Can you explain to me how this works? So as soon as ST is 'idle' it invokes the build, what happens if I type another character? Does it cancel the build?

I think this is better done with latexmk's -pvc command

from the docs,

   Particularly  when a document is reaching the final stages
   of editing, it is often useful to have  a  previewer  open
   continuously  and  have  it  update  its  display whenever
   changes are made to the source file(s).  For this, latexmk
   provides  the  powerful  -pvc  option (mnemonic:  "preview
   continuously").  With this option,  latexmk  runs  a  pre-
   viewer for the document,  and then latexmk repeatedly mon-
   itors the source files of  the  document  to  see  if  any
   changes  have  been made since the last dependent file was
   produced.  When changes are  detected,  latexmk  runs  the
   appropriate  LaTeX  commands  to  regenerate the .dvi, .ps
   and/or .pdf files (depending on the which of the  -ps  and
   -pdf  options  was  specified,  the .ps file.  A good pre-
   viewer (like gv) will then automatically update  its  dis-
   play.   Thus the user can simply edit a file and, when the
   changes are written to disk, latexmk completely  automates
   the  cycle  of updating the .dvi (and possibly the .ps and
   .pdf) file, and refreshing the previewer's display.   It's
   not quite WYSIWYG, but usefully close.
stephenll commented 10 years ago

The benefit of triggering this from inside sublime is that you get the pdfsync so after the pdf is generated it goes to the place where you were in the file.

I am not sure who texpad on osx handles if you start updating during a build. Something to think about.

chid commented 10 years ago

I haven't tested but my guess is you can use latexmk -pvc with latextools' forward search

chid commented 10 years ago

I just tried it with my XeLaTeX file. I just ran,

latexmk -pvc -xelatex -synctex=1 file.tex

and it works perfectly with forward search (MikTex on Windows)