Skip to main content
Share Your Experience: Take the 2024 Developer Survey
10 votes
Accepted

Can I mark a local variable as safe for a single file only?

In the elisp manual at C-hig (elisp)File Local Variables we find: You can specify safe values for a variable with a ‘safe-local-variable’ property. The property has to be a function of one argument; ...
phils's user avatar
  • 51.5k
9 votes
Accepted

Define a new key binding for font (Auctex)

Customize LaTeX-font-list: M-x customize-variable RET LaTeX-font-list RET. Select Math Prefix: for ^C key (the prefix C-c C-f is omitted) and add \mathscr{ to "Math Prefix:" field and } to "Math ...
giordano's user avatar
  • 3,255
9 votes
Accepted

What is "override advice"?

Some information about advices An advice is mainly a method of last resort to customize the behavior of functions defined in other libraries. There are many variants of advice. Examples are: ...
Tobias's user avatar
  • 33.2k
8 votes

Indentation in square brackets

Setting LaTeX-begin-regexp and LaTeX-end-regexp does not help here because inside LaTeX-indent-level-count it searches a backslash before checking the regexp. I got it working by modifying TeX-brace-...
Hebi Li's user avatar
  • 81
8 votes
Accepted

Formatting of usepackage commands in LaTeX document

If you want a command to stay in a line on its own, add it to LaTeX-paragraph-commands: (setq LaTeX-paragraph-commands '("documentclass" "usepackage")) But, honestly, I didn't ever see anyone trying ...
giordano's user avatar
  • 3,255
8 votes
Accepted

How to pass flags to the LaTeX compiler with AUCTeX?

Use TeX-command-extra-options (and check out the manual before asking questions ;-) AUCTeX handles in a special way most of the main options that can be given to the TeX processors. When you need to ...
giordano's user avatar
  • 3,255
8 votes
Accepted

Emacs setup for LaTeX after (use-package) verse

The essential part is to load latex instead of tex, see the first line. (also I did some small cleanups) (use-package latex :mode ("\\.tex\\'" . latex-mode) :bind (:map LaTeX-mode-map ...
jue's user avatar
  • 4,576
8 votes
Accepted

AUCTeX - delete 'other' files like .out, .aux, .log on successful compilation

Actually, you don't need to customize anything. The variable in question is called LaTeX-clean-intermediate-suffixes and has the following default value: LaTeX-clean-intermediate-suffixes is a ...
Arash Esbati's user avatar
  • 1,975
8 votes
Accepted

Surprisingly persistent local variable

In case someone else runs into this, I had enabled TeX-auto-save, which saves settings to an auto/ directory and loads them when a file is revisited. https://www.gnu.org/software/auctex/manual/...
Toothrot's user avatar
  • 3,264
7 votes
Accepted

Trying to install auctex via package-install

Elpa seems to be having issues again. (Reddit discussion.) Maybe try adding (setq gnutls-algorithm-priority "NORMAL:-VERS-TLS1.3") to your config as mentioned here.
nega's user avatar
  • 3,276
6 votes

How can I set a key binding to run two other key bindings?

For this special case (save a *TeX buffer before running the compiler), you don't need to define a binding, or advice a function, but just set TeX-save-query to nil: (setq TeX-save-query nil)
giordano's user avatar
  • 3,255
6 votes
Accepted

AUCTeX: how to compile a file, which does end in '.ins'

Known extensions to AUCTeX are controlled by the variable TeX-file-extensions: TeX-file-extensions is a variable defined in ‘tex.el’. Its value is ("tex" "sty" "cls" "ltx" "texi" "txi" "texinfo" "...
Arash Esbati's user avatar
  • 1,975
6 votes

How to make Emacs start using the Xetex engine as default

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 ...
Arash Esbati's user avatar
  • 1,975
6 votes
Accepted

How to create a small bibtex file from a bigger one?

reftex has the command reftex-create-bibtex-file that you can call via the menu Ref -> Global Actions -> Create BibTeX File. I cite the help of reftex-create-bibtex-file here: Create a new ...
Tobias's user avatar
  • 33.2k
6 votes
Accepted

Looking for a way to have LaTeX source code and its real-time rendering in side-by-side Emacs windows

latex-preview-pane on melpa can do that. You can enable it in a file being edited with AUCTeX by M-x latex-preview-pane RET or for any LaTeX file opened in this mode by placing (add-hook 'LaTeX-mode-...
gigiair's user avatar
  • 2,186
5 votes
Accepted

Inform AucTeX about index style file

Very good question, it's strange that no one ever asked for this feature. Luckily, AUCTeX allows you to expand it with a bit of Lisp code. The trick is to add a new command to TeX-command-list and a ...
giordano's user avatar
  • 3,255
5 votes
Accepted

delete-selection-mode and $

AUCTeX provides the feature to wrap opening and closing inline equation markers around active region on pressing $, when TeX-electric-math is non-nil (and this isn't the default). In order to have ...
giordano's user avatar
  • 3,255
5 votes

How can I set a key binding to run two other key bindings?

The general way to link multiple key-bindings to a single binding is a Keyboard Macro ((emacs) Keyboard Macros). Keyboard macros can either be 'recorded' interactively, or written in elisp (in string ...
Tyler's user avatar
  • 22.3k
5 votes
Accepted

AUCTeX isn't loading local per-package style files, is ignoring `TeX-auto-local`

The problem was that I did (require 'tex) before (setq TeX-auto-local ".auctex-auto") In AUCTeX, the definition of TeX-style-path is via a defcustom form, which sets TeX-style-path to the result ...
Antal Spector-Zabusky's user avatar
5 votes
Accepted

How to perform a search for a string inside math environments in a tex/latex document

Bundled with AUCTeX there is the texmathp utility (which, however, is independent from the TeX modes provided by AUCTeX and can be used without it), which allows you to test whether point is inside a ...
giordano's user avatar
  • 3,255
5 votes

How do I configure my own shortcuts in Auctex (Emacs)?

Here is an example of what you want to accomplish: (with-eval-after-load "latex" (define-key LaTeX-mode-map (kbd "s-z") (lambda () (interactive) (LaTeX-insert-environment "quote"))) ...
giordano's user avatar
  • 3,255
5 votes
Accepted

Fix indentation of LaTeX code without wrapping lines

If you only want to indent a region, you should call an indenting function, not a filling function that, as you guessed, is meant to break lines. For example, you can use C-M-\ (M-x indent-region RET)...
giordano's user avatar
  • 3,255
5 votes
Accepted

Setting MUpdf as default viewer in AUCTeX

Here is (I think) the simplest way to do this. The first adds mupdf as a new view program, while the second specifies it as the default for pdfs. (with-eval-after-load "tex" (add-to-list 'TeX-view-...
justbur's user avatar
  • 1,510
5 votes

Call emacsclient from a program called by Emacs

The solution is to run texdoc within an asynchronous process. The best way to do that is probably to use start-file-process instead of shell-command-to-string (which is a handy function for quick&...
Stefan's user avatar
  • 26.5k
5 votes
Accepted

How can I type simple underline "_" in Auctex

You can always insert a character literally by typing C-q first (quoted-insert). Many “electric” characters (that's what Emacs usually calls characters whose insertion has extra effects such as ...
Gilles 'SO- stop being evil''s user avatar
5 votes
Accepted

Don't switch to math-mode when entering `$` in a `minted` environment

You can add minted environments to the latex-verbatim-environment variable: M-x customize-variable latex-verbatim-environments, insert a new string "minted", and save your changes. You may need to ...
Tyler's user avatar
  • 22.3k
5 votes
Accepted

AUCTeX doesn't run bibtex even though .emacs file is set up appropriately

For some reason, the file wasn't actually parsed, so AUCTeX didn't know about the bibliography file. This shouldn't usually happen if you set TeX-parse-self and TeX-auto-save to t, but you can easily ...
giordano's user avatar
  • 3,255
5 votes

How to get rid of the auto folder with .el files?

You can disable parsing when you save your file with this line in your init file: (setq TeX-auto-save nil) Now you can trigger parsing with C-c C-n manually. When you do this, AUCTeX will still ...
Arash Esbati's user avatar
  • 1,975
5 votes
Accepted

Change AUCTeX behavior inside an environment

You can use mmm-mode available at GNU Elpa. There are examples how mmm-mode is to be configured. In your case the following Elisp lines in your init file should work. When you open a LaTeX file ...
Tobias's user avatar
  • 33.2k
5 votes
Accepted

What are the main differences between latexmk and C-c C-a from Auctex?

C-c C-a uses AuCTeX's heuristics for deciding which list of commands to run. The usual case is to use the function TeX-command-default which is defined in tex-buf.el. So no, latexmk is not used. ...
Andrew Swann's user avatar
  • 3,556

Only top scored, non community-wiki answers of a minimum length are eligible