Tag Info

Hot answers tagged

65

Summary answer This answer is CW. Please add the best tricks to it! First things first: these cheat sheets are very useful: AucTeX refcard Emacs refcard C-h m will show information on the current major mode. C-c C-h shows all bindings that start with C-c C-h b shows all bindings currently available. Now for some details. Macros C-c C-m insert ...


31

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


29

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


27

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


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

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 -s /Library/TeX/Distributions/.DefaultTeX/Contents/Programs/texbin \ /usr/texbin This will essentially create a shortcut at /usr/texbin that points to your texbin in ...


22

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>


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

Instead of editing the texmf.cnf file you can just add -file-line-error option to your TeX processor. To do this add the following code to your .emacs: (setq LaTeX-command-style '(("" "%(PDF)%(latex) -file-line-error %S%(PDFout)"))) See also the AUCTeX FAQ: 8. Why does TeX-next-error (C-c `) fail? When writing the log file, TeX puts information ...


18

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


17

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


16

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


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

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


15

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


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

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


14

For those less comfortable with the command line: I had this problem after upgrading to OSX 10.9.2 as well. After the upgrade, in my /Applications/TeX/ directory I found a FixMacTeX2013.pkg. Running this fixed the pdflatex issue.


13

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


13

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


13

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


13

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


13

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


12

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


12

M-x LaTeX-fill-environment and M-x LaTeX-fill-buffer are very useful when editing other peoples code (generalisations of M-q, been using AUCTeX for years and did not know about it). I love (C-u) C-c C-e and never understood why it hasn't been copied by others. M-x reftex-change-label and the other refTeX global actions has also proved very handy. I ...


12

You can add this to your emacs.el: (setq-default TeX-engine 'xetex) And add this if you want a PDF output by default: (setq-default TeX-PDF-mode t)


11

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


11

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


11

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



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