Emacs 为LaTeX跳转到PDF--synctex创建密钥绑定

Emacs 为LaTeX跳转到PDF--synctex创建密钥绑定,emacs,latex,emacs24,aquamacs,Emacs,Latex,Emacs24,Aquamacs,你知道如何将其转换为“跳转到PDF”的全局设置键吗 右键单击上下文菜单有几个有用的选项,我想我已经找到了这个文件:/Applications/Aquamacs.app/Contents/Resources/lisp/Aquamacs/auctex config.el。然而,我可能错了 我认为这将比简单地生成pdf更复杂,即: 此解决方案不依赖于使用Aquamacs,也就是说,一种通用的Emacs就足够了。对于带有包auctex-11.86的OSX版本的Emacs(雪豹和山狮),tex.el中的以

你知道如何将其转换为“跳转到PDF”的全局设置键吗

右键单击上下文菜单有几个有用的选项,我想我已经找到了这个文件:
/Applications/Aquamacs.app/Contents/Resources/lisp/Aquamacs/auctex config.el
。然而,我可能错了

我认为这将比简单地生成pdf更复杂,即:


此解决方案不依赖于使用Aquamacs,也就是说,一种通用的Emacs就足够了。对于带有包
auctex-11.86
的OSX版本的Emacs(雪豹和山狮),
tex.el
中的以下代码行会影响查看*.pdf文件:

第1028行:(“显示”(“显示”(模式io相关)-p%(输出)”)%o)

第1119行:(输出pdf“证据”)

Skim.app被广泛认为是OSX*.tex文档最合适的*.pdf查看器,因为它能够在检测到*.pdf文件的更改时自动更新显示,并且能够使用反向搜索(即,命令+shift+左键单击)在鼠标单击的精确位置跳回文本编辑器

由于OSX社区没有广泛使用Evince,因此解决方法是修改tex.el或修改init.el。tex.el中甚至有一个符号表示开发人员需要协调他们的工作,在OSX系统上实现查看*.pdf

下面是对init.el的修改,其中包括我自己选择的键盘快捷键。当前版本的
auctex-11.86
已经安装了
'TeX-view
(C-C-v)的键盘快捷键。注意:下面的代码将视图配置为在启用synctex的情况下跳转到PDF,因此任何想要在没有synctex的情况下快速查看的人都需要稍微不同的配置。我创建的键盘快捷键是F7 for build;F8表示跳转到pdf;和F9进行清理,但保留*.pdf和*.tex

[将来,我计划编写一些代码,将-output directory选项用于/tmp,并自动将*.pdf复制回工作目录,这样就不需要清理。TexLive目前不支持-aux directory选项,因此以前的解决方案是消除清理过程的最佳选项。]

(global-set-key (kbd "<f7>") 'TeX-command-master) ;; need to set a default for this to work.
(global-set-key (kbd "<f8>") 'TeX-view) ;; jump to *.pdf with synctex (or C-c C-v)
(global-set-key (kbd "<f9>") 'TeX-clean) ;; clean, but leave the *.pdf

(setq TeX-PDF-mode t)

(setq TeX-view-program-selection '((output-pdf "Skim")))

(add-hook 'LaTeX-mode-hook 'TeX-source-correlate-mode)

(setq TeX-source-correlate-method 'synctex)

(add-hook 'LaTeX-mode-hook
    (lambda()
        (add-to-list 'TeX-expand-list
            '("%q" skim-make-url))))

(defun skim-make-url () (concat
    (TeX-current-line)
    " "
    (expand-file-name (funcall file (TeX-output-extension) t)
        (file-name-directory (TeX-master-file)))
    " "
    (buffer-file-name)
))

(setq TeX-view-program-list
    '(("Skim" "/Applications/Skim.app/Contents/SharedSupport/displayline %q")))
(全局设置键(kbd“”)'TeX命令主控);;需要设置一个默认值才能工作。
(全局设置键(kbd“”)‘TeX视图);;使用synctex(或C-C-v)跳转到*.pdf
(全局设置键(kbd“”)‘TeX-clean);;清除,但保留*.pdf
(setq TeX PDF模式t)
(setq TeX查看程序选择’((输出pdf“Skim”))
(添加挂钩“乳胶模式挂钩”TeX源关联模式)
(setq TeX源关联方法“synctex”)
(添加挂钩“乳胶模式挂钩”
(lambda()
(添加到列表“TeX展开列表”
“(“%q”略读生成url)))
(defun skim make url()(concat
(特克斯电流线)
" "
(展开文件名(funcall文件(TeX输出扩展名)t)
(文件名目录(TeX主文件)))
" "
(缓冲区文件名)
))
(setq TeX查看程序列表
((“Skim”“/Applications/Skim.app/Contents/SharedSupport/displayline%q”))
另见:

(global-set-key (kbd "<f7>") 'TeX-command-master)
(setq TeX-view-program-selection '((output-pdf "Skim")))

(add-hook 'LaTeX-mode-hook 'TeX-source-correlate-mode)

(setq TeX-source-correlate-method 'synctex)

(add-hook 'LaTeX-mode-hook
      (lambda()
        (add-to-list 'TeX-expand-list
             '("%q" skim-make-url))))

(defun skim-make-url () (concat
        (TeX-current-line)
        " "
        (expand-file-name (funcall file (TeX-output-extension) t)
            (file-name-directory (TeX-master-file)))
        " "
        (buffer-file-name)
))

(setq TeX-view-program-list
  '(("Skim" "/Applications/Skim.app/Contents/SharedSupport/displayline %q")))
(global-set-key (kbd "<f7>") 'TeX-command-master) ;; need to set a default for this to work.
(global-set-key (kbd "<f8>") 'TeX-view) ;; jump to *.pdf with synctex (or C-c C-v)
(global-set-key (kbd "<f9>") 'TeX-clean) ;; clean, but leave the *.pdf

(setq TeX-PDF-mode t)

(setq TeX-view-program-selection '((output-pdf "Skim")))

(add-hook 'LaTeX-mode-hook 'TeX-source-correlate-mode)

(setq TeX-source-correlate-method 'synctex)

(add-hook 'LaTeX-mode-hook
    (lambda()
        (add-to-list 'TeX-expand-list
            '("%q" skim-make-url))))

(defun skim-make-url () (concat
    (TeX-current-line)
    " "
    (expand-file-name (funcall file (TeX-output-extension) t)
        (file-name-directory (TeX-master-file)))
    " "
    (buffer-file-name)
))

(setq TeX-view-program-list
    '(("Skim" "/Applications/Skim.app/Contents/SharedSupport/displayline %q")))