0

I'm trying to call AUCTeX from Emacs and I'm now getting the following error (quote marks changed slightly to get code block below to work):

Running 'TeX' on 'simple' with ''pdf/Users/myname/bin/pdflatex  -file-line-error   -interaction=nonstopmode  simple.tex''
/bin/sh: pdf/Users/myname/bin/pdflatex: No such file or directory

TeX Output exited abnormally with code 127 at Thu Jun  2 16:53:50

I've checked paths which seemed like they would be the problem, but couldn't find anything. I also executed M-x shell and entered

pdflatex —version

Which worked just fine, returning MiKTeX-pdfTeX 4.10 (MiKTeX 22.1) …as well as plenty of normal looking copyrights and trademarks and compilation information.

So where do I go from here?

I’m running Emacs Version 28.1 (9.0) on a Mac mini M1 with macOS Monterey 12.4.

EDIT: As requested in the comments below, I've added that part of my .emacs file showing my attempt to set up AUCTeX:

(setq TeX-auto-save t)
(setq TeX-parse-self t)

;; trying to get AUCTeX to work
(setenv "PATH" (concat (getenv "PATH") ":/Users/myname/bin"))
(setq exec-path (append exec-path '("/Users/myname/bin")))
(setq exec-path (append exec-path '("/Library/TeX/texbin")))

(add-to-list 'exec-path "~/bin")
(add-to-list 'exec-path "/Library/TeX/texbin")
(setenv "PATH" (concat "/Library/TeX/texbin:"
                       (getenv "PATH")))
(setq TeX-command "/Users/myname/bin/pdflatex")
(setq LaTeX-command "latex")
4
  • 1
    Have you done any configuration of auctex in your init? What is the value of the LaTeX-command variable? It should be latex rather than a path. Commented Jun 6, 2022 at 7:30
  • @FranBurstall: Thanks for writing. I've added the relevant sections of my .emacs file to the original posting as an edit.
    – ShyPerson
    Commented Jun 6, 2022 at 21:55
  • 1
    The value of TeX-command is wrong: it is supposed to be the command to run plain TeX and should be tex and not a path. Remove this from yr config and try again. Commented Jun 6, 2022 at 22:31
  • @FranBurstall: It's working. Many thanks!
    – ShyPerson
    Commented Jun 8, 2022 at 1:07

1 Answer 1

2

To summarise the comments: this was a misconfiguration. The documentation of TeX-command (do C-h v TeX-command <RET>) says:

TeX-command is a variable defined in ‘tex.el’.

Its value is "tex"

Command to run plain TeX.

However the sexp,

(setq TeX-command "/Users/myname/bin/pdflatex")

sets it to be a path which causes auctex to construct a broken shell command to run TeX:

pdf/Users/myname/bin/pdflatex -file-line-error -interaction=nonstopmode simple.tex

Solution: delete that sexp!

2
  • Could you provide a link to that documentation? Google can't find it.
    – ShyPerson
    Commented Jun 8, 2022 at 23:18
  • 2
    I have edited the answer to remind you that emacs is self-documenting: no google required! Commented Jun 9, 2022 at 10:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.