auctex
[Top][All Lists]
Advanced

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

Re: [AUCTeX] Defining env with key-val in opt. argument


From: Arash Esbati
Subject: Re: [AUCTeX] Defining env with key-val in opt. argument
Date: Sat, 4 Oct 2014 19:19:50 +0000 (UTC)
User-agent: Loom/3.14 (http://gmane.org/)

Tassilo Horn <tsdh <at> gnu.org> writes:

Hi Tassilo,

> "Arash Esbati" <Esbati <at> gmx.de> writes:
> 
> Hi Arash,
> 
> > emacs ist not happy and exits with:
> >
> > let: Wrong number of arguments: #[(optional key-val-alist) ...
> >
> > Any idea what is going wrong here?  TIA.
> 
> `TeX-arg-key-val' has two mandatory arguments and you've omitted the
> first.  But that function inserts the arguments it prompts for (i.e., it
> doesn't return them as a string), so your code wouldn't work also for
> that reason.
> 
> --8<---------------cut here---------------start------------->8---
> (defvar LaTeX-enumitem-key-val-options
>   '(;;
>     ("topsep")
>     ("partopsep")
>     ("label")
>     ("label*")
>     ("align" ("left" "right" "parleft")))
>   "Key=value options for enumitem macros and environments.")
> 
> (TeX-add-style-hook
>  "enumitem"
>  (lambda ()
>    ;; New environments
>    (LaTeX-add-environments
>     '("itemize" LaTeX-env-args [TeX-arg-key-val
LaTeX-enumitem-key-val-options])
>     '("enumerate" LaTeX-env-args [TeX-arg-key-val
LaTeX-enumitem-key-val-options])
>     '("itemize*" LaTeX-env-args [TeX-arg-key-val
LaTeX-enumitem-key-val-options])
>     '("enumerate*" LaTeX-env-args [TeX-arg-key-val
LaTeX-enumitem-key-val-options]))))
> --8<---------------cut here---------------end--------------->8---

Thanks for your response and clarification.  With your code, I get the
following in my tex document:

\begin{itemize*}[align=left]
  <cursor position>
\end{itemize*}

I want AUCTeX to insert the first `\item' as well.  Any idea how I can
achieve this?

\begin{itemize*}[align=left]
\item <cursor position>
\end{itemize*}

Best, Arash





reply via email to

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