When using emacs+reftex-mode I may hit "C-c [
" and get a nice citation search menu for \cite
command. Is there a way to get the same menu for csquotes
' integrated quotations (e.g. \displaycquote
)?
-
The point of reftex's interactive cite feature is to help you get the bibliography key right. I don't understand how csquotes would benefit from the same feature...– SeamusCommented Jan 11, 2011 at 22:21
-
3Csquotes offers a couple of commands and environments which allow to specify a citation key for a quotation (e.g. "displaycquote" environment). I'd like to use interactive cite when inserting such quotations.– Alexey B.Commented Jan 12, 2011 at 1:16
1 Answer
The simplest way would probably be to add to your .emacs configuration the following (for the \textquote
macro):
(TeX-add-symbols
'("textquote" [ TeX-arg-cite ] [ "Punctuation" ] t)
)
(see AUCTeX adding Macros doc)
TeX-arg-cite
should call the RefTeX citation search. It seems to behave oddly, as even if it's defined as an optional argument, it forces you to choose a citation.
The is also a way to add environment, so
(LaTeX-add-environments
`("displayquote" LaTeX-env-args
[TeX-arg-cite [ "Punctuation" ] t]))
should define the displayquote
environment according to the documentation, but for some reasons, that doesn't work for me.
As explained in the documentation, it would be cleaner to do this in a style hook to define the commands only for buffers that actually use the csquotes package:
(TeX-add-style-hook
"csquotes"
(lambda ()
(TeX-add-symbols
'("textquote" [ TeX-arg-cite ] [ "Punctuation" ] t)
)
(LaTeX-add-environments
`("displayquote" LaTeX-env-args
[TeX-arg-cite [ "Punctuation" ] t])
)
)
)
However, you should check that you do not override some AUCTeX default when doing this.
The not so clean way of doing it would be to hack a new cite format for the quotation by specifying a new reftex-cite-format, but that seems quite ugly to me.