Hi Alan,
2014ko maiatzak 16an, Alan L Tyree-ek idatzi zuen:
G'day,
My org manuscript has cross references like this: see
[[id:4c473c51-b484-4a29-8fe7-118d8084a6f8][Limitations Acts]]
Exporting to LaTeX currently gives me: see
\hyperref[sec-4-3]{Limitations Acts}
What I would like is: \ref{sec-4-3} since I am trying to end up with a
Word file for an editor that will be (ultimately) a printed book.
I'm sure this is a simple variable somewhere, but I'm frustrated trying
to find it.
I think you have two choices. The first is to remove the description
from the link, leaving just:
[[id:4c473c51-b484-4a29-8fe7-118d8084a6f8]]
Sadly, this is not very informative to look at.
The other is to use an export filter like the following to convert the
exporter’s output to the desired format:
#+BEGIN_SRC emacs-lisp
(defun awe-org-latex-filter-section-links (string backend plist)
(if (and (org-export-derived-backend-p backend 'latex)
(string-match "\\\\hyperref\\[\\(sec-.*?\\)\\]" string))
(let ((end-space (if (string-match-p " \\'" string) " " "")))
(concat (format "\\ref{%s}" (match-string 1 string))
end-space))
string))
(add-to-list 'org-export-filter-link-functions
#'awe-org-latex-filter-section-links)
#+END_SRC
Hope this helps,