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.

Don't really know where to begin. I have installed the latest macvim and skim. Put the mvim in path. Setup skim sync with the default macvim (and tried some custom stuff also). However it will not sync no matter what I do. Sync works between skim and textmate though.

Anyone able to guide me in some direction would be very much appreciated.

share|improve this question
    
Welcome to TeX.SX. I use vim myself but not on the Mac. Would you mind explaining what skim and syncing is all about? –  Marc van Dongen Feb 20 '12 at 1:45
    
Skim is a pdf reader that supports synchronization between the pdf file and the tex file simply by cmd+shift+click. Thus where you click in the pdf you will be taken there in the tex file. Very handy when writing large reports and stuff like that. –  Elithraldor Feb 20 '12 at 8:34
    
Thanks. I found the information yesterday. I don't use the software, but you may want to explain how you set up macvim and provide a minial example file. All I could find about configuration is this link. –  Marc van Dongen Feb 20 '12 at 8:43

4 Answers 4

I think you need to use the option --synctex=1. Actually in the most popular editors on the mac, the value used by default is 1. For using SyncTeX with your document just call pdflatex with the --synctex=1 option or place \synctex=1 in your documents preamble.

For more instructions about synchronisation between MacVim and Skim, you can read this article MacVim_Skim

Remark 1 : like egreg writes \usepackage{pdfsync} is obsolete with the last pdftex engine.

Remark 2 : TextMate 1 is not free but the synchronisation is fine with Skim.

Remark 3 : TeXShop has the better synchronisation with two methods.

Remark 4 : A new free (at present) editor arrived only for the Mac: TeXnicle. It's a remarkable project manager but I don't know if synchronisation is possible. After a quick try, the synchronisation is fine from tex -> pdf but there is a problem with pdf-> tex.

share|improve this answer
    
Google with MacVim Skim gives a lot of results about your problem. If your problem persists, you can ask a question to the author of Skim, he will answer you quickly. –  Alain Matthes Feb 20 '12 at 7:50
    
I have the '--synctex=1' option on, still does not work. And I have done what the link told me to do - still does not work. I have searched google for 4 hours or so - and no results really covered my problem, since it seems to work for everyone, but me. I tried deleting all skim preference and reinstall - also earlier version - to no avail. Also I have a vimrc from a friend of mine where the sync works just fine. –  Elithraldor Feb 20 '12 at 8:27
1  
1) What is the result in the terminal of $echo $PATH ? 2)To enable the synchro in skim, you have only to choice in the pref MacVim and you get : --remote-silent +":%line" "%file" and the script is mvim. In the terminal $which mvim gives the path of mvim then in the pref of skim, you choice macVim first then "other or personalized" and for the command instead mvim you write the result of $which mvim –  Alain Matthes Feb 20 '12 at 9:16
    
@Alain Your last comment solved it for me, even though plain mvim is in my path. Skim still doesn’t find it unless the absolute path is specified. Maybe the answer should be updated to include this information. The remark “TeXShop has better synchronisation” also isn’t quite true: once this problem is solved: MacVim’s synchronisation is just as good. Finally, the TeXnicle link is dead. –  Konrad Rudolph Oct 3 '13 at 17:41

I realize this is an old question; maybe you still have the issue though.

I had this same problem just now and finally solved it by editing the file compiler.vim in ~/.vim/ftplugin/latex-suite directly. Tossing in a few echos here and there, I noticed that it was taking the branch of the conditional to pick an editor that was for UNIX instead of picking Skim for Mac OS X. I ended up just deleting all the other possibilities for it to launch the viewer, though you could do this more elegantly / better-preserving compatibility by figuring out which parameter is causing it to take the wrong branch of the conditional and then re-coding / debugging accordingly.

For reference, here are my fixed ~/.vim/ftplugin/tex.vim and the relevant segment of ~/.vim/ftplugin/latex-suite/compiler.vim (this replaces the function Tex_ForwardSearchLaTeX(); my function Tex_ViewLaTeX() worked right off the bat but you may need to modify that function similarly).

    " this is mostly a matter of taste. but LaTeX looks good with just a bit
    " of indentation.
    set sw=2
    " TIP: if you write your \label's as \label{fig:something}, then if you
    " type in \ref{fig: and press <C-n> you will automatically cycle through
    " all the figure labels. Very useful!
    set iskeyword+=:


    let g:tex_flavor = 'latex'

    let g:Tex_MultipleCompileFormat = 'pdf,aux'
    let g:Tex_TreatMacViewerAsUNIX = 0
    let g:Tex_DefaultTargetFormat = 'pdf'
    let g:Tex_CompileRule_pdf = 'pdflatex -synctex=1 --interaction=nonstopmode $*'
    let g:Tex_ViewRule_pdf = 'Skim'

    " Command-R will write, compile, and forward search--thanks to
    " http://reference-man.blogspot.com/2011/09/fully-integrated-latex-in-macvim.html
    " preview, switch back to main window
    map <D-r> :w<cr><leader>ll<leader>ls
    imap <D-r> <ESC><D-r>



    let g:Tex_IgnoredWarnings ='
          \"Underfull\n".
          \"Overfull\n".
          \"specifier changed to\n".
          \"You have requested\n".
          \"Missing number, treated as zero.\n".
          \"There were undefined references\n".
          \"Citation %.%# undefined\n".
          \"Marginpar on page %.%# moved\n".
          \"\oval, \circle, or \line size unavailable\n"' 

The relevant additions are the ones of the form let g:tex etc.

Skim is set as below, which assumes as you mentioned that you copied mvim to that location or added it somewhere in $PATH etc.

screenshot of Skim settings

Finally the changes to compiler.vim starting at line 324:

    function! Tex_ForwardSearchLaTeX()
        if &ft != 'tex'
            echo "calling Tex_ForwardSeachLaTeX from a non-tex file"
            return
        endif

        if Tex_GetVarValue('Tex_ViewRule_'.s:target) == ''
            return
        endif

        let viewer = Tex_GetVarValue('Tex_ViewRule_'.s:target)
        let s:origdir = fnameescape(getcwd())

        let mainfname = Tex_GetMainFileName(':t')
        let mainfnameRoot = fnamemodify(Tex_GetMainFileName(), ':t:r')
        let mainfnameFull = Tex_GetMainFileName(':p:r')
        " cd to the location of the file to avoid problems with directory name
        " containing spaces.
        call Tex_CD(Tex_GetMainFileName(':p:h'))

        if viewer =~ "^ *Skim"
            let execString = 'silent! !/Applications/Skim.app/Contents/SharedSupport/displayline '.
                \ line('.').' "'.mainfnameFull.'.'.s:target.'" "'.expand("%:p").'"'

        elseif viewer =~ "^ *PDFView"

            let execString = 'silent! !/Applications/PDFView.app/Contents/MacOS/gotoline.sh '.
                \ line('.').' "'.mainfnameFull.'.'.s:target.'" "'.expand("%:p").'"'

        elseif viewer =~ "^ *TeXniscope"

            let execString = 'silent! !/Applications/TeXniscope.app/Contents/Resources/forward-search.sh '.
                \ line('.').' "'.expand("%:p").'" "'.mainfnameFull.'.'.s:target.'"'

        endif

        call Tex_Debug("Tex_ForwardSearchLaTeX: execString = ".execString, "comp")
        execute execString
        if !has('gui_running')
            redraw!
        endif

        exe 'cd '.s:origdir
    endfunction

Again, obviously, this was just a quick-and-dirty way to edit compiler.vim and I stopped caring once it worked, so you could make these either more compatible by not removing so many cases of the conditional or more elegant by just skipping the conditional altogether...I'm just wary of jinxing it now that it works ;)

Note: if you need step-by-step instructions for opening and editing these files, please leave a comment...believe me I've been frustrated by how much the related manuals / help files on the interwebs assume you already know how to do with software you're obviously new to, and I'd be glad to walk you through it in as much detail as you need to save you from the same frustration.

Note 2: I believe this is the full extent of changes to the default installation that I have made, but I could have left one out since I've been working on this so much. If this does not work for you, let me know and I'll look into what else I may have incidentally changed.

share|improve this answer

I had to set the following in my .vimrc to get <leader>lv to work correctly:

autocmd FileType tex call Tex_SetTeXCompilerTarget('View','pdf')                                                                                                                     

I hope it helps someone :)

share|improve this answer

You may need to add

\usepackage{pdfsync}

to your preamble to generate the necessary data for the sync.

share|improve this answer
    
Note that the pdfsync method is obsolete and is not at all concerned about the Elithraldor problem. –  egreg Feb 20 '12 at 6:41

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.