# 2016-10-10 Fast font changes in AUCTeX

## Fast font changes in AUCTeX

This is a really simple tip, but it saves a lot of dull work. In AUCTeX, you can mark some text and press C-c C-f C-e to put an \emph around it. Type C-c C-f C-h to see other options, divided into text and math modes.

But wait, there’s more! If you precede it with an argument (i.e., C-u), instead of marking up the region, AUCTeX replaces the most nested font command around the point with the given one (disregarding the region). This means that (if the point is marked with -!-), this:

Hello \textit{wor-!-ld!}


becomes this:

Hello \emph{wor-!-ld!}


after pressing C-c C-f C-e. Also, you can press C-u C-c C-f C-d and the nearest (again, in the sense of nesting) font command disappears altogether. Very handy, and I have to admit that I miss that a lot in Org-mode (even though Org’s markup wrt fonts is much lighter).

If you have your own font changing commands, like, say, \defterm (for the defined term, possibly defined by

\newcommand{\defterm}[1]{\emph{#1}}


or something similar), you can add it to LaTeX-font-list and enjoy your own font-changing command on the C-c C-f ,,prefix’’. (It’s not really a prefix, since it just runs the TeX-font command, but that doesn’t matter now.)