Skip to main content
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
  • 52.4k
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,265
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.5k
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,265
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,265
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,666
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
  • 2,055
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,284
7 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
  • 2,055
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,346
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
  • 2,055
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.5k
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,253
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,265
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,265
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,265
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.6k
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.5k
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,265
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
  • 2,055
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.5k
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,596
4 votes
Accepted

How can I automatically add some local variables info to a C-x C-f new (.tex) file?

You can use a hook to achieve this. Use the one you need as described in auctex documentation. Here we check the file extension so that we don't do that for eg .sty files.  Also, we test the buffer-...
JeanPierre's user avatar
  • 7,475
4 votes
Accepted

electric pair of any length, using AUCTex

AUCTeX has a bultin support for pairing braces, and \{...\} is in the default set of supported braces. In order to enable this feature, just set LaTeX-electric-left-right-brace to non nil, either ...
giordano's user avatar
  • 3,265
4 votes
Accepted

Indentation in square brackets

This feature was added to AUCTeX with this change. Note that this is an opt-in feature: if you want to activate it for square brackets, you have to customize the variables TeX-indent-open-delimiters ...
Arash Esbati's user avatar
  • 2,055
4 votes

Run flyspell-buffer automatically after emacs loads a (tex)-file

It suffices to properly choose and trickily chain hooks. (add-hook 'text-mode-hook #'flyspell-mode) (add-hook 'flyspell-mode-hook #'flyspell-local-vars) (defun flyspell-local-vars () (add-hook '...
vitaminace33's user avatar
4 votes

AucTeX: Disable electric-pair-mode in minibuffer during Macro definition?

To specifically disable electric-pair-mode in the minibuffer change elethan's example to use the minibufferp function. Below is the relevant part from my Emacs configuration: ;; Enable smart paring (...
Peter W. V. Tran-Jørgensen's user avatar

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