Disclaimer: This is a question about Emacs and AUCTeX. Sorry if this is out of the scope of tex.sx.
How can I add a new command to AUCTeX?
I want my AUCTeX mode to have the command C-c C-f C-p
insert a \pname{ }
and behave similarly to the other ways of changing fonts, e.g. C-c C-f C-e
for \emph{ }
.
The manual page Changing the font, explains that
AUCTeX provides convenient keyboard shortcuts for inserting macros which specify the font to be used for typesetting certain parts of the text. They start with
C-c C-f
, and the lastC-
combination tells AUCTeX which font you want
Font list: KEY TEXTFONT MATHFONT
C-a \mathcal{ }
C-b \textbf{ } \mathbf{ }
C-c \textsc{ }
C-e \emph{ }
C-f \textsf{ } \mathsf{ }
TAB \textit{ } \mathit{ }
RET \textmd{ }
C-n \textnormal{ } \mathnormal{ }
C-r \textrm{ } \mathrm{ }
C-s \textsl{ } \mathbb{ }
C-t \texttt{ } \mathtt{ }
C-u \textup{ }
C-d -- delete font
I want to bind the command C-c C-f C-p
to \pname{ }
in AUCTeX mode.
Best Answer
AUCTeX actually makes this very easy: customize
LaTeX-font-list
.should work. You'll have to re-run
LaTeX-mode
in the appropriate buffers if you have any open.Note that this must be done after
LaTeX-font-list
has been defined inlatex.el
. Here is a simple configuration withuse-package
: