[background: I am an old unix guy. I use a 4-year old macbook pro, but the newer macbooks seem to become worse (keyboard,touchbar) rather than better. They are now also twice as expensive as the dell xps15 for my needs (ymmv). so I want to try the xps15. I think I can use almost everything I ever need on WSL, except for the following:]

I need an emacs with auctex, and the feature that the pdf file is automatically recompiled and displayed whenever I save the edited file to disk. on macos, I have a script that watches the tex file (and its includes) for changes, and then Skim.app then automatically detects the change and refreshes the window. very convenient. I am too old to want to switch editors.

Emacs exists for Windows, and I can even use it in WSL. Alas, is there a Windows solution that watches tex files and their includes for changes, and updates an open pdf preview window?

  • latexmk can watch files and open the previewer for you (look for the -pvc option). But can't you just say C-c, C-a, y (to save, compile and watch) instead of C-x, C-s (to save and have a script watch the file for changes)? – moewe Sep 21 '18 at 14:47
  • OT: why no return to a *nixoid OS? – naphaneal Sep 21 '18 at 17:31
  • exploring WSL. MS seems to have improved greatly in the last 5 years. and ubuntu linux native is not stable on the dell 9570 yet. the alternative is virtualbox. – ivo Welch Sep 22 '18 at 16:03

Try SumatraPDF portable pre-release is best for testing it can be set to work back and forth using CLI startup (less usage rights issues) avoid the DDE methods you historically see. Run portable SumatraPDF once (to build settings.txt file) then change InverseSearchCmdLine = "\path to\emacsclientw.exe" -n +%l "%f" (some users indicate the call may benefit from -a emacs prior to or in place of -n but I donk know the merits?)

Also ensure reuseinstance = true and I would recommend set HighlightPermanent = true you don't need to change EnableTeXEnhancements = false to true (it will change on first successful call thus an indicator the call worked) however since your there it may help whilst testing to set it = true

Call SumatraPDF without -reuse-instance so ignore that bit in this 2012 forward calling article

Cons:- There is a hardcoded limit of 10MB without file locking, so if you generate a large pdf it will work but you may need to close/delete pdf prior to recompile, so as to avoid emacs errors. Whilst working it helps to keep image resolutions low (dummy images) and reset for final compile. There can be issues in cases where the underlying disk format ntfs/ext-fat/network/cloud drives differ between files so the change in file is not seen, if so in SumatraPDF press R for refresh.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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