# Tag Info

## Hot answers tagged auctex

16

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 LaTeX-mode-map "_" (lambda () (interactive) (insert "-"))) (define-key LaTeX-mode-map "6" (lambda () (interactive) (insert "^"))) (define-key LaTeX-mode-map "...

16

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-server t) ;; Update PDF buffers after successful LaTeX runs (add-hook 'TeX-after-compilation-finished-functions #'TeX-revert-document-buffer)

15

@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: \begin{abstract} This indents to the 4th column, which is way too far! \end{abstract} The following function builds off an old (and seemingly broken?) code ...

14

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 want emacs to do i.e compile with latex, view the pdf file with view and so on. The actual commands the prompt can accept is given in the variable TeX-command-list....

11

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 working as well (optioinal) without any confict. put this in your init.el or .emacs taking care of sequence: (require 'package) (package-initialize) ;; ...

11

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." (interactive "*p") (let (macro end) (when (dotimes (i arg macro) (goto-char (TeX-find-macro-start)) (setq macro (TeX-current-macro) ...

11

It is contained in the AUCTeX-version variable: C-h v AUCTeX-version RET

10

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-includegraphics-read-file (M-x customize-variable RET LaTeX-includegraphics-read-file RET) and select the relative option or add the following to your init file: (setq ...

10

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 the preview part from weechat in a separate file which you can get on this repo. It's also available as the px package on MELPA (I've just submited it). There ...

10

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 the point is in a math construct. Used in elisp, it will be t if in math, nil otherwise. The additional pieces of informations are then stored in the variable ...

9

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 possibly a pair of braces. Brace insertion is only done if point is in a math construct and TeX-electric-sub-and-superscript' has a non-nil value." (interactive "*...

9

From the AUCTeX manual node on Changing the font: C-c C-f C-d Delete the innermost font specification containing point.

9

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 know it looks like an integer, but it's a character, use (string CHARACTER) to see), MACRO is the Latex macro without the slash, MENU is the name for the menus and ...

9

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-TeX nil t :help "Run Arara."))) The --verbose flag has been suggested by Paul Stanley.

9

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 are delimited by the pycode LaTeX tags. Adding the following to your init file should do it: (require 'mmm-auto) (mmm-add-classes '((latex-python :submode ...

9

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 Suffix".

9

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: overriding the function with another function (That is the extreme case where one completely replaces the original function.) wrapping the original function with an ...

8

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 facilities to be rather jarring and rarely use them, but your mileage may vary. I use the outlining functionality all the time, however. outline-minor-mode A key ...

8

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 variable defined in ‘latex.el’. Its value is ("\\.aux" "\\.bbl" "\\.blg" "\\.brf" "\\.fot" "\\.glo" "\\.gls" "\\.idx" "\\.ilg" "\\.ind" "\\.lof" "\\.log" "...

8

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/auctex/Parsing-Files.html

7

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 option (although any of them would work), selecting "Indices," and finally selecting "Key Index." Likewise, a google search for "AUCTEX reference card", the ...

7

You can run C-hb to see the current bindings.

7

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 to the baseline of the line. FACTOR must be a number, which is interpreted as a multiple of the height of the affected text. If it is positive, that ...

7

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 information.

7

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 (defun my-format-region (beg end) (interactive "r") (shell-command-on-region beg end "format")) (defun my-format-paragraph () (interactive) (save-...

7

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 force it to compile by entering LaTeX after you C-c C-c and it prompts you.

7

It's possible: (setq LaTeX-begin-regexp "\$$?:begin\\|if@\$$\\b") (setq LaTeX-end-regexp "\$$?:end\\|else\\|fi\$$\\b") (defun LaTeX-indent-level-count () "Count indentation change caused by all \\left, \\right, \\begin, and \\end commands in the current line." (save-excursion (save-restriction (let ((count 0)) (narrow-to-region (point) ...

7

This variable is not defined (or set) until AUCTeX is loaded. On your system, it seems to be deferred until it is first needed ("autoloaded" in emacs slang). More precisely: you start emacs, some initialization happens during which emacs notes that LaTeX-mode is defined in some .el file in the AUCTeX package; if you try to inspect TeX-engine at this point,...

7

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-count-line. This solution counts [] as brace {}. Compare it will original function if you want to see the difference. (defun TeX-brace-count-line () "Count ...

7

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 to fill the preamble ;-)

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