3

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.

6
  • TeX-engine becomes buffer-local when set (see its doc string with C-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 say C-h v TeX-engine and tell us what the value is. Then open the tex file and do the same thing. Are they different?
    – NickD
    Commented Feb 24 at 14:58
  • Thanks so much for your help. I edited the question above to reflect the result of C-h v TeX-engine, any further guidance you can give?
    – Kurt Lewis
    Commented Feb 24 at 16:48
  • 1
    I'm also on Ubuntu 22.04. I suggest to install emacs using snap to have the last version. I suggest also to install the last version of texlive manually tug.org/texlive/quickinstall.html
    – Gabriele
    Commented Feb 24 at 21:19
  • 1
    @KurtLewis - Can you start Emacs as emacs -Q, then in scratch buffer, eval the following (progn (package-initialize t) (package-activate 'auctex)) (i.e., set the cursor after the last ) and hit C-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. Commented Feb 25 at 21:02
  • Having the same problem on Ubuntu 22.04. I've manually backported to AucTeX 13.3 and everything works fine again. I agree with the others, a manual installation of a recent LaTeX/emacs stack will perhaps be the best solution.
    – mfg
    Commented Mar 10 at 17:40

1 Answer 1

0

I don't know what's your problem but you could try to force the setting of Tex-engine, in your .emacs, this way:

(add-hook 'LaTeX-mode-hook
          #'(lambda ()
             (setq TeX-engine 'default))
          90)

To see the value of the LaTeX-mode-hook you can use M-x describe-variable RET LaTeX-mode-hook RET.

I do not use AUCTeX (I prefer the native latex-mode) so I didn't test my suggestion.

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.