AucTeX Emacs 编译问题

AucTeX Emacs 编译问题

我在 Ubuntu 13.10 64 位系统上安装了 emacs23。我还下载了 AucTeX tarball 并安装了它(./configure然后make和最后make install)。现在我在 emacs 的菜单中获得了 LaTeX 命令,并且键绑定也运行良好。但我只能在 LaTeX 模式下编译。也就是说,要生成 pdf,我必须进入目录并pdflatex在终端中输入命令。其次,我尝试了其他emacs 编译中的选项,但 pdflatex 并不作为命令存在。我想直接运行 pdflatex 而不是 LaTeX 编译,这样它就可以修改我的 pdf。其次,我也无法在 emacs 中运行 XeLaTeX 或 LuaTeX。这些是我可用的编译选项:

在此处输入图片描述 另外,我尝试了一个示例代码,我能够使用latexpdflatex命令在终端中编译并获取 pdf,但 emacs 显示了一些错误。

在此处输入图片描述

以下是我运行的代码:

\documentclass[12pt]{article}
\author{Subham Soni S.}
\date{\today}
\title{Installing a new Kernel(ver. 3.13.3) to the Existing Ubuntu Operating System}
\begin{document}
\maketitle
To replace the existing \textsl{kernel} with a new one, do the following:
\begin{enumerate}
\item Download the latest kernel from  \texttt{www.kernel.org}, the files will be compressed in tarball.
\end{enumerate}
\end{document}

我的.emacs文件的内容如下:

(load "auctex.el" nil t t)
(load "preview-latex.el" nil t t)
(setq TeX-auto-save t)
(setq TeX-parse-self t)
(setq-default TeX-master nil)

我想让 emacs 成为 LaTeX 的完整 IDE。我需要做什么?

答案1

如果您想使用 Emacs 默认获取 PDF 输出,您可以将其添加到您的.emacs

(setq-default TeX-PDF-mode t)

或者,您可以声明每个文件应用的“本地”变量。这是在文件末尾使用“本地变量”块完成的。例如 ---

\documentclass{article}
\begin{document}
text
\end{document}

%%% Local Variables:
%%% mode: latex
%%% TeX-PDF-mode: t
%%% End:

--- 告诉 Emacs 主要模式是 LaTeX 模式,并且您希望获得 PDF 输出而不是 DVI 输出。(您也可以\pdfoutput=1在前言中添加;但这与 Emacs 无关。)相比之下,这个块 ---

\documentclass{article}
\begin{document}
text
\end{document}

%%% Local Variables:
%%% mode: latex
%%% mode: flyspell
%%% TeX-engine: luatex
%%% End:

--- 告诉 Emacs 您想要使用 LaTeX 模式,即 flyspell 次要模式,并使用 LuaTeX 作为后端/引擎(LuaTeX 默认生成 PDF)。关于引擎,即使在使用设置了局部变量之后,您也可以切换到 LuaTeX。

M-x TeX-engine-set <RET> luatex <RET>

或者,如果你想切换到 XeTeX,则将其替换luatexxetex。最后请注意,我们正在讨论引擎,因此不是在上面的设置中使用lualatexxelatex。AUCTEX 通常足够聪明,可以通过解析文件来确定要使用哪种格式(TeX、LaTeX、ConTeXt)。

相关内容