From mboxrd@z Thu Jan 1 00:00:00 1970 From: Rasmus Subject: Re: Target and link text normalised to `orgtargetn' Date: Thu, 16 Apr 2015 00:57:46 +0200 Message-ID: <87zj699ez9.fsf@gmx.us> References: <20150414092530.GC2957@chitra.no-ip.org> <20150414120852.GD2957@chitra.no-ip.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:54221) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YiWFu-0006SO-NH for emacs-orgmode@gnu.org; Wed, 15 Apr 2015 18:58:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YiWFr-0003Jn-GF for emacs-orgmode@gnu.org; Wed, 15 Apr 2015 18:58:02 -0400 Received: from plane.gmane.org ([80.91.229.3]:36656) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YiWFr-0003Jc-5c for emacs-orgmode@gnu.org; Wed, 15 Apr 2015 18:57:59 -0400 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1YiWFp-0000xo-AQ for emacs-orgmode@gnu.org; Thu, 16 Apr 2015 00:57:57 +0200 Received: from 46.166.188.244 ([46.166.188.244]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 16 Apr 2015 00:57:57 +0200 Received: from rasmus by 46.166.188.244 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 16 Apr 2015 00:57:57 +0200 List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org --=-=-= Content-Type: text/plain Hi, Could you try the attached patches and see if they solve your issues? Thanks, Rasmus -- C is for Cookie --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=0002-ox-Change-label-naming-scheme.patch >From 8951c689a7812d6557ba65888e549013814e5f8a Mon Sep 17 00:00:00 2001 From: Rasmus Date: Wed, 15 Apr 2015 21:50:53 +0200 Subject: [PATCH 2/2] ox: Change label naming scheme * ox.el (org-export-get-reference): Change labeling scheme. 160820bc94 and later changed the label naming scheme to follow types. This commit maps to types to more standard names, e.g. 'headline' to 'sec'. --- lisp/ox.el | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/lisp/ox.el b/lisp/ox.el index d6dcc82..f7d0ef5 100644 --- a/lisp/ox.el +++ b/lisp/ox.el @@ -4149,9 +4149,18 @@ alphanumeric characters only." h)))) (or (gethash datum cache) (puthash datum - (format "org%s%d" + (format "%s:%d" (if type - (replace-regexp-in-string "-" "" (symbol-name type)) + (case type + (headline "sec") + (paragraph + (if (org-element-property :caption datum) + "fig" "paragraph")) + (latex-environment "eq") + (table "tbl") + (otherwise + (replace-regexp-in-string "-" "" + (symbol-name type)))) "secondarystring") (incf (gethash type cache 0))) cache)))) -- 2.3.5 --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=0001-ox-latex-Wider-user-label-support.patch >From a01e6759a6a016fd4c684eaaa56544d8507c897f Mon Sep 17 00:00:00 2001 From: Rasmus Date: Wed, 15 Apr 2015 21:46:57 +0200 Subject: [PATCH 1/2] ox-latex: Wider user-label support * ox-latex.el (org-latex--label): Add user-labels for targets and radio-target. (org-latex--wrap-label, org-latex-link, org-latex-target) (org-latex-radio-target): Use org-latex--label. --- lisp/ox-latex.el | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/lisp/ox-latex.el b/lisp/ox-latex.el index 61d16b1..b22b0a7 100644 --- a/lisp/ox-latex.el +++ b/lisp/ox-latex.el @@ -1056,9 +1056,10 @@ return a unique label. Eventually, if FULL is non-nil, wrap label within \"\\label{}\"." (let* ((user-label (org-element-property - (if (memq (org-element-type element) '(headline inlinetask)) - :CUSTOM_ID - :name) + (case (org-element-type element) + ((headline inlinetask) :CUSTOM_ID) + ((target radio-target) :value) + (otherwise :name)) element)) (label (and (or user-label force) @@ -1176,7 +1177,7 @@ should not be used for floats. See (if (not (and (org-string-nw-p output) (org-element-property :name element))) output (concat (format "\\phantomsection\n\\label{%s}\n" - (org-export-get-reference element info)) + (org-latex--label element info)) output))) (defun org-latex--text-markup (text markup info) @@ -2088,7 +2089,7 @@ INFO is a plist holding contextual information. See (let ((destination (org-export-resolve-radio-link link info))) (if (not destination) desc (format "\\hyperref[%s]{%s}" - (org-export-get-reference destination info) + (org-latex--label destination info) desc)))) ;; Links pointing to a headline: Find destination and build ;; appropriate referencing command. @@ -2416,7 +2417,7 @@ holding contextual information." "Transcode a RADIO-TARGET object from Org to LaTeX. TEXT is the text of the target. INFO is a plist holding contextual information." - (format "\\label{%s}%s" (org-export-get-reference radio-target info) text)) + (format "\\label{%s}%s" (org-latex--label radio-target info) text)) ;;;; Section @@ -3029,7 +3030,7 @@ a communication channel." "Transcode a TARGET object from Org to LaTeX. CONTENTS is nil. INFO is a plist holding contextual information." - (format "\\label{%s}" (org-export-get-reference target info))) + (format "\\label{%s}" (org-latex--label target info))) ;;;; Timestamp -- 2.3.5 --=-=-=--