We’re rewarding the question askers & reputations are being recalculated! Read more.

Hot answers tagged

43

There are two ways to make RefTeX find your bibliography. I suggest to use both approaches for robustness. To make RefTeX recognize your bibliography you can add it to the list reftex-default-bibliography. To do this add the following to your .emacs: ;; So that RefTeX finds my bibliography (setq reftex-default-bibliography '("path/to/bibfile.bib")) and ...


35

Finding tips It is hard to say what the best tips is for you. Especially if you do not give a more detailed description of your workflow. The best way to find this might be to read the manual from cover to cover. Also make sure to read the RefTeX manual since it is included in AUCTeX and you should use its commands for handling citations and cross-...


32

UPDATE, 11/10/11: I've posted the code at https://github.com/blerner/auc-tikz -- the most recent version is auc-tikz-struct.el (the other files are older experimental versions). I haven't had time to update the code in a while, so if people want to tinker with the code, have at it! It's still rough, but it should sorta work if you'd like to try it out. ...


32

It does have auto-complete powers. (It has more than any one person knows about.) Try, e.g., C-c C-m (for calling macros like \footnote or \ref); type the letter 's' and hit TAB. The rest will become clear. C-c C-e will prompt for for starting new environments. And so on. If you use AUCTeX with reftex, try things like C-c [ to prompt you for a ...


32

Note: users on more recent versions of macOS will not be able to follow these instructions due to new restrictions introduced in those versions. See comments for workarounds. It seems that the upgrade wiped the link from your Library (where MacTeX puts your actual TeX distribution) into your /usr/texbin. You can reinstate this link with the following: ln -...


30

This procedure will set up Emacs, AUCTeX, and the Okular viewer to handle integrated forward and inverse search. (These instructions were tested on a Debian system) Install Emacs. To install Emacs, open up the terminal and type the command: sudo apt-get install emacs Install AUCTeX. Within Emacs, run M-x package install RET auctex RET. To test for a ...


27

Stick point somewhere near \usepackage{array,colortbl} and two buffers will open up for array and colortbl packages if you do M-x getpackage which you can bind to a key of your choice (defun getpackage () (interactive) (search-backward "\\") (re-search-forward "usepackage[^{}]*{" nil t) (while (looking-at "\\s-*,*\\([a-zA-Z0-9]+\\)") (re-search-forward "\...


23

This should work (requires AUCTeX and you first need to enable TeX-fold-mode with C-c C-o C-f or M-x TeX-fold-mode) (defun mg-TeX-fold-brace () "Hide the group in which point currently is located with \"{...}\"." (interactive) (let ((opening-brace (TeX-find-opening-brace)) (closing-brace (TeX-find-closing-brace)) priority ov) (if (and ...


22

AUCTeX 11.89 Starting from this version of AUCTeX, the option TeX-file-line-error enables by default the file:line:error messages that solve the problem. Thus, from this version you shouldn't run anymore into this kind of problems. I also suggest to revert any change to LaTeX-command-style, in order to be sure to use the default value. See below for ...


22

AUCTeX parses the output buffer in order to report errors and warnings, and if there is none of them, it looks for a line like LaTeX2e <date> However, since April 2017, the date format of LaTeX has been changed from yyyy/mm/dd to yyyy-mm-dd and your version of AUCTeX can't find the line LaTeX2e <2017-04-15> This has been already fixed ...


21

Org-mode's radio tables are an easy, simple and fast way to create tables within Emacs/AUCTeX. They offer all of the calculation capabilities of the org-mode spreadsheets, which can be very convenient if need simple, auto-updating data. The source org-table can be placed within a comment environment using the comment package, or after \end{document}. The ...


20

I use find-file-at-point. It also works for #includes in C, sometimes imports in Python, URLs, etc. (global-set-key (kbd "C-x f") 'find-file-at-point) ;; I hardly ever set the fill-column


19

The general problem of finding where a command is defined has no viable solution. Macros can and do change their meaning; a typical example is \\. This simple document \documentclass{article} \begin{document} \show\\ {\centering\show\\} \begin{tabular}{c} \show\\ \end{tabular} \end{document} gives the following output in the terminal window: > \\=...


18

I combined some of the links mentioned here, you will find the links in the source comments. This code supports: Forward search (Emacs to Evince, via C-c C-v) Backward/Inverse search (Evince to Emacs, via C-Mouse-1, that is Ctrl + "Left Click" in Evince) Path names with spaces Multifile setups (TeX files requested by Evince will be opened if they aren't ...


18

Starting from version 11.88 of AUCTeX, you can add an option to the TeX processor with the file-local variable TeX-command-extra-options: %%% TeX-command-extra-options: "-shell-escape" As explained in the manual, you have to manually make this variable safe as a local variable because of the security holes it can open. Note: this question inspired me to ...


18

If all LaTeX files in this directory will use the same engine, then you can set TeX-engine for all of them using Emacs per-directory local variables. Create a file in this directory named .dir-locals.el with the following contents: ((latex-mode (TeX-engine . luatex))) If all LaTeX files in this directory share the same master, then per-directory local ...


16

This is a very sensible question! You know, there are many tricks to discover, which make live easier. My top 3 list: M-q: Justify the current paragraph (or region if set), with respect to the fill-column variable [Couldn't do without, but it took me weeks to discover] C-l: Recenter the cursor (one hit puts the current line in the center of the screen, next ...


16

To skip the selection of the reference style you have to set the variable reftex-ref-macro-prompt to nil, see the RefTeX manual. To do this you can customize that variable or add the following code to your init file: (setq reftex-ref-macro-prompt nil) It has been reported that this solution to use RefTeX with the cleverref package no longer works with ...


16

AUCTeX has autocompletion mechanisms different from most of the other LaTeX editors. In Emacs, when TeX-latex-mode is activated, the sequence Ctrl-c Ctrl-e (the - means that the second key has to be pressed while holding the first, while the space implies the release of both keys before the next combination) opens the mini-buffer dialog interface at the ...


15

I was having this same problem when I stumbled across this post. I was able to fix it the following way: Note, I am using Emacs23.3.1, AUCTeX 11.86, Ubuntu 11.10, Gnome3.2.1 Open a .tex file (or make one). I will assume that you are using Emacs23, using an Xwindow (Mine is in Gnome). Go to the menu bar and do: Preview -> Customize -> Browse Options In ...


15

If you do not need to worry about verbatim or verb usage then (query-replace-regexp "\\(^\\| *[^\\\\]\\)%.*" "" nil nil) is probably safe (and it does query replace so you get to say yes or no anyway). Note this removes the entire line if the comment was at the start of the line (as leaving a blank line would make a paragraph). However it does not remove ...


15

Scrolling is not my hobby... For easy navigation use the table of contents inside Emacs. Just type C-c = and Emacs displays it. You can navigate incredibly fast. From the comments, if it does not 'work out of the box,' you can use M-x reftex-mode to turn it on for the current buffer or, to make the change permanent, add the following to your .emacs: ; ...


15

Here's what I add to my Preferences.el file (the .emacs equivalent for Aquamacs): (setq LaTeX-verbatim-environments-local '("Verbatim" "lstlisting")) This makes Verbatim and lstlisting behave like verbatim


14

What are you using? (Linux, Windows, Mac) If you're using Linux, then Okular's probably the easiest PDF viewer to set-up synctex forward/backward search with emacs. Once you've installed Okular, you can add the following code to your .emacs config file: ;; Okular (setq TeX-view-program-list '(("Okular" "okular --unique %u"))) (add-hook 'LaTeX-mode-hook ...


14

This can be done by using language specific hooks in AUCTeX. To automatically load the Danish ispell dictionary when a document includes \usepackage[danish]{babel} put the following in your .emacs: (add-hook 'TeX-language-dk-hook (lambda () (ispell-change-dictionary "danish")))


14

bibtool can sort your .bib file, among many other things. Although I do edit my bibliography file by hand, I don't use it much for this task, because emacs provides a better solution (see the comment by giordano, e.g.). To sort by bibkey, it is as simple as (options are not grouped here for clarity): bibtool -s -i input.bib -o output.bib To reverse sort ...


14

The tex master tells emacs which document to pass to latex. So you can have a section or even just a single equation in a file that is \input into your master document, and when you use C-c C-c or any other command that requires a full document, then the master document will be run.


13

I don't think this is possible with pdflatex but it is with latexmk by using the option -c as in latexmk -c foo.tex See Prevent pdflatex from writing a bunch of files for details. Why use latemk instead of pdflatex? Because it makes compilation easier. You just have to issue latexmk once and it runs pdflatex, bibtex or biber and makeindex as many times as ...


13

Assuming you are using flyspell, yes it is possible! The package flyspell-babel.el should do exactly what you want: read inline language changes for babel, and start a flyspell process for that language. According to the documentation: The parsing done by this package has its limits limited, and so it will not work with arbitrary LaTeX code. I hope ...


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