I am assuming this is my error, I just cannot figure out what it is. I have a project76 meerkat running Ubuntu 22.04. I have installed latex using
sudo apt install texlive-latex-extra
and emacs using
sudo apt install emacs
and then added auctex through the package list
M-x package-list
(using i next to auctex and x to install)
After following those steps with nothing in between or before in terms of emacs customization, I create a simple tex file
\documentclass[12pt]{article}
\usepackage{lipsum}
\usepackage{amsmath, amssymb, amsfonts}
\title{\LaTeX\ in Emacs}
\author{Me}
\date{\today}
\begin{document}
\maketitle
\lipsum[1-2]
\end{document}
When I save that file and push the button for Run LaTeX on the auctex toolbar (the one wiht the lion on it), I get the message "Unknown engine 'nil'. Valid values are: default, luatex, omega, xetex".
Using M-x customize-option, I change the TeX-engine value to 'default' and as a result my .emacs file (in its entirety) looks like this:
(custom-set-variables
;; custom-set-variables was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
'(TeX-engine 'default)
'(package-selected-packages '(auctex)))
(custom-set-faces
;; custom-set-faces was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
)
After restarting emacs to ensure the new .emacs is used, going back to the same example latex file and pushing the Run LaTeX button gives me the same error (Unknown engine 'nil'). When I go back to customize-option, TeX-engine, I see the same thing, and notice that it also says "State : CHANGED outside Customize. (mismatch)"
I have no guess of where this is changed, and given that all I have done is follow the basic process for installing everything, I'm not sure what I could have done to cause this. Also, if I just try to compile latex at the command line, I can create the pdf from that sample latex file (using either the process of latex, dvips, ps2pdf; or just pdflatex), so everything exists.
I am sure this is something utterly basic, but I'm stumped.
In response to the help below, C-h v TeX-engine
returns the following both at emacs startup and when I open a buffer with the latex file itself:
TeX-engine is a variable defined in ‘tex.el’.
Its value is nil
Original value was ‘default’
Automatically becomes buffer-local when set.
This variable is safe as a file local variable if its value
satisfies the predicate which is a byte-compiled expression.
You can customize this variable.
Documentation:
Type of TeX engine to use.
It should be one of the following symbols:
* ‘default’
* ‘luatex’
* ‘omega’
* ‘xetex’
When I click on the tex.el link in the help, it takes me to this portion of that file, which doesn't seem to indicate the 'nil' setting:
(defcustom TeX-engine 'default
(concat "Type of TeX engine to use.
It should be one of the following symbols:\n\n"
(mapconcat (lambda (x) (format "* `%s'" (car x)))
(TeX-engine-alist) "\n"))
:group 'TeX-command
:type `(choice ,@(mapcar (lambda (x)
`(const :tag ,(nth 1 x) ,(car x)))
(TeX-engine-alist)))
:safe (lambda (arg) (memq arg (mapcar #'car TeX-engine-alist-builtin)))
:local t)
Not sure if this helps the diagnosis, but I would be grateful for any further insight.
TeX-engine
becomes buffer-local when set (see its doc string withC-h v TeX-engine
) so it may be that you are running a hook that sets it somehow (although it's hard to see how that would happen if your init file is as bare as you say). Start emacs and sayC-h v TeX-engine
and tell us what the value is. Then open the tex file and do the same thing. Are they different?C-h v TeX-engine
, any further guidance you can give?snap
to have the last version. I suggest also to install the last version of texlive manually tug.org/texlive/quickinstall.htmlemacs -Q
, then inscratch
buffer, eval the following(progn (package-initialize t) (package-activate 'auctex))
(i.e., set the cursor after the last)
and hitC-x C-e
) and then open your .tex file and try it again? If this works, then you know that your AUCTeX installation works and you have to investigate further.