# Tag Info

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

21

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

20

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

19

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

17

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

14

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

12

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

12

If you have AUCTeX version 11.86, you can set the local variable TeX-engine to xetex. This is what I use: %%% Local Variables: %%% coding: utf-8 %%% mode: latex %%% TeX-engine: xetex %%% End: You can check the version you have with C-h v AUCTeX-version <RET>

12

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")))

11

The most common package to preview text in Emacs is Preview TeX, a package now build into AUCTeX http://gnu.org/software/auctex It works with both latex and pdflatex. Within a LaTeX buffer, just type C-c C-p C-b, or within the menu do Preview->for buffer. A simpler, but less effective alternative is to use the X-Symbol package: ...

11

This is indeed a bug in AUCTeX. To fix it you need to customize TeX-command-list so that the LaTeX entry has the associated command equal to %`%l --jobname=%s %(mode)%' %t which includes an explicit setting of jobname to match that of your current file. The relevant part of the customize buffer looks like this (you need to have opened a tex file, before ...

10

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

10

If you are happy with fontification (as explained in http://lists.gnu.org/archive/html/emacs-orgmode/2009-05/msg00236.html) you can add the following to your .emacs. It adds fontification for some macros, such as some from biblatex, csquotes, cleveref and enumitem. If you want to add or remove macros from the configuration it is easily done, just check the ...

10

ok, sorry for the delay- i wasn't allowed to post a self-answer earlier. Indeed Emacs.app was operating in a different environment than the terminal. M-x getenv for PATH showed that /usr/texbin was missing, which explains why LaTex was not working inside the Emacs.app shell. following @Alan Munn's idea to stay away from editing a .plist I found some ...

10

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) Backward search (Evince to Emacs) Path names with spaces Multifile setups (TeX files requested by Evince will be opened if they aren't open yet) I tested with Emacs 24.2 Evince 3.4.0 OpenSUSE 12.2 ; ...

10

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-[ to prompt you for a ...

10

I'm also running Emacs 24.2.50.1 on Debian stable (Squeeze) and I have the same issue. The difference is that I'm using AUCTeX 11.85 from the Debian repository, while you're using 11.86 from the ELPA. I don't think your configuration is the issue, rather, it seems there is a bug in the font-latex package, which is part of AUCTeX, which recent versions of ...

9

For it to work you have to load babel after csquotes as reported in http://permalink.gmane.org/gmane.emacs.auctex.bugs/1850. \documentclass{article} \usepackage{csquotes} \usepackage[danish]{babel} \begin{document} \end{document} Now pressing " will correctly expand to \enquote{:

9

C-c C-s create section with optional label C-c C-e create environment (\start and \end tags) choose from an autocomplete list or type your own. (If you have LaTeX mode on in an empty file, this will default to the document environment, and prompt you for a documentclass. C-u C-c C-e change the type of the current (innermost) environment C-c . mark current ...

8

As an alternative to manually setting the mode file local variable (which is preferred because it does not rely on heuristics), AucTeX automatically recognizes the TeX format! It knows about LaTeX (detected via \documentclass), ConTeXt (detected via \starttext) and Plain TeX. For example, you can do the following: Create a file abc.tex. AucTeX starts in ...

8

If you are using a TeX Live based distribution, such as MacTeX, I am aware of no "on-the-fly" installation of packages. This is a feature of the Windows-based MikTeX distribution. ACUTeX may provide some functionality to remedy this- those emacs users are crafty. However I cannot speak authoritatively on the subject as I don't use emacs. TeX Live does ...

8

You can use M-x customize-variable. Then enter TeX-engine and hit enter again. You can then choose from a list of TeX engines and save your choice. If you need to add an entry to the list, this should be possible with the TeX-engine-alist variable. You can find all options here: http://www.gnu.org/software/auctex/manual/auctex/Processor-Options.html

7

You can customize the toolbar with M-x customize-variable tool-bar-style. Pick "images" from the value list and you'll lose all the text labels. The actual code run by the Latex button is a combination of two functions. You can run it with the following code: (defun my-run-latex () (interactive) (TeX-save-document (TeX-master-file)) (TeX-command ...

7

I can't test this, as I don't have multiple dictionaries on hand. But it should get you started if it doesn't work completely (to be added to your .emacs): ;; replace the language names and dictionary paths below to suit your setup: (defvar my-dicts '(("danish" . "path-to-my-danish-dictionary") ("english" . "path-to-my-english-dictionary")) "An ...

7

I answered a similar question elsewhere on this site, but I will post the answer here as well. It is extremely frustrating, and I want as many people to find this as possible. If moderators disagree, feel free to delete these posts and let me know To FIX THIS: Open a .tex file (or make one). I will assume that you are using Emacs23, using an Xwindow ...

7

The only thing that has changed is that pdftex.def now tests if you are using the correct engine/mode for this driver file. And you get an error as you are obviously using the wrong mode. Remove the option. It will then work with latex/dvi-output and pdflatex/pdf output. graphics is clever enough to choose the correct driver file.

7

C-h m is useful for identifying bindings provided by the current major editing mode. (Special thanks to @Seamus for pointing this out in a comment below.) Per the Other Help Commands section of the GNU Emacs Manual: Each Emacs major mode typically redefines a few keys and makes other changes in how editing works. C-h m (describe-mode) displays ...

7

In addition to what Seamus mentioned: I use the font selection commands a lot, e.g. C-c C-f C-b for insert \textbf{} (bold) or wrap \textbf{} round current selection, if there is one. C-c C-f C-c - same thing for small caps etc. C-c ; comment out/uncomment region M-q format paragraph (sticks in and removes line breaks so that there is no wrapping or ...

7

You can tell auctex about additional math environments using LaTeX-add-environments. For example, I sometimes use math environments named thm, prop, lem, cor, defn, not, rem, ex, notation, and equation*, and I tell auctex about them with the following lines in my .xemacs/init.el file: (add-hook 'LaTeX-mode-hook 'add-my-latex-environments) (defun ...

7

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

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