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.

So I want to use LaTeX in sublime text 2, and I came across the plugin LaTeXTools. It works great, but it requires me to install Skim PDF Viewer. Is it possible to set it up so that when I compile the latex file it opens it in the PDF preview already installed on my mac?

share|improve this question
1  
"On OSX, you need to be running the MacTeX distribution (which is pretty much the only one available on the Mac anyway) and the Skim PDF previewer.". They are calling the previewer by the command line. I guess you have to contact those guys (github.com/SublimeText/LaTeXTools/issues) to ask for other viewers resp. their support. –  LaRiFaRi Jul 22 '13 at 18:29
5  
I would strongly recommend to just use Skim. To my knowledge it is the only MacOS PDF viewer that supports auto refresh and pdfsync integration, so that you can easily navigate between your TeX source and the PDF preview. –  Daniel Jul 22 '13 at 18:55
    
You can do this if you really want to (it will take some work, and knowledge of python) by hacking the package source. To get to it, got to Preferences -> Browse Packages..., select LatexTools, and then jumpToPdf.py; this calls a shell script that calls applescript to get Skim to do its thing. There are various options for restructuring this. However, the reason this isn't an option is that preview doesn't have good support for reloading changed files (IIRC it varies by version too), and there is no API to make it as smooth as the interface with Skim. Basically, it's not worth it... –  kgr Jul 22 '13 at 20:06
    
I would also like reconfigure Sublime to use Preview.app. In OSX Mavericks the Preview app does automatically refresh a changed PDF and I have no interest in forward search. My main interest is in minimising the amount of unnecessary third party software on my laptop. –  Ubiquitous Nov 13 '13 at 12:30
    
Preview has some advantages over Skim, such as a proper fullscreen mode that allows you to switch between your PDF and source code with multi-touch. –  Ubiquitous Nov 14 '13 at 20:45
add comment

2 Answers 2

UPDATE: This does not work as advertised.

I undeleted this post after @Bordaigorl posted the same solution. There are still some unresolved issues. Changing viewPDF.py appears to work only if Skim is not installed.


The PDF-viewer in the LaTeXTools-package is configured in a file called viewPDF.py — as @kgr already pointed out. For OSX you can change the viewer form skim to preview by changing line 44 from:

viewercmd = ["open", "-a", "Skim"]

to:

viewercmd = ["open", "-a", "Preview"]

But I would recommend against it. Skim is an excellent PDF viewer that takes under 10 MiB on your harddisk.

share|improve this answer
    
I already changed that line to viewercmd = ["open", "-a", "Preview"] in viewPDF.py, but Sublime still opens skim rather than preview when I build my LaTeX project. I appreciate that Skim has its advantages, but there are nice things about the preview app, such a proper full screen support that allows me to do a multitouch swipe to quickly sqitch between my source and the preview. –  Ubiquitous Nov 14 '13 at 10:15
    
You have to remove Skim.app from your system to make it work. –  DG' Nov 20 '13 at 20:25
add comment

The LaTeXTools plugin invokes the viewer from viewPDF.py.

Line 39 to 44 is the code which is selecting the commands to invoke when running on OSX:

    if s == "Darwin":
        # for inverse search, set up a "Custom" sync profile, using
        # "subl" as command and "%file:%line" as argument
        # you also have to put a symlink to subl somewhere on your path
        # Also check the box "check for file changes"
        viewercmd = ["open", "-a", "Skim"]

As you can see the Skim command is hard-coded in the script so there is no setting you can change to modify it from outside the script itself.

The simplest patch is replacing line 44 with

viewercmd = ["open", "-a", "preview"]

but be aware that if you installed Package Control and LaTeXTool gets updated you loose your patch.

So the best solution would be to open an issue on github suggesting they could read the command to be launched from a setting instead of hard-coding it.

share|improve this answer
    
Have you really tried that? Did it really work? I thought that that was a solution, but it did never actually work . . . –  DG' Nov 20 '13 at 19:00
    
@DG' I made it a community wiki so we can maybe make it work together. I do not have access to a machine running OSX at the moment so I can't debug it properly. In principle that is the solution, I am not actually sure how you should invoke preview.app –  Bordaigorl Nov 20 '13 at 19:33
    
Does it work with "Preview" capitalised? –  Bordaigorl Nov 20 '13 at 19:35
    
No. Neither does Preview.app. –  DG' Nov 20 '13 at 20:07
2  
Ok, maybe I know why. Are you sure you are actually invoking the view_pdf command? If you open the sublime console and type window.run_command("view_pdf") does it work? If so it means that you were actually calling the jump_to_pdf command which also has the invocation to Skim hardcoded. –  Bordaigorl Nov 20 '13 at 21:50
show 2 more comments

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.