emacs - 无法使用 auctex 和 emacs 进行预览

标签 emacs latex auctex

我在 linux mint 上使用 emacs 和 auctex。编写以下简单的 .tex 文件时,我无法在 emacs 中预览数学公式

\documentclass[a4paper,12pt]{article}
\usepackage{amsmath}

\begin{document}
I am going to write down the formula 
\[
    \sum_{k=1}^\infty x_k=\frac{x}{1-x^2}
\]
\end{document}

当我按 C-c C-p 时,出现以下错误消息:
No appropriate `.dvi' file could be found

似乎 emacs 不会生成任何 .dvi 文件。如何解决这个问题?谢谢大家。

最佳答案

我遇到了这个问题,因为我要求在构建完成之前显示 dvi 文件。下面的 elisp 用于一个 bind-keys 函数,它分配 control-p 来预览 latex 。

("C-p" . (lambda ()
  "Preview a latex buffer or selected region."
  (interactive)
  (if (use-region-p)
     (tex-region (region-beginning) (region-end))
   (tex-buffer))
  (run-with-idle-timer 0.3 nil 'tex-view)))

tex-region 和 tex-buffer 命令开始从 TeX 到 dvi 的转换,并打开另一个显示中间文件名的窗口。这些文件,包括所需的 dvi 文件,将在窗口关闭后立即删除。

我使用 run-with-idle-timer 函数等待 emacs 空闲 0.3 秒,然后再尝试显示文件。

注意:我不确定这仅仅是因为我的 tex 文件很小,还是因为它确实有效。

关于emacs - 无法使用 auctex 和 emacs 进行预览,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16829772/

相关文章:

Emacs AucTex Latex 语法防止等宽字体

emacs M-e 在 tex 模式下无法正常工作

emacs - 使用参数定义键绑定(bind)

emacs - emacs/spacemacs 是否支持嵌套在 Rust 宏中的 C++ 模式?

emacs - 从 emacs 菜单栏中的 "Buffers"项更改菜单的大小

emacs - 'subexpression'如何在emacs中的 "replace-match"函数中工作

python - 使用Python将引号转换为Latex格式

latex - 当算法2e包以elsart格式使用时,行号将被标记在框外。怎么解决呢?

latex - 需要减少这个空白,但似乎在我能做的范围内(GNUPLOT)

Emacs Auctex 编译错误: "Use M-x make-directory RET RET to create the directory and its parents"