auctex
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [AUCTeX] Indent level in itemize


From: Tassilo Horn
Subject: Re: [AUCTeX] Indent level in itemize
Date: Thu, 20 Feb 2014 13:49:13 +0100
User-agent: Gnus/5.13001 (Ma Gnus v0.10) Emacs/24.3.50 (gnu/linux)

Stefano Lodi <address@hidden> writes:

Hi Stefano,

> How can I configure auc-tex to get the following indentation?
>
> \begin{itemize}
>   \item This is the first item in my list, 
>     with a pretty useless text in it
>
> My goal is to make my LaTeX sources compatible with other editors,
> notably WinEdt, which by default indent this way.

Change the WinEdt default indent.  It is wrong!1!! ;-)

Fun aside, this works for me:

--8<---------------cut here---------------start------------->8---
(defun my-LaTeX-indent-itemize ()
  (destructuring-bind (beg-pos . beg-col)
      (LaTeX-env-beginning-pos-col)
    (cond ((looking-at "\\\\end{itemize}")
           beg-col)

          ((looking-at "\\\\item")
           (+ 2 beg-col))

          (t (+ 4 beg-col)))))

(add-to-list 'LaTeX-indent-environment-list
             '("itemize" my-LaTeX-indent-itemize))
--8<---------------cut here---------------end--------------->8---

Bye,
Tassilo




reply via email to

[Prev in Thread] Current Thread [Next in Thread]