[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[AUCTeX-devel] Automatic adding of label to optional argument
From: |
Arash Esbati |
Subject: |
[AUCTeX-devel] Automatic adding of label to optional argument |
Date: |
Thu, 12 Jan 2017 18:35:15 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/25.1.91 |
Hi all,
some packages like listings.sty have a label key since one cannot put
\label in the body of the environment. I wrote a function which uses
the standard interface of AUCTeX and/or RefTeX for inserting a \label
and then moves the result into the optional argument. Please find
attached a modified version of listings.el. The respective function is
`LaTeX-listings-env'. Any comments are welcome. One thing I'm not sure
is do I have to (set-marker let-bound-marker nil) at the end of the
function? I could see if I can make a more generalized function out of
this.
Here a small .tex file:
--8<---------------cut here---------------start------------->8---
\documentclass{article}
\usepackage{listings}
\begin{document}
Eval this first:
\begin{lstlisting}
(add-to-list 'LaTeX-label-alist '("lstlisting" . "lst:") t)
Copy this: aboveskip=4pt, caption ={Some caption}
\end{lstlisting}
Enter `C-c C-e lstlisting RET' and yank
`aboveskip=4pt, caption ={Some caption}' when asked for key=vals.
\begin{lstlisting}[aboveskip=4pt, caption ={Some caption},label={lst:1}]
Result will be like this.
Try `C-c ) l' with RefTeX enabled.
\end{lstlisting}
\end{document}
--8<---------------cut here---------------end--------------->8---
listings.el
Description: application/emacs-lisp
Best, Arash
- [AUCTeX-devel] Automatic adding of label to optional argument,
Arash Esbati <=
- Re: [AUCTeX-devel] Automatic adding of label to optional argument, Mosè Giordano, 2017/01/12
- Re: [AUCTeX-devel] Automatic adding of label to optional argument, Arash Esbati, 2017/01/13
- Re: [AUCTeX-devel] Automatic adding of label to optional argument, Mosè Giordano, 2017/01/15
- Re: [AUCTeX-devel] Automatic adding of label to optional argument, Arash Esbati, 2017/01/16
- Re: [AUCTeX-devel] Automatic adding of label to optional argument, Arash Esbati, 2017/01/17
- Re: [AUCTeX-devel] Automatic adding of label to optional argument, Mosè Giordano, 2017/01/18
- Re: [AUCTeX-devel] Automatic adding of label to optional argument, Arash Esbati, 2017/01/18
- Re: [AUCTeX-devel] Automatic adding of label to optional argument, Mosè Giordano, 2017/01/16