In a document using LaTeX-mode (i.e., AUCTeX), the command LaTeX-section (C-c C-s) inserts a small template corresponding to a LaTeX sectioning element. How can these inserted templates be modified?

The original function inserts something like this:

\section{A Section}

And let's say that, instead, I'd like the command to insert something different, like:

\section{\color{red}A Section}\label{a-label}

This is not the idea behind LaTeX. If you want your titles to be red, use a package like titlesec and change the color on a global level. Adding the color command inside the \section macro is a bad idea.

  • You seem to have misinterpreted my question. The questions is not about changing the color of the section heading, it's about controlling what the command LaTeX-section inserts into the buffer. Changing the color was just an arbitrary example. – UndeadKernel Sep 17 '18 at 8:40
  • @UndeadKernel - I simply read your question and tried to interprete as little as possible. Maybe you edit your question and show a real life showcase as a MWE. – Arash Esbati Sep 17 '18 at 10:01

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.