[Top][All Lists]

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

[AUCTeX-devel] Any equivalent to `reftex-label' in AUCTeX

From: Arash Esbati
Subject: [AUCTeX-devel] Any equivalent to `reftex-label' in AUCTeX
Date: Tue, 18 Aug 2015 22:19:14 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5

Hi all,

caption.sty has an undocumented command `\captionbox' with the following

    \captionbox[list entry]{heading}[width][inner-pos]{contents}

`heading' contains the caption text and the `\label{}'.  Currently, I
have the following code in `caption.el' to implement this command:

--8<---------------cut here---------------start------------->8---
(defun LaTeX-arg-caption-captionbox (optional &optional prompt)
  "Query for the arguments of `\\captionbox' incl. a label and
insert them."
  (let* ((caption (TeX-read-string (TeX-argument-prompt optional prompt 
         (label   (if (fboundp 'reftex-label)
                      (reftex-label nil t)
                    (TeX-read-string (TeX-argument-prompt optional prompt 
         (width   (completing-read (TeX-argument-prompt t prompt "Width")
                                   (mapcar (lambda(elt) (concat TeX-esc (car 
         (inpos   (completing-read (TeX-argument-prompt t prompt "Inner 
                                   '("c" "l" "r" "s")))
         (heading (format "%s\\label{%s}" caption label)))
    (TeX-argument-insert heading optional)
    (cond (;; 2 optional args
           (and width (not (string-equal width ""))
                inpos (not (string-equal inpos "")))
           (insert (format "[%s][%s]" width inpos)))
          (;; 1st empty opt. arg, 2nd opt. arg
           (and (string-equal width "")
                inpos (not (string-equal inpos "")))
           (insert (format "[][%s]" inpos)))
          (;; 1st opt. arg, 2nd empty opt. arg
           (and width (not (string-equal width ""))
                (string-equal inpos ""))
           (insert (format "[%s]" width)))
          (t ; Do nothing if both empty

 (lambda ()
   '("captionbox"  [ "List entry" ] (LaTeX-arg-caption-captionbox) t)))
--8<---------------cut here---------------end--------------->8---

My question is, does AUCTeX has something equivalent to `reftex-label'
or should I just read the label as a string?

Best, Arash

reply via email to

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