AUCTeX与Sumatra同步PDF

AUCTeX与Sumatra同步PDF

本文介绍了将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:\bin86\GNU Emacs 24.2\bin\emacsclient.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.

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

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

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

(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"))))

苏门答腊一侧

在设置"->选项"对话框中,将Set inverse search command line设置为:

"path\to\GNU Emacs ver\bin\emacsclient.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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

1403页,肝出来的..

09-07 01:47