简体   繁体   English

如何在Emacs中使用Auctex + Preview-Latex + orgmode

[英]How to use Auctex + preview-latex + orgmode in emacs

I use Emacs orgmode exclusively. 我仅使用Emacs orgmode。 I installed auctex from Melpa. 我从Melpa安装了auctex。 My understanding is that preview-latex is packaged with auctex with no special setup required. 我的理解是, preview-latex与auctex打包在一起,不需要特殊的设置。

  1. I can't seem to summon preview-latex on any inline latex equations 我似乎无法在任何内联乳胶方程式上召唤preview-latex
  2. It seems like I have to change from orgmode to latex-mode to get the "latex" option in the toolbar. 似乎我必须从orgmode更改为Latex-mode才能在工具栏中获取“ latex”选项。

What am I doing wrong here? 我在这里做错了什么?

Thank you 谢谢

You are not doing anything wrong: org-mode has its own latex preview mechanism and does not use (indeed, cannot use) preview-latex . 您没有做错任何事情: org-mode具有自己的乳胶预览机制,并且不使用(实际上,不能使用) preview-latex There was talk a long time ago on the ML about integrating preview-latex into org-mode , but it has never been done. 很久以前,关于ML的讨论是关于将preview-latex集成到org-mode ,但从未完成。

The best method I found to preview latex in orgmode is: 我发现在orgmode中预览乳胶的最佳方法是:

  1. sudo apt-get install dvipng
  2. Restart emacs 重新启动emacs
  3. Place point at the beg of a latex inline equation in one of my .org files 将点放置在我的.org文件之一中的乳胶内联方程的乞g处
  4. Cc Cx Cl

Equation goes from this: 等式由此得出:

$$\frac{a}{b} \cdot \frac{c}{d} = \frac{a \cdot c}{b \cdot d} = \frac{product\ of\ numerators}{product\ of\ denominators}$$

To this: 对此: 在此处输入图片说明

Use Cc Cc to revert. 使用Cc Cc还原。

I do have Auctex installed (though I don't think dvipng uses it at all. And in my emacs init file I have: 我确实安装了Auctex(尽管我不认为dvipng使用它。在我的emacs init文件中,我有:

* AucTex: Require AucTex
(require 'tex-site') 

* LaTeX: Enable LaTeX Math mode by default
(add-hook 'LaTeX-mode-hook 'LaTeX-math-mode)

This is very sweet! 真是太好了!

make sure dvipng dvisvgm installed correctly 确保正确安装了dvipng dvisvgm

(executable-find "dvipng")
(executable-find "dvisvgm")

then add 然后加

(setq org-latex-compiler "xelatex")

to your init.el 到您的init.el
to make default latex compiler as xelatex 将默认的乳胶编译器设置为xelatex

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM