I am not sure it really fits the model of the exporters that are in org, since it is basically just a pre-processing hook. I don't think there are any exporters in org that rely on that, e.g. you can't just C-c C-e choose a backend and export with a pre-processing hook. It doesn't make sense to make a command that does that either I think, since you might want to use other pre-processing hooks too, e.g. I have one called natmove (inspired by the latex package) that moves superscript citations to the right hand side of punctuation, and in ox-ipynb I use pre-processing functions for removing solutions, and things like that. So some exports might use all three, and others only two, some just one, and others none. One solution for that is file-local variables I guess. 

It also is (IMO) a part of org-ref since it uses the links that are defined in org-ref. I see it as more an extension of org-mode than something that needs to be in the core. For simple cross-references the built in internal links are adequate I think.

Anyway, it should be tested for a while to see if it is the right way to do this. Maybe there are better ideas for it.


John

-----------------------------------
Professor John Kitchin (he/him/his)
Doherty Hall A207F
Department of Chemical Engineering
Carnegie Mellon University
Pittsburgh, PA 15213
412-268-7803


On Tue, Oct 12, 2021 at 5:58 PM Bruce D'Arcus <bdarcus@gmail.com> wrote:
On Tue, Oct 12, 2021 at 5:16 PM John Kitchin <jkitchin@andrew.cmu.edu> wrote:
>
> I think the existing link capability of org-mode is completely adequate for cross-references. LaTeX exports are almost completely covered in org-ref. I made a refproc (https://github.com/jkitchin/org-ref/blob/org-ref-3/org-ref-refproc.el) that provides similar export behavior for other backends in a pre-processing hook. It supports the concepts in autoref and cleveref by replacing the org-links with an appropriate org syntax that then exports natively. For example, if cref:name references a table, it would get replaced by "Table [[name]]" in the buffer and then exported to the desired backend.

Nice work John; I'm glad you were able to sort it out.

I haven't had a chance to play with it, but FYI I'm seeing a number of
compilation warnings (see below), which should be easy enough to fix.

Any reason this, or something like it, shouldn't be added to org?

Bruce

org-ref-refproc.el:15:1: Warning: defcustom for
    ‘org-ref-refproc-clever-prefixes’ fails to specify type
org-ref-refproc.el:15:1: Warning: defcustom for
    ‘org-ref-refproc-clever-prefixes’ fails to specify type

In org-ref-get-ref-links:
org-ref-refproc.el:47:54: Warning: reference to free variable
    ‘org-ref-ref-types’

In org-ref-refproc-referenceables:
org-ref-refproc.el:113:60: Warning: reference to free variable
    ‘org-ref-label-re’

In org-ref-refproc-cref-replacement:
org-ref-refproc.el:379:41: Warning: assignment to free variable ‘prefix-data’
org-ref-refproc.el:382:27: Warning: reference to free variable ‘prefix-data’

In end of data:
org-ref-refproc.el:244:7: Warning: the function ‘org-ref-ref-jump-to’ is not
    known to be defined.