[Top][All Lists]

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

Re: [AUCTeX] Referencing labels with refstyle.sty

From: Ralf Angeli
Subject: Re: [AUCTeX] Referencing labels with refstyle.sty
Date: Wed, 11 Jul 2007 22:15:11 +0200
User-agent: Gnus/5.110007 (No Gnus v0.7) Emacs/22.1.50 (gnu/linux)

* Alan Ristow (2007-07-11) writes:

> This gets me halfway there, inserting \figref{fig:foo} rather than the 
> \figref{foo} that I would like. Not being much of a Lisp programmer, 
> after some struggle I came up with
> (setq reftex-label-alist
>        '(("figure"   ?f "fig:"  reftex-format-ref-function  caption nil)))

The fourth element in the list must be a string.  So you cannot use a
function there.  (Perhaps RefTeX should support that.)

RefTeX allows specifying a function for formatting the reference by
setting `reftex-format-ref-function', see
(info "(reftex)Options (Referencing Labels)").  You could set this
function in a style file for refstyle.sty for example like this:

(defun my-reftex-format-ref-function (label format)
  (let* ((label-sep-pos (string-match ":" label))
         (prefix (substring label 0 label-sep-pos))
         (suffix (substring label (1+ label-sep-pos))))
    (format "\\%sref{%s}" prefix suffix)))

(set (make-local-variable 'reftex-format-ref-function)

I don't know refstyle.sty so you have to check if the logic in the
function above is working as well for other cases than the one you


reply via email to

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