1

I am using emacs+skim to preview latex on macs, and I use auctex preview-latex from time to time. the problem is, after I run C-c C-p C-d in emacs to preview entire document, the pdf file is now deleted, and skim show a bunch of formulas (as Sumatra does on Windows). Then I recompile and run C-c C-v to see file in skim, but skill still shows a bunch of formulas in separate pages. While in Sumatra, it shows immediately the newly compiled pdf file, despite that it was deleted a while ago due to preivew-latex. Is there a way to fix this on mac?

p.s.

This seems only to happen when the entire document is previewed in emacs, for example, C-c C-p C-e does not cause this problem.

At first skim ask permission to revert for every newly generated pdf file, but the "secret preference" mentioned in the post resolves the issue.

davyjones
  • 935
  • I just close Skim programmatically and open a new pdf, because I found a bug in Skim a few months ago -- although I cannot remember right now exactly what it was. However, that may be a non-AUCTeX solution -- I have both options. Here is a link to my setup -- I don't have any issues, but I don's use preview -- I just print a final pdf and if I don't like it, I revise the LaTeX source and generate a new pdf: Here is the first link: http://stackoverflow.com/a/22746845/2112489 and here is the second link: http://tex.stackexchange.com/a/156617/26911 – lawlist Jun 25 '14 at 05:20
  • @lawlist, thanks! I have no problem generating pdf, neither do I have to kill skim in terminal, there is a revert option in the menu list. However, as a lazy person, I am curious if this could be avoided, since Sumatra has no such problem. – davyjones Jun 26 '14 at 03:13
  • There are two Skim options to revert -- the non-hidden option in the Preferences (i.e., "Check for file changes" under the Sync menu), which probably gives you the yes / no option, and that is why you (like all of us) have Googled the hidden option: defaults write -app Skim SKAutoReloadFileUpdate -boolean true It sounds like you need to program in a close the current window on Skim, however, I haven't researched the Applescript equivalent (just close the entire program). I'll add to my todo-list a close window Applescript if no one resolves this for you. – lawlist Jun 26 '14 at 03:23
  • I'll need to pick it up again in the next few days (it's bedtime here in L.A.), but here is the applescript to close a window -- the idea is that you get rid of the window that contains an error without closing the entire application: (defun test () (interactive) (let ((script (concat "set myWindowTitle to \"envelope.pdf\"\n" "tell application \"System Events\"\n" "tell application \"Skim\" to close (every window whose name contains myWindowTitle)\n" "end tell\n" ))) (start-process "osascript-getinfo" nil "osascript" "-e" script))) Of course, we'll substitute envelope.pdf for the real one. – lawlist Jun 26 '14 at 05:47
  • I've incorporated the close-skim-window applescript into a non-AUCTeX solution in the elisp function latexmk in the following link: http://tex.stackexchange.com/a/156617/26911 The original poster could (in theory) use that type of mechanism to close the window of the improperly displayed *.pdf so that a new window gets generated during the compilation process. If someone would like to turn that into an AUCTeX solution for the original poster, please feel free to use my idea. – lawlist Jun 26 '14 at 16:40
  • Here is an applescript that may serve to Revert the *.pdf; however, Revert is greyed-out for me so I couldn't test it -- it works with Open, so it probably works with Revert (when not greyed-out) -- go ahead and give it a whirl: (defun revert-pdf () (interactive) (let ((script (concat "tell application \"Skim\"\n" "activate\n" "tell application \"System Events\" to tell process \"Skim\"\n" "click (menu item 1 where its name starts with \"Revert\") of menu 1 of menu bar item \"File\" of menu bar 1\n" "end tell\n" "end tell"))) (start-process "osascript-getinfo" nil "osascript" "-e" script))) – lawlist Jun 27 '14 at 15:40

0 Answers0