emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] Target and link text normalised to `orgtargetn'


From: Rasmus
Subject: Re: [O] Target and link text normalised to `orgtargetn'
Date: Mon, 20 Apr 2015 15:13:10 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux)

Nicolas Goaziou <address@hidden> writes:

> Rasmus <address@hidden> writes:
>
>> Nicolas Goaziou <address@hidden> 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 <address@hidden>
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

[Prev in Thread] Current Thread [Next in Thread]