jkitchin / org-ref

org-mode modules for citations, cross-references, bibliographies in org-mode and useful bibtex tools to go with it.
GNU General Public License v3.0
1.36k stars 243 forks source link

org-ref in source blocks #1071

Open drghirlanda opened 1 year ago

drghirlanda commented 1 year ago

Would it be possible to have org-ref and org-ref-refproc resolve references in source blocks? Right now, I can use something like \cref{eq:alice} inside a source block and it works nicely when exporting to LaTeX (when using the listings package). It would be great to be able to use cref:eq:alice because then one could also use org-ref-refproc to export to other formats.

jkitchin commented 1 year ago

Can you provide an example of what you are doing and what you would like?

My guess is probably not. I don't think links are recognized by org-mode when they are in src blocks. you would have to do some preprocessing of your own to handle those I think, probably using regular expressions to find them.

drghirlanda commented 1 year ago

Thanks! I actually found out that this is a feature of the listings LaTeX package: it allows LaTeX code in comments, so that things like \cref, and \ref are resolved. I'll see if I can figure something out to do this in org-ref. If anything comes up, I'll let you know.

On Sat, Mar 25, 2023 at 12:49 PM John Kitchin @.***> wrote:

Can you provide an example of what you are doing and what you would like?

My guess is probably not. I don't think links are recognized by org-mode when they are in src blocks. you would have to do some preprocessing of your own to handle those I think, probably using regular expressions to find them.

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

-- Stefano Ghirlanda - www.intercult.su.se/~stefano - drghirlanda.com Full Professor of Psychology, Biology, and Anthropology, Brooklyn College Guest Professor, Stockholm University Centre for the Study of Cultural Evolution