20
votes
Accepted
How to let AUCTeX open PDF with pdf-tools
Here's my setup, using auctex-11.89 and pdf-tools-20151224.1159:
;; Use pdf-tools to open PDF files
(setq TeX-view-program-selection '((output-pdf "PDF Tools"))
TeX-source-correlate-start-...
9
votes
Accepted
Multiple major modes in one buffer (e.g., python-mode & LaTeX-mode)
MMM-mode (multiple major modes) seems exactly what you're looking for. It is mentionned on the emacs wiki. You need to define a submode class to mix LaTeX and python, specifying that python parts ...
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 ...
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:
...
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-...
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 ...
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 ...
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
...
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 ...
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/...
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.
6
votes
How can I prevent auctex to indent a new environment inside another environment?
Add to your init file
(add-to-list 'LaTeX-verbatim-environments "pycode")
(add-to-list 'LaTeX-indent-environment-list
'("pycode" current-indentation))
See (info "(auctex)Verbatim content") ...
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)
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" "...
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 ...
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 ...
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-...
5
votes
Accepted
LaTeX Mode and Listings with $-signs?
Syntax highlighting would be correct if file parsing is enabled. First check whether the options suggested at the beginning of the AUCTeX manual are enabled:
(setq TeX-auto-save t)
(setq TeX-parse-...
5
votes
Accepted
Why does filling in AUCTeX behave so badly?
The behavior of filling of math switches is controlled by the LaTeX-fill-break-at-separators variable and there are currently discussions about its best default value.
I recently came up with with ...
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 ...
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 ...
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 ...
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 ...
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")))
...
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)...
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-...
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&...
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 ...
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 ...
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 ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
auctex × 530latex × 218
preview-latex × 33
reftex-mode × 25
indentation × 21
init-file × 18
pdf-tools × 18
org-mode × 16
key-bindings × 15
font-lock × 15
pdf × 14
tex × 14
package × 10
faces × 9
debugging × 8
syntax-highlighting × 8
beamer × 8
electric-pair-mode × 8
spacemacs × 7
regular-expressions × 7
code-folding × 7
bibtex × 7
fonts × 6
fill-paragraph × 6
microsoft-windows × 5