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.

  • 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

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.