将 Emacs AUCTeX 与 Sumatra PDF 同步 [英] Sync Emacs AUCTeX with Sumatra PDF

查看:21
本文介绍了将 Emacs AUCTeX 与 Sumatra PDF 同步的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

通过我的 init.el 中的这些行,我可以将 Emacs LaTeX 缓冲区与 Sumatra 同步:

With these lines in my init.el I am able to sync the Emacs LaTeX buffer with Sumatra:

(setq TeX-source-correlate-mode t)
(setq TeX-source-correlate-method 'synctex)
(setq TeX-view-program-list 
  '(("Sumatra PDF" (""C:/bin86/SumatraPDF/SumatraPDF.exe" -reuse-instance" 
                      (mode-io-correlate " -forward-search %b %n ") " %o"))))
(setq TeX-view-program-selection  
      '(((output-dvi style-pstricks) "dvips and start") (output-dvi "Yap") 
       (output-pdf "Sumatra PDF") (output-html "start")))

要设置双击 PDF 以获取相关的 LaTeX 代码,我还在 Sumatra 选项中设置 Set inverse search command line 为:

To set a double click on the PDF to get me to the related LaTeX code, I also set in Sumatra options Set inverse search command line to:

"c:in86GNU Emacs 24.2inemacsclient.exe" --no-wait +%l "%f" 

尽管同步有效,但我想对其进行不同的编码.

Despite the sync works, I’d like to code it differently.

如果我没有设置最后一个表达式,(setq TeX-view-program-selection...,我会得到与上面相同的默认值,除了PDF 输出的值将是:(output-pdf "start").我想将此更改为Sumatra PDF",并将其他值保留为默认值,即我想向 Emacs 询问查看器的默认值并仅更改 PDF 值.

If I didn’t set the last expression, (setq TeX-view-program-selection..., I would get the default values, which are the same as above, apart from the value for the PDF output that would be: (output-pdf "start"). I’d like to change this one to "Sumatra PDF" and leave the other values to their default, that is, I’d like to ask Emacs the default values for the viewers and change only the PDF value.

这主要是一个关于变量 TeX-view-program-selection 操作的 ELisp 问题.感谢您的帮助.

It is mostly an ELisp question concerning the manipulation of the variable TeX-view-program-selection. Thanks for helping.

附:请告诉我这个问题是否最适合 tex.stackexchange

P.S. Please tell me if this question is best fit on tex.stackexchange

要更新 TeX-view-program-selection 我可以使用:

To update TeX-view-program-selection I could use:

(assq-delete-all 'output-pdf  TeX-view-program-selection)
(add-to-list 'TeX-view-program-selection   '(output-pdf "Sumatra PDF"))

第一行是可选的,但它使列表看起来更干净".

The first line is optional, but it makes the list look "cleaner".

在这两种情况下(有或没有 assq-delete-all)我现在需要将代码插入到正确的钩子中,因为 TeX-view-program-selectioninit.el 中是无效的.

In both cases (with or without assq-delete-all) I now need to insert the code in the proper hook, since TeX-view-program-selection is void in init.el.

推荐答案

感谢 lunaryorn 的建议!我正在重新包装所涉及的步骤以使其他人受益.

My credits to lunaryorn for suggestions! I am repackaging the steps involved to the benefits of the others.

添加到您的 init.el:

(setq TeX-PDF-mode t)
(setq TeX-source-correlate-mode t)
(setq TeX-source-correlate-method 'synctex)
(setq TeX-view-program-list
   '(("Sumatra PDF" (""path/to/SumatraPDF/SumatraPDF.exe" -reuse-instance"
                      (mode-io-correlate " -forward-search %b %n ") " %o"))))

(eval-after-load 'tex
  '(progn
     (assq-delete-all 'output-pdf TeX-view-program-selection)
     (add-to-list 'TeX-view-program-selection '(output-pdf "Sumatra PDF"))))

苏门答腊一侧

在设置->选项对话框中设置设置逆向搜索命令行为:

"path	oGNU Emacs verinemacsclient.exe" --no-wait +%l "%f" 

如何使用

在 Emacs 中的 LaTeX 文档中键入 C-c C-v 或在 Sumatra 中双击相关的 PDF 并...享受))

How to use

In your LaTeX document in Emacs type C-c C-v or double click the related PDF in Sumatra and ... enjoy))

这篇关于将 Emacs AUCTeX 与 Sumatra PDF 同步的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆