emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Rasmus <rasmus@gmx.us>
To: emacs-orgmode@gnu.org
Subject: Re: Target and link text normalised to `orgtargetn'
Date: Thu, 16 Apr 2015 00:57:46 +0200	[thread overview]
Message-ID: <87zj699ez9.fsf@gmx.us> (raw)
In-Reply-To: 20150414120852.GD2957@chitra.no-ip.org

[-- Attachment #1: Type: text/plain, Size: 112 bytes --]

Hi,

Could you try the attached patches and see if they solve your issues?

Thanks,
Rasmus

-- 
C is for Cookie

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0002-ox-Change-label-naming-scheme.patch --]
[-- Type: text/x-diff, Size: 1205 bytes --]

From 8951c689a7812d6557ba65888e549013814e5f8a Mon Sep 17 00:00:00 2001
From: Rasmus <rasmus@gmx.us>
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


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #3: 0001-ox-latex-Wider-user-label-support.patch --]
[-- Type: text/x-diff, Size: 2528 bytes --]

From a01e6759a6a016fd4c684eaaa56544d8507c897f Mon Sep 17 00:00:00 2001
From: Rasmus <rasmus@gmx.us>
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


  parent reply	other threads:[~2015-04-15 22:58 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-14  9:25 Target and link text normalised to `orgtargetn' Suvayu Ali
2015-04-14 12:08 ` Suvayu Ali
2015-04-14 12:59   ` Rasmus
2015-04-14 13:37     ` Andreas Leha
2015-04-15 22:57   ` Rasmus [this message]
2015-04-16  0:18     ` Suvayu Ali
2015-04-16 10:11       ` Rasmus
2015-04-18 21:53         ` Nicolas Goaziou
2015-04-19 12:13           ` Suvayu Ali
2015-04-19 12:57             ` Nicolas Goaziou
2015-04-19 13:24               ` Suvayu Ali
2015-04-19 13:40                 ` Nicolas Goaziou
2015-04-19 13:49                   ` Suvayu Ali
2015-04-19 13:56                     ` Nicolas Goaziou
2015-04-19 14:06                       ` Suvayu Ali
2015-04-19 14:02               ` Rasmus
2015-04-19 14:36                 ` Nicolas Goaziou
2015-04-19 14:55                   ` Rasmus
2015-04-19 15:17                     ` Nicolas Goaziou
2015-04-19 17:16                       ` Rasmus
2015-04-19 18:36                         ` Nicolas Goaziou
2015-04-20  8:55                           ` Rasmus
2015-04-20  9:09                             ` Nicolas Goaziou
2015-04-20  9:25                               ` Rasmus
2015-04-20  9:58                                 ` Nicolas Goaziou
2015-04-20 10:02                                   ` Rasmus
2015-04-20 10:33                                     ` Nicolas Goaziou
2015-04-20 13:13                                       ` Rasmus
2015-04-20 15:35                                         ` Nicolas Goaziou
2015-04-20 20:11                                           ` Rasmus
2015-04-20 21:03                                             ` Nicolas Goaziou
2015-04-24 13:35                                               ` Rasmus
2015-04-24 19:42                                                 ` Nicolas Goaziou
2015-04-27 22:08                                                   ` Rasmus
2015-04-27 22:15                                                     ` Nicolas Goaziou

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87zj699ez9.fsf@gmx.us \
    --to=rasmus@gmx.us \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).