auctex-devel
[Top][All Lists]
Advanced

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

Re: [AUCTeX-devel] User-customizable RefTeX citations


From: Antoine Levitt
Subject: Re: [AUCTeX-devel] User-customizable RefTeX citations
Date: Wed, 10 Oct 2012 09:55:36 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2.50 (gnu/linux)

10/10/2012 09:33, Tassilo Horn
> Here's a function that given a key and a field name returns the value of
> that entry's field.
>
> (defun th-reftex-get-data (key data)
>   (let* ((files (reftex-get-bibfile-list))
>        (entry (condition-case nil
>                   (save-excursion
>                     (reftex-pop-to-bibtex-entry key files nil nil nil t))
>                 (error
>                  (if files
>                      (message "cite: no such database entry: %s" key)
>                    (message "%s" (substitute-command-keys
>                                   (format reftex-no-info-message "cite"))))
>                  nil))))
>     (when entry
>       (cdr (assoc data (reftex-parse-bibtex-entry entry))))))
>
> You could use it to define a command to find the pdf in emacs (which
> would open doc-view).
>
> (defun th-reftex-open-file ()
>   (interactive)
>   (let ((file (th-reftex-get-data (current-word) "file")))
>     (when file
>       (let ((name (concat "/" (save-match-data
>                               (string-match ":\\(.*\\):pdf" file)
>                               (match-string 1 file)))))
>       (find-file name)))))
>
> Simply place point in the \cite{...} and do M-x th-reftex-open-file.
>
> Bye,
> Tassilo

Nice, thanks!




reply via email to

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