Está en la página 1de 8

simply so many of them that sometimes, at the end of the day, you simply don't know that you

should look fo
already
Useful there.
shortcuts or key bindings or predefined commands for emacs+AUCTeX - TeX - LaTeX Stack Exchange 3/31/17, 1'44 PM

Are you aware of a place where these can be found? I'm not referring to a listing of all possible key bindings et
found in AUCTeX documentation), rather than sort of the top 10/20/50 or so. If something like this is not arou
here would be a nice idea.

Well... Now it's your turn...

{emacs} {auctex}

edited Sep 28 '15 at 17:38 asked Jun 15 '11 at 16:47


Sean Allred Dror
16.6k 4 45 159 9,485 13 61 135

7 This is a great question. I'm always learning cool new stuff about emacs. (For example, I only learned
about C-c C-m last week!) Seamus Jun 15 '11 at 17:17

1 I might write up a CW answer containing all the information below (sorted by topic). It seems that each
answer contains good information and accepting one or the other seems odd somehow. Seamus Jun 17
'11 at 15:31

7 Answers

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 (or C-c RET ) insert macro (warning: pressing TAB at this point will take a
while because auctex will load a list of all the macros it knows about. If the macro you
pick is \usepackage and then TAB auctex will load a list of all the packages it knows
about for you to choose from.)

C-c C-f C-eAdd an \emph{} and place cursor between the braces. Or if you have
some text marked, wrap it in \emph replace C-e by C-b , C-c C-i , C-t for \textbf

http://tex.stackexchange.com/questions/20843/useful-shortcuts-or-key-bindings-or-predefined-commands-for-emacsauctex Page 1 of 8
C-c * mark current section/subsection
Useful shortcuts or key bindings or predefined commands for emacs+AUCTeX - TeX - LaTeX Stack Exchange 3/31/17, 1'44 PM
C-c ] close current environment

C-M-a find matching begin environment, C-M-e find matching end

Compilation

C-c C-aruns LaTeX/TeX, BibTeX/Biber, Makeindex, etc... as appropriate until the


document is ready, and eventually opens the output document in the viewer. It is like
running C-c C-c (see below) repeatedly, but with just a single key binding. This is
what you want to use most of the time if you trust the advanced ability of AUCTeX to
guess the right commands to run.

C-c C-c do most appropriate compilation activity (LaTeX, BibTeX, View...) It's pretty
smart, and you can override the default to pick what action you cant to do. You can
use this key binding also to delete all auxiliary files created during compilation
( Clean and Clean all actions).

C-c C-r do most appropriate compilation activity (LaTeX, BibTeX, View...) to the
region that has been pinned by C-c C-t C-r . Of course one wants to use C-c . or C-
c * to ease the select a region.

C-c C-v view document (without compiling)

RefTeX

RefTeX, while not strictly part of AucTeX is an essential part of your emacs/TeX
working life.

C-c ( add label. Auto-suggests names based on current section.

C-c ) add \ref you can select from the list of currently defined labels. If you
customise a certain variable (whose name escapes me) you can add hyperref, varioref
and cleverref reference commands to the list of types of reference available.

C-c [ add citation. RefTeX understands bibliography commands and will search your
.bib for references that match the pattern you supply to this command. Can be
customised to have harvard, chicago and other kinds of reference commands
available. (No BibLaTeX citation style support yet as far as I know.)

C-c = jump to section: opens list of sections/subsections etc you can jump to.

When in the toc buffer :

RETGo to the selected header and hide the toc buffer. If the local variable TeX-
Master is correctly set (see AUCTeX documentation), it is a very convenient way of
jumping in any other file of your project.

Space Go to the selected header, don't hide the toc buffer.

< Increase the level of the selected header or region (section becomes chapter,
subsection becomes section, etc)

http://tex.stackexchange.com/questions/20843/useful-shortcuts-or-key-bindings-or-predefined-commands-for-emacsauctex Page 2 of 8
C-c C-o C-b for folding TeX code
Useful shortcuts or key bindings or predefined commands for emacs+AUCTeX - TeX - LaTeX Stack Exchange 3/31/17, 1'44 PM
C-M-S f or C-M-S b to mark the content between a pair of balanced braces.

edited Nov 6 '16 at 19:44 community wiki


13 revs, 10 users 80%
Seamus

I may have missed stuff in my summarising, please add stuff I've missed. Seamus Jun 17 '11 at 16:26

2 Not strictly about key-bindings, but Orgmode Tables is really very cool. Pointed out to me by Damien &
Oscar. emacsomancer Jun 19 '11 at 22:25

@BeSlayed I think that is a bit beyond the remit of this question, but it's certainly a neat little tool.
Seamus Jun 20 '11 at 10:49

Yes, and maybe this should be part of a separate question/topic, but it's another feature which makes
using Emacs for LaTeX extremely useful (and I would love to learn more like this). emacsomancer Jun 20
'11 at 15:21

1 Oh. That reftex trick of changing the level of headers with < and > is AMAZING. emacs never ceases to
amaze me Seamus Jan 9 '12 at 16:15

In addition to what Seamus mentioned:

1. 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.
2. C-c ; comment out/uncomment region
3. M-q format paragraph (sticks in and removes line breaks so that there is no
wrapping or over-short lines)

The following are actually RefTeX command properly speaking, but useful:
4. C-c = show (RefTeX's internal) table of contents - very useful for navigating long
documents
5. C-c [ insert citation with key selection (lets you search through your
bibliographic references and then insert) (also C-u C-c [ - same thing but
prompts for optional arguments)

And of course:
6. C-c C-c run (the next appropriate) command on master file (LaTeX, BibTeX etc.)

and
7. C-c - view errors / next error

And, not part of the AUCTeX/RefTeX package, but the


8. align commands from align.el can be useful for dealing with tables in LaTeX

answered Jun 16 '11 at 22:51

http://tex.stackexchange.com/questions/20843/useful-shortcuts-or-key-bindings-or-predefined-commands-for-emacsauctex Page 3 of 8
C-c
Useful . mark
shortcuts or keycurrent
bindings orenvironment
predefined commands for emacs+AUCTeX - TeX - LaTeX Stack Exchange 3/31/17, 1'44 PM

C-c * mark current section/subsection

C-c C-m insert macro (warning: pressing TAB at this point will take a while because
auctex will load a list of all the macros it knows about. If the macro you pick is
\usepackage and then TAB auctex will load a list of all the packages it knows about
for you to choose from.)

These are the bindings I use the most that are AucTeX specific. There's a useful cheat
sheet here. You might also want the generic emacs one here.

I don't know if this is on by default, but the funky quote thing is another lifesaver. See
this answer for some details. The basic idea is that ` followed by a keystroke can
give you a bunch of different shortcuts to macros. It's like a compose key for LaTeX
mathmode.

edited Jun 29 '16 at 17:27 answered Jun 15 '11 at 17:09


Arash Esbati Seamus
3,960 1 4 17 38.7k 28 174 306

1 C-c . and C-c * , I think, not C-c C-. and C-c C-* . emacsomancer Jun 16 '11 at 12:10

@BeSlayed You're right there. Ooops. Seamus Jun 16 '11 at 12:17

Instead of C-C C-m you can do C-C Ret . N.N. Oct 20 '11 at 22:15

@Seamus when I hit C-c C-e then TAB I get auto-completion list but I didn't find \includegraphics
even when graphicx package in preamble, I wonder how to have commands of laoded packages in the
preamble appear in the auto-completion list. doctorate Nov 21 '14 at 19:10

@doctorate \includegraphics isn't an environment. So it's not surprising it doesn't show up. C-c C-e
figure gets you a figure environment. I guess you could use C-c C-m to get you includegraphics
but it hardly seems worth it, in terms of the time it saves you. Seamus Nov 23 '14 at 13:50

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 documentation on the current
major mode, which normally describes the commands and features that are
changed in this mode.

If you have reason to believe that most interesting AUCTeX bindings begin with C-c ,
then C-c C-h will show you just the key bindings that begin with C-c . There is an
informal convention that major modes use C-c as a prefix, so this is a reasonable
thing to try.

If you wanted all possible key bindings (which the original question does not want),

http://tex.stackexchange.com/questions/20843/useful-shortcuts-or-key-bindings-or-predefined-commands-for-emacsauctex Page 4 of 8
answer slightly to avoid claiming that you asked for something you didn't. Ben Liblit Jun 17 '11 at 15:24

@Seamus:
Useful shortcuts right,
or key goodoridea!
bindings I'll pull
predefined that into
commands for my answer as well.
emacs+AUCTeX - TeX - LaTeX
Ben Liblit
Stack Jun 17 '11
Exchange at 15:25 3/31/17, 1'44 PM

Please google 'refcard auctex'. If you installed Auctex, the pdf is on your computer
already. The refcard lists many usefull shortcuts.

edited Jun 17 '11 at 15:31 answered Jun 16 '11 at 14:33


Seamus Keks Dose
38.7k 28 174 306 15.6k 3 41 73

I think this deserves a place here, even though it is connected rather to Emacs than
AucTeX itself (it really can save you a lot of time!).

There is a great package called yas-snippet which can facilitate many things one does
while editing TeX files in Emacs.

For example I like using easy-todo for notes. But writing \todo{note} everytime I
want to make a note is a bit of a turnoff. With yas-snippet I can press just td <TAB>
(or any other key combination I set) and auto-magically \todo{note} appears with the
cursor set in the brackets.

To install in Emacs 24 just do: M-x list-packages and choose yas-snippet .


To make a new snippet: M-x yas-new-snippet
To compile a snippet: C-c C-c

Sample code for notes (mentioned above):

# -*- mode: snippet -*-


# name: easy todo note
# key: td
# binding: direct-keybinding
# type: snippet
# --
\todo{ ${1:note}}

Some more things to note:

you can use this pretty much for everything. E.g. if it seems that there is no
keyboard shortcut (for a macro) you are looking for, you can always define a new
snippet and bind it to the key of your choice.
it facilitates specifying packages one wants to load. Using a macro for
\usepackage{} can take awfully long time (as someone above mentioned). But if
you know the name of the package, and have yas-snippet installed you can just
type pkg <TAB> and enter the name of the package.
comes with a bunch of predefined snippets for LaTeX. You can easily
yas-snippet
learn about them through menu-bar ( M-x menu-bar-mode if it is not enabled).

http://tex.stackexchange.com/questions/20843/useful-shortcuts-or-key-bindings-or-predefined-commands-for-emacsauctex Page 5 of 8
with periods is tricky, because usually arguments can be involved, and it breaks the
whole thing really.
Useful shortcuts or key bindings or predefined commands for emacs+AUCTeX - TeX - LaTeX Stack Exchange 3/31/17, 1'44 PM

answered Jun 29 '16 at 12:36


doed
1,065 7 21

http://tex.stackexchange.com/questions/20843/useful-shortcuts-or-key-bindings-or-predefined-commands-for-emacsauctex Page 6 of 8
Useful shortcuts or key bindings or predefined commands for emacs+AUCTeX - TeX - LaTeX Stack Exchange 3/31/17, 1'44 PM

http://tex.stackexchange.com/questions/20843/useful-shortcuts-or-key-bindings-or-predefined-commands-for-emacsauctex Page 7 of 8
Useful shortcuts or key bindings or predefined commands for emacs+AUCTeX - TeX - LaTeX Stack Exchange 3/31/17, 1'44 PM

http://tex.stackexchange.com/questions/20843/useful-shortcuts-or-key-bindings-or-predefined-commands-for-emacsauctex Page 8 of 8

También podría gustarte