[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [AUCTeX] Automatic \item with C-c C-e
From: |
Tassilo Horn |
Subject: |
Re: [AUCTeX] Automatic \item with C-c C-e |
Date: |
Mon, 08 Jun 2015 21:14:37 +0200 |
User-agent: |
Gnus/5.130014 (Ma Gnus v0.14) Emacs/25.0.50 (gnu/linux) |
Delia Fara <address@hidden> writes:
Hi Delia,
> I've just written it as a LaTeX macro using "\newenvironment", put it
> in a .tex file and enable it using "\input{}". The point of the list
> is to have the labels be numbers in parentheses that don't start over
> with "(1)" with each \begin{}... \end{} pair.
>
>
> -------------------------------
> \newcounter{running}
>
> \newenvironment{runninglist}
> {%
> \begin{list}{\refstepcounter{running}(\arabic{running})}
> {\renewcommand{\makelabel}[1]{ ##1}
> \settowidth{\labelwidth}{(999)}
> \setlength{\leftmargin}{0in}
> \addtolength{\leftmargin}{\labelwidth}
> \addtolength{\leftmargin}{\labelsep}
> \rightmargin=\leftmargin}
> }
> {\end{list}}
>
>
> \newcommand{\rlabel}[1]%
> {\addtocounter{running}{-1}\refstepcounter{running}\label{#1}}
>
> --------------------------------
>
> I'm not very sophisticated, so maybe I should just leave things atthat.
You can create a directory/file style/mydoc.el next to your tex document
mydoc.tex with the following contents.
--8<---------------cut here---------------start------------->8---
(TeX-add-style-hook
"minted"
(lambda ()
(LaTeX-add-environments '("runninglist" LaTeX-env-item)))
LaTeX-dialect)
--8<---------------cut here---------------end--------------->8---
Then, after typing `C-c C-n' in the corresponding tex buffer (or simply
kill and reopen that file), `C-c C-e runninglist' should behave as if
you were inserting a normal itemize or enumerate environment, i.e., add
the environment and its first item.
Bye,
Tassilo