auctex-devel
[Top][All Lists]

## Re: [AUCTeX-devel] Questions about cleveref.el

 From: Arash Esbati Subject: Re: [AUCTeX-devel] Questions about cleveref.el Date: Tue, 03 Jan 2017 12:17:45 +0100 User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1.91

Hi Mosè,

> 2017-01-03 8:03 GMT+01:00 Arash Esbati <address@hidden>:
>>>> 2) TeX-arg-cleveref-multiple-labels' does not let you use RefTeX to
>>>>    select label(s) which is much more convenient.
>>>>
>>>> Item 1) is fixed easily, 2) should also be doable with a check againt
>>>> reftex-label' and such.  My question is if there was a particular
>>>> reason to implement the code this way?
>>>
>>> Can reftex-label' query for more than one label?
>>
>> Consider a file like this where * is point:
>>
>>     \documentclass{article}
>>     \usepackage{cleveref}
>>     \begin{document}
>>
>>     \section{Section One}
>>     \label{sec:section-one}
>>
>>     \section{Section Two}
>>     \label{sec:section-two}
>>
>>     *
>>     \end{document}
>>
>> With RefTeX enabled, I hit C-c C-m cref RET', choose a label type, here
>> <space>' for all, and get *RefTeX select* window with the labels.  I
>> mark the labels I want with m' and hit a' when I'm done and get the
>> following line inserted:
>>
>>     \cref{sec:section-one,sec:section-two}
>
> Uh, I didn't know this, thanks for pointing this out!  Then I think
> what you're suggesting is fine.

Thanks, I will wait a day or so to see if Matt also gives a feedback; I
would then apply a patch.

>>> I had a similar problem in biblatex: there are macros taking more than
>>> one reference, but this isn't particularly easy to do with RefTeX, so
>>> I defined a hand-made function (LaTeX-arg-biblatex-cites').
>>
>> The procedure above works also works for citing command using
>> TeX-arg-cite'.  Can you please check if this is what you want?  Then we
>> can modify LaTeX-arg-biblatex-cites' to support this (I hope).
>
> The citations are to be formatted as "{key1}{key2}{key3}", can this be
> done with RefTeX?

You can run reftex-citation' with NO-INSERT argument.  Try this snippet
in a file of yours, it should do the trick:

(insert "\n" (mapconcat (lambda (key)
(format "{%s}" key))
(reftex-citation t)
""))

You can again mark the bib-items with m' and close with RET.

Best, Arash