Nicolas Goaziou <m...@nicolasgoaziou.fr> writes:

> Rasmus <ras...@gmx.us> writes:
>
>> Nicolas Goaziou <m...@nicolasgoaziou.fr> writes:
>>
>>> However, "tab:orgtable1" or "sec:orgheadline1" are fine, IMO, since
>>> "org" part can keep the label out of userland.
>>
>> That's fine with me as well.
>
> Fair enough. Do you want to take care of extending `org-latex--label'
> appropriately?

Can we have conditional dependence on texmathp?  If so, maybe something
like the attached, though the latex-environment part is ugly.

Results areq pretty ugly.  E.g. for headline, table, figure, latex-math
env, latex-env:

    \ref{sec:orgheadline1}, \ref{tab:orgtable1}, \ref{fig:orgparagraph1},
    \ref{eq:orglatexenvironment1}, \ref{orglatexenvironment2}

—Rasmus

-- 
Vote for proprietary math!
>From cc2c027ab611c3abcdc5c7cac46b6f45d682657f Mon Sep 17 00:00:00 2001
From: Rasmus <ras...@gmx.us>
Date: Mon, 20 Apr 2015 15:06:55 +0200
Subject: [PATCH] ox-latex: Use standard LaTeX label prefixes.

* ox-latex.el (org-latex--label): Use standard LaTeX prefixes.
---
 lisp/ox-latex.el | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/lisp/ox-latex.el b/lisp/ox-latex.el
index 2727f1c..075f4e4 100644
--- a/lisp/ox-latex.el
+++ b/lisp/ox-latex.el
@@ -1067,7 +1067,22 @@ Eventually, if FULL is non-nil, wrap label within \"\\label{}\"."
 	  (and (or user-label force)
 	       (if (and user-label (plist-get info :latex-prefer-user-labels))
 		   user-label
-		 (org-export-get-reference datum info)))))
+		 (concat (case type
+			   (headline "sec:")
+			   (table "tab:")
+			   (latex-environment
+			    (and (featurep 'texmathp)
+				 (with-temp-buffer
+				   (insert (org-element-property :value datum))
+				   (goto-char (point-min))
+				   (search-forward "}" nil t)
+				   (latex-mode)
+				   (texmathp))
+				 "eq:"))
+			   (paragraph
+			    (when (org-element-property :caption datum)
+			      "fig:")))
+			 (org-export-get-reference datum info))))))
     (cond ((not full) label)
 	  (label (format "\\label{%s}%s"
 			 label
-- 
2.3.5

Reply via email to