Closed Nidish96 closed 8 months ago
what does not work mean here? It looks like it works for me:
Thanks for the response!
I'm sorry for not being clear. I agree, it works as a consistent link within org, but when i export it either to latex or html, it just says nil [[]]
in both cases.
Here's a screenshot from my actual use case (top is org, bottom is tex):
that doesn't look right, that is almost impossible if org-ref is working right. If you put your cursor on one of the ref links and type: M-x describe-text-properties
what do you see?
also, what is the output of this src block:
(org-link-get-parameter "cref" :export)
finally, what is the output of M-x org-ref-debug
Thanks for the quick reply again!
Text content at position 5575:
There are text properties here: face org-ref-ref-face font-lock-multiline t fontified t help-echo org-ref-ref-help-echo htmlize-link (:uri "cref:eq1") isearch-open-invisible org-fold-core--isearch-show isearch-open-invisible-temporary org-fold-core--isearch-show-temporary keymap [Show] line-prefix [Show] mouse-face highlight org-fold--spec-org-link-description-global org-link-description org-fold--spec-org-link-global org-link org-ref-ref-label "eq1" rear-nonsticky [Show] wrap-prefix [Show]
2. Here's the result of the src block:
```org
#+begin_src emacs-lisp
(org-link-get-parameter "cref" :export)
#+end_src
#+RESULTS:
: #[128 "\302\301\303\300\"\"\207" [("cref") org-ref-ref-export apply append] 6 "
:
: (fn &rest ARGS2)"]
#+TITLE: org-ref debug
org-ref: Version 3.0
System
system-type :: System: gnu/linux
system-configuration :: x86_64-pc-linux-gnu
window system :: Window system: x
Emacs :: GNU Emacs 29.1 (build 2, x86_64-pc-linux-gnu, GTK+ Version 3.24.37, cairo version 1.16.0) of 2023-07-24
org-version :: 9.6.6
about org-ref
org-ref installed in [[/home/nidish/.emacs.d/elpa/org-ref-20231027.1224/org-ref.elc]].
org-ref setup
org-ref-insert-link-function :: org-ref-insert-link
org-ref-insert-cite-function :: (closure (t) nil (org-cite-insert nil))
org-ref-insert-label-function :: org-ref-insert-label-link
org-ref-insert-ref-function :: org-ref-insert-ref-link
org-ref-cite-onclick-function :: (closure (t) (_) (org-ref-citation-hydra/body))
org-ref libraries
org-ref-helm (loaded: t) org-ref-ivy (loaded: nil) ** org-ref-pdf (loaded: nil)
You set =pdftotext-executable= to org-ref-pdf not loaded (exists: pdftotext-executable is not bound)
** org-ref-url-utils (loaded: nil)
export variables
org-latex-pdf-process :: ("latexmk -shell-escape -bibtex -f -pdf %f")
weird, those all look right. do you have any org export processing hooks setup?
(list org-export-before-parsing-hook org-export-before-processing-hook)
also, how are you doing your export to html/latex? The usual C-c C-e ho/lo?
Here's what I get:
#+BEGIN_SRC emacs-lisp
(list org-export-before-parsing-hook
org-export-before-processing-hook)
#+END_SRC
#+RESULTS:
| org-ref-refproc | org--support-special-blocks-with-args | org-re-reveal-prepare-tts | org-attach-expand-links |
Yeah - I'm just exporting with C-c C-e ho/lo .
Here's a minimal org document which doesn't export properly:
#+title: Minimalex
#+author: Nidish Narayanaa Balaji
#+date: <2023-10-25 Wed>
#+refproc: :abbreviate t
#+latex_class_options: [12pt]
#+bibliography: refs.bib
#+options: h:3 num:t toc:nil
#+latex_header: \usepackage[margin=0.5in]{geometry}
#+latex_header: \usepackage{cancel}
#+latex_header: \usepackage{cleveref}
* Section 1
1. I expect [[cref:eq1]] to work properly.
#+name: eq1
\begin{equation}
x^2+y^2=z
\end{equation}
2. I don't expect either [[cref:eq1a]] or [[cref:eq2a]] to work.
\begin{align}
x^2+y^2&=z\label{eq1a}\\
x^2-y^2&=3\label{eq2a}
\end{align}
Here's what the output pdf looks like:
I see what is happening. For latex, you don't need org-ref-refproc. That is what doesn't work for the second example. This function org-ref-refproc-referenceables
doesn't currently support array equations. This will be tricky to support, right now it is assumed there is only one label per environment. I will have to think of a way to do that.
Ahh snap. Thanks for looking into it anyways, I hope you figure this out! :)
Maybe support for subequations would be a nice intermediate step? See the example below, where using native org link works but using the org-ref version doesn't (in export).
#+title: Minimalex
#+author: Nidish Narayanaa Balaji
#+date: <2023-10-25 Wed>
#+refproc: :abbreviate t
#+latex_class_options: [12pt]
#+bibliography: refs.bib
#+options: h:3 num:t toc:nil
#+latex_header: \usepackage[margin=0.5in]{geometry}
#+latex_header: \usepackage{cancel}
#+latex_header: \usepackage{amsmath}
#+latex_header: \usepackage{cleveref}
* Section 1
1. I expect [[cref:eq1]] to work properly.
#+name: eq1
\begin{equation}
x^2+y^2=z
\end{equation}
2. I don't expect either [[cref:eq1a]] or [[cref:eq2a]] to work.
#+name: eqname
\begin{subequations}
\begin{align}
x^2+y^2&=z\label{eq1a}\\
x^2-y^2&=3\label{eq2a}
\end{align}
\end{subequations}
3. [[cref:eqname]] also doesnt work, but [[eqname]] works.
These all work for pure latex export (just remove org-ref-refproc from the hook).
I pushed a fix for the first example. The second one I think won't work in mathjax for html, but now the first one does. you do need to (setq org-html-prefer-user-labels t)
first.
Thanks! I just tried the following and it works. It doesn't detect labels, however.
#+title: Minimalex
#+author: Nidish Narayanaa Balaji
#+date: <2023-10-25 Wed>
#+refproc: :abbreviate t
#+latex_class_options: [12pt]
#+bibliography: refs.bib
#+options: h:3 num:t toc:nil
#+latex_header: \usepackage[margin=0.5in]{geometry}
#+latex_header: \usepackage{cancel}
#+latex_header: \usepackage{amsmath}
#+latex_header: \usepackage{cleveref}
* Section 1
1. I expect [[cref:eq1]] to work properly.
#+name: eq1
\begin{equation}
x^2+y^2=z
\end{equation}
2. [[cref:eqname]] works in latex export, but =[[cref:eq1a]]= doesn't (give error: =unable to resolve "nil"=).
In HTML export, the subequations environment is not detected. This is not an org-ref issue.
#+name: eqname
\begin{subequations}
\begin{align}
x^2+y^2&=z\label{eq1a}\\
x^2-y^2&=3\label{eq2a}
\end{align}
\end{subequations}
3. [[cref:new]] works.
#+name: new
\begin{align}
x^2+y^2&=z\\
x^2-y^2&=2\label{bab}
\end{align}
You are still mixing things that work and don't work. If you add this to your org file and use it to build a pdf, everything should work:
* build :noexport:
#+BEGIN_SRC emacs-lisp :exports none
(let ((org-export-before-parsing-hook nil))
(org-open-file (org-latex-export-to-pdf)))
#+END_SRC
It is a mistake for making html to combine #+name and internal labels. Only the name reference will be found in that case. this snippet:
3. [[cref:new]] works. and cref:bab does too.
\begin{align}
x^2+y^2&=z\label{new}\\
x^2-y^2&=2\label{bab}
\end{align}
* build :noexport:
HTML build
#+BEGIN_SRC emacs-lisp :exports none
(let ((org-html-prefer-user-labels t)
(org-export-before-parsing-hook '(org-ref-refproc)))
(org-open-file (org-html-export-to-html)))
#+END_SRC
seems to work.
Great, thank you! The fix works perfectly now :)
Firstly thanks for a great package, I recently started using it and I'm loving it!
I've used it with equations of the form,
and I can refer to it using [[cref:neweq]] and everything work. However, if I have a multi-line equation that I've typeset using the align environment, it doesn't work. I'll appreciate any assistance, thanks!
Here's an example of something that doesn't work
Thanks! Nidish