[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [AUCTeX-devel] [RefTeX] reftex-reference ignores reference format se
From: |
Mosè Giordano |
Subject: |
Re: [AUCTeX-devel] [RefTeX] reftex-reference ignores reference format selection |
Date: |
Tue, 21 Jan 2014 12:05:29 +0100 |
2014/1/10 Mosè Giordano <address@hidden>:
> Hi all,
>
> the `reftex-reference' function ignores the selected reference format
> (if `reftex-ref-macro-prompt' is non-nil) when one choses an equation
> key.
>
> For example, consider the following code
> --8<---------------cut here---------------start------------->8---
> \documentclass{article}
> \begin{document}
> \begin{equation}
> \label{eq:1}
> a + b = c
> \end{equation}
> Equation on page-!-
> \end{document}
> --8<---------------cut here---------------end--------------->8---
> with point at -!-. If one issues `C-c )' and selects the `\pageref'
> macro, an `\eqref' will be inserted. This seems to occur only with
> equation keys. I'm running Emacs 24.3. Of course one can insert the
> `\pageref' with `C-c C-m pageref RET', but I expect to be able to
> accomplish this also with `reftex-reference'.
Some more information after a bit of debugging with `edebug-defun':
the problem is in the `reftex-format-special' function.
(reftex-format-special "fig:bar" "~\\ref{%s}" "\\pageref")
returns the expected
"~\\pageref{fig:bar}"
while
(reftex-format-special "eq:foo" "~\\eqref{%s}" "\\pageref")
returns
"~\\eqref{eq:foo}"
but I would expect
"~\\pageref{eq:foo}"
The docstring of `reftex-format-special' says
Apply selected reference style to format FMT and add LABEL.
Replace any occurrences of "\ref" with REFSTYLE.
Should we replace any occurrences of "\[a-zA-Z]*ref*" with REFSTYLE
(or something like this that will work with `\eqref')? It's not clear
to me why there is a `while' loop.
Bye,
Mosè