bdarcus/oxr

equations and multiple documents

Closed this issue · 10 comments

fab6 commented

Hi,
I just was pointed to your package :-)
It seems that it does not work for equations yet, is it planned to include? E.g. I have a latex equation like

\begin{equation}
\label{eqn:strange-equation}
a = \frac{10}{10} \omega_{\r{10}} + \ch{10} +\SI{01}{\m}
\end{equation}

And are there any plannings that it works across multiple org files? This would be great!
Best
Fab

Not sure.

As I don't use math, what does the full org source for that example look like?

Is it inside an org block?

fab6 commented

Thanks! I know these three variants

* Equations
\begin{equation}
\label{eqn:strange-equation}
a = \frac{10}{10} \omega_{\r{10}} + \ch{10} +\SI{01}{\m}
\end{equation}

#+NAME: eqn:1
\begin{equation}
    f(x) =  \sum\limits_0^\infty(f^{(n)}(x)|_{x=0} \cdot x)
\end{equation}

#+BEGIN_EXPORT latex
\begin{equation}
\label{eqn:strange-equation2}
a = \frac{10}{10} \omega_{\r{10}} + \ch{10} +\SI{01}{\m}
\end{equation}
#+END_EXPORT

The label can be obviously without the : as well. Does this already help?
I assume the multi document would be much harder!?

EDIT: here's how org parses your examples:

  (section
   (:begin 248 :end 676 :contents-begin 248 :contents-end 676 :robust-begin 248 :robust-end 674 :post-blank 0 :post-affiliated 248 :mode section :granularity nil :parent #1)
   (latex-environment
    (:begin 248 :end 367 :value "\\begin{equation}\n\\label{eqn:strange-equation}\na = \\frac{10}{10} \\omega_{\\r{10}} + \\ch{10} +\\SI{01}{\\m}\n\\end{equation}\n" :post-blank 1 :post-affiliated 248 :mode planning :granularity nil :parent #2))
   (latex-environment
    (:begin 367 :end 474 :value "\\begin{equation}\n    f(x) =  \\sum\\limits_0^\\infty(f^{(n)}(x)|_{x=0} \\cdot x)\n\\end{equation}\n" :post-blank 1 :post-affiliated 381 :name "eqn:1" :mode nil :granularity nil :parent #2))
   (export-block
    (:type "LATEX" :begin 474 :end 629 :value "\\begin{equation}\n\\label{eqn:strange-equation2}\na = \\frac{10}{10} \\omega_{\\r{10}} + \\ch{10} +\\SI{01}{\\m}\n\\end{equation}\n" :post-blank 2 :post-affiliated 474 :mode nil :granularity nil :parent #2))

Looks like the second one is not too bad, as the target could be the :name property.

What would be a reasonable annotation preview? The actual latex :value? A caption?

WDYM by "multi document"? How would that work from a UX POV?

cc @tecosaur

After playing a bit, this should be easy enough to handle, where the caption would be the annotation.

#+name: eqn:1
#+caption: a caption
\begin{equation}
    f(x) =  \sum\limits_0^\infty(f^{(n)}(x)|_{x=0} \cdot x)
\end{equation}

... parses as:

   (latex-environment
    (:begin 384 :end 512 :value "\\begin{equation}\n    f(x) =  \\sum\\limits_0^\\infty(f^{(n)}(x)|_{x=0} \\cdot x)\n\\end{equation}\n" :post-blank 1 :post-affiliated 419 :name "eqn:1" :caption
            (((#("a caption" 0 9
                 (:parent #7)))))
            :mode nil :granularity nil :parent #2))

See #4 for some code.

WDYM by "multi document"? How would that work from a UX POV?

I closed this issue, but if you can add to this to a new issue I can look into it.

Like, would it just be all open org buffers?

And if you select a target from another buffer, then what?

Or would it be one or more global files?

And same question about what it would after selecting.

WDYM by "multi document"? How would that work from a UX POV?

I'd think this would mean resolving #+include statements, but I'm not the OP.

fab6 commented

Hi,
thanks, I will try it... about the multi-document.
Yes, e.g. I have a main dockument and the chapters in a subfolder
image
image
And within the text directory one could have something like:
image
So, no I would not say that all open org files is the best approach (usually I have plenty of org files open, which are not relevant for the document).

There could be a few other options:

  1. one needs to define a main-org-file (which would be the one with the includes above), but I am not sure if the includes are recognized.
  2. The kind of (recursive) grepping takes place in all org-files in the current directory of the current file (this would work with the setup above).
  3. one defines a directory where the kind of grepping taks place

Thank you very much!

Include support added via #6.

fab6 commented

thank you