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.35k stars 242 forks source link

Export to non-LaTeX formats does not honor labels set with #+name: #1115

Open drghirlanda opened 1 month ago

drghirlanda commented 1 month ago

For example:

\begin{equation}
  \label{eq:x}
   x = 1
\end{equation}

cref:eq:x

Exports correctly to markdown, but:

#+name: eq:x
\begin{equation}
   x = 1
\end{equation}

cref:eq:x

exports with a mix of org-generated labels and user-specified labels, which breaks cross-referencing:

\begin{equation}
  \label{orgf29908c}
  x = 1
\end{equation}

equation \ref{eq:x}
jkitchin commented 1 month ago

Can you check what the value of org-latex-prefer-user-labels is set to? Mine is set to t, and I don't have the issue you describe.

drghirlanda commented 1 month ago

I have tried with both settings, it makes no difference over here. I have org 9.6.30 and org-ref 3.0. I have tried exporting to markdown, html, and Rmarkdown (via ox-ravel), and also to markdown via the org-ref exporter. Let me know what I can do to narrow this down.

On Thu, May 16, 2024 at 10:51 AM John Kitchin @.***> wrote:

Can you check what the value of org-latex-prefer-user-labels is set to? Mine is set to t, and I don't have the issue you describe.

— Reply to this email directly, view it on GitHub https://github.com/jkitchin/org-ref/issues/1115#issuecomment-2115859625, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABH7EPBUNDNPPFJUJIIVGIDZCTWYXAVCNFSM6AAAAABH2PM27OVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCMJVHA2TSNRSGU . You are receiving this because you authored the thread.Message ID: @.***>

-- Stefano Ghirlanda CTO, DataWorks - https://dataworks.consulting Guest Professor - Stockholm University Centre for Cultural Evolution

jkitchin commented 1 month ago

I see, Probably this is an org-mode issue. org-latex-prefer-user-labels is for latex backends, and there is one for html. I don't think there is a setting for other formats. The issue is with export of the LaTeX fragment. You might be able to fix it with some custom export code, but I would consider raising on the org mailing list. There should be one variable imo called something like org-export-prefer-user-labels that affects all backends.

drghirlanda commented 1 month ago

Got it! I will report if I get any intel from the org mailing list.

jkitchin commented 1 month ago

If you set (setq org-html-prefer-user-labels t) then it does the right thing for markdown too.

drghirlanda commented 1 month ago

That's great to know, thanks! I confirm it works for me, too. But I think this is a consistency issue for org, because one should get a working set of labels and references whether these settings are enabled or not...

On Thu, May 16, 2024 at 12:00 PM John Kitchin @.***> wrote:

If you set (setq org-html-prefer-user-labels t) then it does the right thing for markdown too.

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

-- Stefano Ghirlanda CTO, DataWorks - https://dataworks.consulting Guest Professor - Stockholm University Centre for Cultural Evolution