I am using Emacs to edit all the stuff I'm writing. As I make extensive use of fontspec, I would like to configure my Emacs (running within OpenSuse Linux)so as to start using the xetex-engine without going again and again through the pull-down menu command -> TeXing options -> use xetex-engine.


From AUCTeX's documentation:

User Option: TeX-engine

This variable allows you to choose which TeX engine should be used for typesetting the document, i.e. the executables which will be used when you invoke the ‘TeX’ or ‘LaTeX’ commands. The value should be one of the symbols defined in TeX-engine-alist-builtin or TeX-engine-alist. The symbols ‘default’, ‘xetex’, ‘luatex’ and ‘omega’ are available from the built-in list.

You can customize this variable or put something like this in your .emacs:

(setq TeX-engine 'xetex)
| improve this answer | |

[ I understand that your question relates to the use of AUCTeX (even though you did not say so explicitly), but here's the answer for the built-in LaTeX mode. ]

The default command used when you do C-c C-c in the builtin LaTeX mode is taken to be the last one you used in the past (relying on the command's history). So if you use savehist-mode (or some other such package) to remember your minibuffer histories across sessions, you don't have anything special to do: just once use xelatex ... and it should then be used by default for subsequent latexing operations.

Note that this only works for the commands that tex-compile knows, and it only learned about xelatex (and lualatex) in Emacs-26, IIRC, so if you Emacs is older, you'll need to add something like

(with-eval-after-load `tex-mode
  (add-to-list 'tex-compile-commands
               '("xelatex %f" t "%r.pdf")))
| improve this answer | |

You seem to be asking how to invoke a command in other ways than accessing it through a menu. If so:

C-h k, then use the menus to get where you want. Note the name of the command shown for that menu item in *Help*.

If a keyboard key sequence is also shown in *Help* then use that. If not, use M-x followed by the command name.

Take the Emacs tutorial: C-h t to learn more about using Emacs (invoking commands etc.).

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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