5

RefTeX doesn't support Org #+LABEL: syntax by default, but can it be customized to do so? For example, if I have #+LABEL: foo, I'd like to be able to insert a reference to that label using RefTeX.

I've been browsing the customize options, and it appears like it may be possible to set some preferences and gain better Org support. I've played around with the following:

(setq reftex-try-all-extensions)
(setq reftex-file-extensions
       '(("org" "nw" "tex" ".tex" ".ltx") ("bib" ".bib")))
(setq TeX-file-extensions
       '( "org" "nw" "tex" "sty" "cls" "ltx" "texi" "texinfo"))

And then found

(setq reftex-label-regexps 
           '("\\\\label{\\(?1:[^}]*\\)}"
             "\\[[^]]*\\<label[[:space:]]*=[[:space:]]*{?\\(?1:[^],}]+\\)}?"))

To which I tried adding the regexp:

"\\\#\\\+LABEL:\\(?1:*\\)"

But have had no success. It seems like reftex-label-alist may also be needed.

mankoff
  • 4,108
  • 1
  • 22
  • 39
  • 1
    Perhaps it would be helpful if you included a short snippet of TeX/Org markup that shows what sort of file you want this syntax to work with. – Joe Corneli May 29 '15 at 19:31

1 Answers1

1

org-ref (https://github.com/jkitchin/org-ref) handles this nicely in org-mode, and it recognizes \label, #+label, label: #+tblname, and more that can be used as a ref in LaTeX.

org-ref uses helm and helm-bibtex as completion tools by default, but it is possible to use reftex too.

John Kitchin
  • 11,555
  • 1
  • 19
  • 41