18
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-...
16
votes
Accepted
changing the role of the underline and the minus-sign just in LateX-mode
Something like this:
(add-hook 'LaTeX-mode-hook 'my-latex-hook)
(defun my-latex-hook ()
(require 'tex-site)
(define-key LaTeX-mode-map "-" (lambda () (interactive) (insert "_")))
(define-key ...
15
votes
Accepted
How to indent items in LaTeX/AUCTeX itemize environments?
@sykora's comment about (setq LaTeX-item-indent -2 LaTeX-indent-level 4) is almost there, but it does mean we spill over to every other environment as well. So, for example, we would also have:
\...

Dan♦
- 31k
14
votes
Accepted
How to call pdflatex under TeX-PDF-mode?
Just type latex instead of pdflatex at the C-c C-c prompt. TeX-PDF-mode sets the TeX-engine to pdflatex automatically. The command you are entering at the prompt is only representative of what you ...
14
votes
Accepted
How to find out what my AUCTeX version is?
It is contained in the AUCTeX-version variable:
C-h v AUCTeX-version RET
12
votes
Accepted
How to make auto-complete work in AucTeX mode?
After doing a long research in the web and careful examination of ac documentation with a lot of trials on my machine to examine code line by line, I came up with this solution that can have yasnippet ...
11
votes
Accepted
How to delete a LaTeX macro while preserving its text content?
Try this function:
(defun mg-TeX-delete-current-macro (&optional arg)
"Remove the current macro.
With an optional argument ARG, delete just the ARG-th macro
starting from the innermost."
(...
10
votes
Accepted
Select images in auctex with preview
If you set LaTeX-includegraphics-read-file to LaTeX-includegraphics-read-file-relative, autocompletion with helm provides this feature:
Setting up AUCTeX
You can either customize LaTeX-...
10
votes
Accepted
How can I preview TeX formulas inline in arbitrary modes?
I've tried to re-use AUCTeX preview-latex but failed and gave up.
Org-mode also provide the same feature. Turns out weechat managed to re-use it to automatically show latex preview.
I've extracted ...
10
votes
Accepted
how to detect if inside a LaTeX math environment?
The function texmathp defined in AUCTeX (autoloaded from texmathp) does exactly that (ok, actually it does a bit more).
Used interactively, it will give you some more information, including whether ...
9
votes
Accepted
Auto-inserting last used sub-/superscript values in math formulae
Add to your init file:
(defvar mg-TeX-insert-subscript-history nil)
(defvar mg-TeX-insert-superscript-history nil)
(defun TeX-insert-sub-or-superscript (arg)
"Insert typed key ARG times and ...
9
votes
How to use AUCTeX and outline-minor-mode together for folding?
Outline mode and the AUCTeX folding facilities are two different beasts that are meant to do broadly the same thing: hide and show selected parts of the buffer. Personally, I find the AUCTeX ...

Dan♦
- 31k
9
votes
Accepted
A comprehensive list of shortcuts provided by AUCTeX
Yes, there is an index of keybindings: it's in the index of the AUCTeX manual.
Note: I got to this index by googling "auctex manual", opening up the first hit, which is the manual, selecting the HTML ...

Dan♦
- 31k
9
votes
How to delete a LaTeX macro while preserving its text content?
From the AUCTeX manual node on Changing the
font:
C-c C-f C-d
Delete the innermost font specification containing point.

Dan♦
- 31k
9
votes
Accepted
Gradually learning the keybindings provided by AUCTeX
Modifying my answer from here we can just pull this data out of LaTeX-math-default, which is a list of 4-tuples
(CHARACTER MACRO MENU UNICODE)
where CHARACTER is the character used to bind it (I ...
9
votes
Accepted
Arara integration in Emacs?
Add the appropriate entry to TeX-command-list. Insert the following code in your init file:
(eval-after-load "tex"
'(add-to-list 'TeX-command-list
'("Arara" "arara --verbose %s" TeX-run-...
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
Accepted
AucTeX: can I hide comments?
You can use TeX-fold-comment (C-c C-o C-c) to hide the comment. You need to enable TeX-fold-mode to make use of this functionality.
See the AUCTeX manual on folding macros and environments for more ...

Dan♦
- 31k
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
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
How does AucTeX display superscripts?
Use the raise display property. As explained in (info "(elisp) Other Display Specs"):
`(raise FACTOR)'
This kind of display specification raises or lowers the text it
applies to, relative ...
7
votes
A comprehensive list of shortcuts provided by AUCTeX
You can run C-hb to see the current bindings.
7
votes
Accepted
Is there a shortcut for \mathrm in AUCTeX?
C-c C-f C-r will do it. Check out the AUCTeX manual for the keybindings for all of the standards.

Dan♦
- 31k
7
votes
Accepted
Overriding fill-paragraph in LaTeX mode
It would be better to have 2 functions, although one can be implemented in terms of the other. The reason being that a paragraph is an implicit region, so the input in both cases should be different
(...
7
votes
Recompile tex file without modification
C-c C-c calls TeX-command-master, which prompts you for a command (with what it expects you to choose as the default option). Even if it does not detect that the document has changed, you can always ...

Dan♦
- 31k
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
auctex × 485latex × 196
preview-latex × 30
reftex-mode × 21
indentation × 18
init-file × 16
pdf-tools × 16
key-bindings × 14
org-mode × 13
font-lock × 13
pdf × 13
tex × 12
package × 9
syntax-highlighting × 9
code-folding × 9
faces × 8
beamer × 8
spacemacs × 7
debugging × 7
regular-expressions × 7
fonts × 6
flyspell × 6
bibtex × 6
electric-pair-mode × 6
emacsclient × 5