Skip to content

Latest commit

 

History

History
245 lines (178 loc) · 4.76 KB

refproc.org

File metadata and controls

245 lines (178 loc) · 4.76 KB

Pretty thorough example of refproc

Introduction

This document is a set of examples to see how the org-ref cross-reference processor works. Go to *build to run the preprocessor and do the exports.

section references

ref
ref:sec-intro
autoref
autoref:sec-intro
nameref
nameref:sec-intro
pageref
pageref:sec-intro
cref, one
cref:sec-intro
cref, two
cref:sec-intro,sec-headings
cref, three, sorted
cref:sec-tables,sec-intro,sec-headings
Cref
Cref:sec-intro
Cref, two
Cref:sec-intro,sec-headings
Cref, three, sorted
Cref:sec-tables,sec-intro,sec-headings

tables refs

34
34
ref
ref:b1
autoref
autoref:b1
nameref
nameref:b1
pageref
pageref:b1
cref
cref:b1
cref, two
cref:b1,b2
Cref
Cref:b1
Cref, two
Cref:b1,b2

equations

\begin{equation} 3+3=6 \end{equation}

\begin{equation} 3+3=6 \end{equation}

This equation will have a number in the ODT export.

\begin{equation} 3+3=6 \end{equation}

eqref
eqref:q1
autoref
autoref:q1
cref
cref:q1,q2
Cref
Cref:q1,q2

Listings

%matplotlib inline
import matplotlib.pyplot as plt

plt.plot([1, 2, 4])
%matplotlib inline
import matplotlib.pyplot as plt

plt.plot([1, 2, 4])
%matplotlib inline
import matplotlib.pyplot as plt

plt.plot([1, 2, 4])
%matplotlib inline
import matplotlib.pyplot as plt

plt.plot([1, 2, 4])
ref
ref:s1
autoref
autoref:s1
nameref
nameref:s1
cref
cref:s1
cref, 2
cref:s1,s2 listings 1 and 2
cref, 2, sorted
cref:s2,s1 listings 1 and 2, cref does sorting!
cref, 3
cref:s1,s3,s4 listings 1, 3 and 4
cref, 4
cref:s1,s2,s3,s4 listings 1 to 4 (this seems too clever! you would have to be able to tell they were sequential.)
Cref
Cref:s1
Cref
Cref:s1,s2

figures

./.ob-jupyter/46ed61e65bf11890f8772850057bb35847f984b8.png

./.ob-jupyter/46ed61e65bf11890f8772850057bb35847f984b8.png

ref
ref:g1
nameref
nameref:g1
pageref
pageref:g1
autoref
autoref:g1
cref
cref:g1
cref,2
cref:g1,g2
Cref
Cref:g1
Cref
Cref:g1,g2

Mixed cref

  • cref:b1,sec-intro,s1,g1,b2,s2,s4,s3
  • Cref:b1,sec-intro,s1,g1,b2,s2,s4,s3
  • cref:sec-intro,s1,g1,b2,s2,s4,s3,b1
  • Cref:sec-intro,s1,g1,b2,s2,s4,s3,b1

math environments

Lemmas

see cref:lm-1.

Corollary

cref:co-1

theorem

Margin note cref:thm-1

build

HTML

(require 'org-ref-refproc) ;; this is not loaded by default!

(let ((org-export-before-parsing-hook '(org-ref-refproc)))
  (org-open-file (org-html-export-to-html)))

To an org buffer

(let ((org-export-before-parsing-hook '(org-ref-refproc)))
   (org-org-export-as-org))

To ODT

See https://orgmode.org/manual/LaTeX-math-snippets.html for details about the equations. You need these options. I didn’t get the latexml approach to work described there, but this worked somewhat ok.

(let ((org-export-before-parsing-hook '(org-ref-refproc)))
  (org-open-file (org-odt-export-to-odt) 'system))

LaTeX

It isn’t clear why you would go this route, since org-ref is for LaTeX in the first place, but this does work nicely.

(let ((org-export-before-parsing-hook '(org-ref-refproc)))
  (org-open-file (org-babel-latex-tex-to-pdf (org-latex-export-to-latex))))