Hot answers tagged

139

I have never used Emacs in Windows but I started to learn and use Emacs only eight or nine months ago and I now use it for most of my work. Learning First you need to get comfortable with the basics of Emacs and probably this is what will be your main frustration. For a new user the commands for basic usage can be a pain to learn because they are unlike ...


60

When drafting you benefit from effectively being able to write an outline and edit it. Org-mode is a good tool for this. Since Org-mode is an Emacs mode you should know the basics of Emacs, such as commands for navigating in buffers and switching between buffers as described under Learning in A simpleton's guide to (...)TeX workflow with emacs. The ...


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


24

You need org-mode 8.3 to do this. From ORG-NEWS * Version 8.3 [...] ** New features [...] *** Export unnumbered headlines Headlines, for which the property ~UNNUMBERED~ is non-nil, are now exported without section numbers irrespective of their levels. The property is inherited by children. For example (with-temp-buffer (require 'ox-latex) (insert " *...


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


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

The variable you need to hook into is reftex-cite-format. Somewhere in my Emacs init file, I have this code: (eval-after-load 'reftex-vars '(progn ;; (also some other reftex-related customizations) (setq reftex-cite-format '((?\C-m . "\\cite[]{%l}") (?f . "\\footcite[][]{%l}") (?t . "\\textcite[]{%l}") ...


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


20

If you use AucTeX, with outline minor mode turned on, you get a series of useful key-bindings, including (C- = Ctrl-): C-c @ C-n   Move to next heading (at any level) C-c @ C-p   Move to previous heading (at any level) C-c @ C-f   Move Forward to next heading at the same level C-c @ C-b   Move Backward to previous heading at the same level (A quick look at ...


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


17

It may be possible to have Emacs switch major modes depending on the position of point, but this can quickly become computationally-intensive and can break workflows (especially those that make heavy use of temporary variables). It would be better to adopt the Org model of source code editing: send the interesting bits to a separate buffer and change the ...


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

Since Emacs 24.1 bibtex-mode supports biblatex: * BibTeX mode now supports biblatex. Use the variable `bibtex-dialect' to select different BibTeX dialects. To use it you can for example set it as a file variable to bibliography files by adding the following to their first line: -*- mode:bibtex; bibtex-dialect: biblatex -*-


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

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


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