AucTeX(在 Emacs 中)似乎找不到某些包

AucTeX(在 Emacs 中)似乎找不到某些包

AucTeX我在emacs v23中使用PFD-mode。当pdflatex通过 调用编译器时,C-c C-c LaTeX我收到[...] file <some_package>.sty not found一些特定包的错误。例如,考虑以下foo.tex文件:

\documentclass{article}

\usepackage{algorithm}
\usepackage{algpseudocode}

\begin{document}

\begin{algorithm}
  \caption{Some advanced stuff here.}
  \begin{algorithmic}
    \Function{Increment}{$x$}
    \State \Call{Return}{$x+1$}
    \EndFunction
  \end{algorithmic}
\end{algorithm}

\end{document}

使用 AucTeX () 编译文件C-c C-c LaTeX可得到:

ERROR: LaTeX Error: File `algpseudocode.sty' not found.

但是,如果我pdflatex foo.tex通过终端调用,一切都正常。

到目前为止,我遇到这种情况的唯一软件包是algpseudocodefmtcount,分别包含在 Linux 软件包texlive-science和中texlive-latex-extra。这些软件包显然在那里;例如,我在终端中得到以下内容:

$ locate -b fmtcount.sty
/usr/share/texmf-texlive/tex/latex/fmtcount/fmtcount.sty
$ dpkg -l | grep texlive-latex-extra
ii  texlive-latex-extra      2009-10ubuntu1           TeX Live: LaTeX  supplementary packages
ii  texlive-latex-extra-doc  2009-10ubuntu1           TeX Live: Documentation files for texlive-latex-extra

我觉得特别令人困惑的是,我没有得到这样的包错误footmisc,但它也是 的一部分texlive-latex-extra

(请记住,我没有遇到此问题的机器的 root 访问权限。如果需要,我可以要求管理员进行修复 - 一旦我知道那可能是什么 - 但我怀疑他们是否愿意开始尝试各种方法。)


更新

$ kpsewhich algpseudocode.sty
/auto/pkg/texlive-2009/texmf-dist/tex/latex/algorithmicx/algpseudocode.sty

看来问题是由pdflatexAucTeX 调用的程序引起的。正如我上面提到的,如果我pdflatex foo.tex通过终端手动运行,它会起作用,并且第一行foo.log是:

This is pdfTeX, Version 3.1415926-1.40.10 (TeX Live 2009) (format=pdflatex 2010.6.1)  15 FEB 2012 17:15

另一方面,如果我通过C-c C-c LaTeXAucTex 调用编译器,foo.log文件如下(请注意第一行中看到的 TeX 分布之间的差异):

This is pdfeTeX, Version 3.141592-1.21a-2.2 (Web2C 7.5.4) (format=pdflatex 2011.4.5)  15 FEB 2012 13:24
entering extended mode
**\input foo.tex
(./foo.tex (/auto/pkg/tetex-3.0/share/texmf-dist/tex/latex/base/article.cls
Document Class: article 2004/02/16 v1.4f Standard LaTeX document class
(/auto/pkg/tetex-3.0/share/texmf-dist/tex/latex/base/size10.clo
File: size10.clo 2004/02/16 v1.4f Standard LaTeX file (size option)
)
\c@part=\count79
\c@section=\count80
\c@subsection=\count81
\c@subsubsection=\count82
\c@paragraph=\count83
\c@subparagraph=\count84
\c@figure=\count85
\c@table=\count86
\abovecaptionskip=\skip41
\belowcaptionskip=\skip42
\bibindent=\dimen102
)
(/auto/pkg/tetex-3.0/share/texmf-dist/tex/latex/algorithms/algorithm.sty
Package: algorithm 

Document Style `algorithm' - floating environment
(/auto/pkg/tetex-3.0/share/texmf-dist/tex/latex/float/float.sty
Package: float 2001/11/08 v1.3d Float enhancements (AL)
\c@float@type=\count87
\float@exts=\toks14
\float@box=\box26
\@float@everytoks=\toks15
\@floatcapt=\box27
)
(/auto/pkg/tetex-3.0/share/texmf-dist/tex/latex/base/ifthen.sty
Package: ifthen 2001/05/26 v1.1c Standard LaTeX ifthen package (DPC)
)
\@float@every@algorithm=\toks16
\c@algorithm=\count88
)

! LaTeX Error: File `algpseudocode.sty' not found.

Type X to quit or <RETURN> to proceed,
or enter new name. (Default extension: sty)

Enter file name: 
! Emergency stop.
<read *> 

l.5 ^^M

*** (cannot \read from terminal in nonstop modes)


Here is how much of TeX's memory you used:
 346 strings out of 94499
 4143 string characters out of 1173445
 49441 words of memory out of 1000000
 3593 multiletter control sequences out of 10000+50000
 3640 words of font info for 14 fonts, out of 500000 for 2000
 580 hyphenation exceptions out of 1000
 23i,0n,17p,157b,36s stack positions out of 1500i,500n,5000p,200000b,5000s
PDF statistics:
 0 PDF objects out of 300000
 0 named destinations out of 131072
 1 words of extra memory for PDF output out of 65536
No pages of output.

恐怕我不知道如何将 AucTeX 指向正确的 pdflatex安装,但是。

以防万一,我的.emacs文件中有以下与 AucTeX 相关的行:

(setq TeX-auto-save t)
(setq TeX-parse-self t)
(setq-default TeX-master nil)
(add-hook 'LaTeX-mode-hook
          (lambda ()
            (TeX-fold-mode 1)))
(add-hook 'LaTeX-mode-hook 'visual-line-mode)
(add-hook 'LaTeX-mode-hook 'flyspell-mode)
(add-hook 'LaTeX-mode-hook 'LaTeX-math-mode)
(add-hook 'LaTeX-mode-hook 'TeX-PDF-mode)
(add-hook 'LaTeX-mode-hook 'turn-on-reftex)
(setq reftex-plug-into-AUCTeX t)

答案1

该问题是由于通过 Gnome 面板调用 Emacs 而引起的,这导致 Emacs 忽略了PATH通过 设置的.bashrc

解决这个问题的一个方法是让 Emacs 将其设置PATH为可见的bash,方法是将以下内容放入.emacs文件中(感谢 Shane这里):

(setenv “PATH” (shell-command-to-string “bash -i -c ‘echo -n $PATH’”))

相关内容