2

I'm trying to sync between emacs and skim, and this is the site that I reference: https://stackoverflow.com/questions/7899845/emacs-synctex-skim-how-to-correctly-set-up-syncronization-none-of-the-exi

Following the guide, I could make the setup that I could Shift-Cmd-Click on emacs/AUCTeX to launch skim.app, however, I could not make the backward-sync. When I click Shift-Cmd-Click on Skim.app, nothing happens. This is the configuration from skim.app.

enter code here

I checked that reverse sync is working with other editors such as TextMate, so the issue seems to be with emacsclient. I have (server-start) in init.el.

I double-checked to launch server with M-x server-start command from emacs, This is what I got from emacsclient command:

a> emacsclient -s server a.tex 
emacsclient: connect: Connection refused
emacsclient: error accessing socket "/tmp/emacs501/server

Using the hints in Emacs: using emacsclient doesn't help, as I find no server-socket-name variable assigned.

What seems wrong is that emacsclient -s server a.tex tries to use /tmp/emacs501/server while server-socket-dir points to "/var/folders/sj/6xmft7c105ngpzh4dv9kc2dc0000gn/T//emacs501". I copied the server file into \tmp/emacs501 to relaunch to get this error:

a> emacsclient -s server a.tex 
emacsclient: can't find socket; have you started the server?
To start the server in Emacs, type "M-x server-start".
emacsclient: error accessing socket "/tmp/emacs501/server"smcho@smcho mass2015> emacsclient -s server mass2015.tex 
Waiting for Emacs...
-emacs-pid 19104
-error Unknown&_command:&_/Users/me/Desktop/a/a.tex

What might be wrong? How to make emacsclient working and how to check if it works right?

2

In the Command line, the location of emacsclient should be specified.

enter image description here

Other setups

latexmkrc

If you want to use latexmk, these configuration setup should be added in ~/.latexmkrc.

$pdflatex = 'pdflatex -interaction=nonstopmode -synctex=1 %O %S';
$pdf_previewer = 'open -a skim';
$clean_ext = 'bbl rel %R-blx.bib %R.synctex.gz';

emacs setup for AucTeX

;; AucTeX
(setq TeX-auto-save t)
(setq TeX-parse-self t)
(setq-default TeX-master nil)
(add-hook 'LaTeX-mode-hook 'visual-line-mode)
(add-hook 'LaTeX-mode-hook 'flyspell-mode)
(add-hook 'LaTeX-mode-hook 'LaTeX-math-mode)
(add-hook 'LaTeX-mode-hook 'turn-on-reftex)
(setq reftex-plug-into-AUCTeX t)
(setq TeX-PDF-mode t)

(add-hook 'LaTeX-mode-hook
          (lambda () (local-set-key (kbd "<S-s-mouse-1>") #'TeX-view))
          )
(setq TeX-PDF-mode t)

;; Use Skim as viewer, enable source <-> PDF sync
;; make latexmk available via C-c C-c
;; Note: SyncTeX is setup via ~/.latexmkrc (see below)
(add-hook 'LaTeX-mode-hook (lambda ()
  (push
    '("latexmk" "latexmk -pdf %s" TeX-run-TeX nil t
      :help "Run latexmk on file")
    TeX-command-list)))
(add-hook 'TeX-mode-hook '(lambda () (setq TeX-command-default "latexmk")))

;; use Skim as default pdf viewer
;; Skim's displayline is used for forward search (from .tex to .pdf)
;; option -b highlights the current line; option -g opens Skim in the background  
(setq TeX-view-program-selection '((output-pdf "PDF Viewer")))
(setq TeX-view-program-list
     '(("PDF Viewer" "/Applications/Skim.app/Contents/SharedSupport/displayline -b -g %n %o %b")))
(server-start)     

References

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.