I previously asked about tricks for reducing typing when writing beamer presentations. I thought it might be useful to write a few macros for common commands. E.g., something like this:


I'm always a little wary about defining macros in case it introduces issues. In particular, I encountered problems when trying to write a macro for \begin{frame}.

Has anyone already done this and worked out a good set of macros?

I'd also be interested in whether experienced users think macro redefinition in this case is worth the bother.

  • 4
    I would advise against having commands that start an environment. It makes it harder to read when environments start and stop if you start obfuscating the \begin and \end commands. – Seamus Oct 14 '10 at 10:14
  • 2
    If typing is what you are concerned about, I suggest defining keyboard shortcuts/macros in Vim/Emacs/whatever editor you use instead. – Daisy Sophia Hollman Nov 15 '10 at 13:05

I'm not a big fan of using macros in this way. It does cut down on a bit of typing, but tends to make the source code much more opaque. A better solution is to use an editor that allows you to assign bits of code to shortcuts. For example, I use TeXShop (Mac OSX) and have set the key combination Ctrl+Opt+Cmd+1 to insert the code


and place the cursor right after \item. This cuts down on typing (I just have to mash down the bottom left of my keyboard and type a number) while still producing a readable source.

I'm sure that there are ways of reproducing this functionality with other editors and on other operating systems as well; this answer to a very similar question suggests the AutoHotkey utility for Windows.

  • Thanks. Based on your thoughts and the number of up votes, I think I'll just avoid the macro redefinition. – Jeromy Anglim Oct 14 '10 at 7:56

Emacs+AucTeX already has built in keyboard shortcuts for adding environments, sections and so on (with labels added automatically if needed). A similar approach can be achieved in any other text editor with a flexible enough keyboard shortcut defining structure. This is, as has already been pointed out, preferable to TeX macros for new environments.

One beamer specific macro that I use is the following:


What this does is define a bitemize environment that has consecutive items appear one by one on the slides. This doesn't really save all that many keystrokes, but [<+->] is tricky to type in a hurry, and since I use Emacs' C-c C-e to add environments, it saves me navigating back to the top of the itemize environment to add it.

One could also do the following for a similar small saving when using alert:


I expect this will reveal consecutive alerts on consecutive slides. (I haven't used this, I just thought of it now. I don't tend to use alert, but I know people who do.


A very simple way of reducing typing by keyboard shortcuts in Linux is the small, very cool editor Scribes ( http://scribes.sourceforge.net/ ), where you can import and export your shortcuts as xml. An example of latex shortcuts is at the download site.

For Beamer, I created my own and simply type:

  • fr for the whole frame environment or
  • bl for a block,
  • de for a description,
  • item for an itemize environment.

That works very well and is really fast.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.