Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

In AucTeX, new item in itemized list after comment results in commented next item

In AucTeX, when editing an itemized list:

\begin{itemize}
 \item My item % note to self
\end{itemize}

when I do C-c C-j after 'self' I get:

\begin{itemize}
 \item My item % note to self
 % \item
\end{itemize}

when I want:

\begin{itemize}
 \item My item % note to self
 \item
\end{itemize}

Is there a setting a can modify to make this work correctly?

like image 742
stevejb Avatar asked May 02 '10 15:05

stevejb


1 Answers

(setq LaTeX-insert-into-comments nil)

seems to solve the problem, although it may have other effects that I'm not aware of. To use it, put it in your .emacs customization file; to test it, try M-: then paste the above code into the prompt.

The variable LaTeX-insert-into-comments is defined as

*Whether insertion commands stay in comments. 
This allows using the insertion commands even when
the lines are outcommented, like in dtx files.

EDIT:

Here is something better:

(defadvice LaTeX-insert-item (around my-LaTeX-insert-item activate)
     (let  ((LaTeX-insert-into-comments nil)) ad-do-it))

This will prevent unwanted effects from setting the LaTeX-insert-into-comments globally to nil by changing it only temporarily when you insert an item. Again, to use it, put it in your .emacs customization file.

like image 100
polyglot Avatar answered Nov 08 '22 11:11

polyglot