auctex
[Top][All Lists]
Advanced

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

Re: [AUCTeX] Insert tilde before cite macro


From: Jim Burton
Subject: Re: [AUCTeX] Insert tilde before cite macro
Date: Tue, 30 Mar 2010 20:34:54 +0100
User-agent: Wanderlust/2.15.9 (Almost Unreal) SEMI/1.14.6 (Maruoka) FLIM/1.14.9 (Gojō) APEL/10.7 Emacs/23.1 (i686-pc-linux-gnu) MULE/6.0 (HANACHIRUSATO)

At Tue, 30 Mar 2010 18:45:06 +0200,
Ralf Angeli wrote:
> 
> * Jim Burton (2010-03-30) writes:
> 
> > Hi, I am using Gnu Emacs 23.1.1, AUCTeX 11.86-1 and have set
> > reftex-plug-into-AUCTeX. When I insert a \ref macro I get a tilde
> > before it. How do I get this behaviour with \cite too?
> 
> For citations, AFAICS there is no automatism which checks if there is a
> blank before the current cursor position or not and adds a tilde in the
> latter case.  But you could define your own citation style which
> provides both a variant with and a variant without the tilde.  See
> (info "(reftex)Citation Styles") and
> (info "(reftex)Options (Creating Citations)") for information about
> citation styles and their customization.
>

Thanks Ralf, very helpful. Here's what I came up with, which seems to
work:

(setq reftex-format-cite-function 
      '(lambda (key fmt)
         (let ((cite (replace-regexp-in-string "%l" key fmt)))
           (if (or (= ?~ (string-to-char fmt))
                   (member (preceding-char) '(?\ ?\t ?\n ?~)))
               cite
             (concat "~" cite)))))

 
Regards,

Jim
 
> -- 
> Ralf
-- 
J Burton

reply via email to

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