* suppress \label{} in LaTeX export
@ 2009-10-01 20:12 Eric Schulte
2009-10-01 20:32 ` Nick Dokos
0 siblings, 1 reply; 4+ messages in thread
From: Eric Schulte @ 2009-10-01 20:12 UTC (permalink / raw)
To: Org Mode
Hi,
Is it possible to suppress the \label{sec-1} lines following each
headline after a LaTeX export? I've found no mention of this in the
manual, and the presence of headline labels is breaking my Beamer TOC.
Thanks -- Eric
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: suppress \label{} in LaTeX export
2009-10-01 20:12 suppress \label{} in LaTeX export Eric Schulte
@ 2009-10-01 20:32 ` Nick Dokos
2009-10-01 22:48 ` Eric Schulte
0 siblings, 1 reply; 4+ messages in thread
From: Nick Dokos @ 2009-10-01 20:32 UTC (permalink / raw)
To: Eric Schulte; +Cc: Org Mode
Eric Schulte <schulte.eric@gmail.com> wrote:
> Is it possible to suppress the \label{sec-1} lines following each
> headline after a LaTeX export? I've found no mention of this in the
> manual, and the presence of headline labels is breaking my Beamer TOC.
>
I don't think so: they seem to be inextricably bound with headings. The
code in org-latex.el says:
(let* (...
(label (org-get-text-property-any 0 'target heading))
...)
and then
...
(when label
(insert (mapconcat (lambda (l) (format "\\label{%s}" l))
label-list "\n") "\n"))
...
I recall having problems with labels (among other things) in combination
with beamer before (I "solved" the problem by running the tex file
through a script to just get rid of them), but I don't remember what the
problem was. Maybe it's time to go back and look at the thing again.
Nick
PS. Here is a quick-n-dirty patch to disable them - ymmv, uayor and several
other cya disclaimers :-)
diff --git a/lisp/org-latex.el b/lisp/org-latex.el
index 248d653..f5099f7 100644
--- a/lisp/org-latex.el
+++ b/lisp/org-latex.el
@@ -852,6 +852,8 @@ and its content."
(let ((num (plist-get org-export-latex-options-plist :section-numbers)))
(mapc (lambda(x) (org-export-latex-subcontent x num)) subcontent)))
+(defvar org-export-latex-labels-enabled nil)
+
(defun org-export-latex-subcontent (subcontent num)
"Export each cell of SUBCONTENT to LaTeX.
If NUM, export sections as numerical sections."
@@ -862,7 +864,7 @@ If NUM, export sections as numerical sections."
(occur (number-to-string (cdr (assoc 'occur subcontent))))
(content (cdr (assoc 'content subcontent)))
(subcontent (cadr (assoc 'subcontent subcontent)))
- (label (org-get-text-property-any 0 'target heading))
+ (label (and org-export-latex-labels-enabled (org-get-text-property-any 0 'target heading)))
(label-list (cons label (cdr (assoc label
org-export-target-aliases)))))
(cond
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: suppress \label{} in LaTeX export
2009-10-01 20:32 ` Nick Dokos
@ 2009-10-01 22:48 ` Eric Schulte
2009-10-02 6:23 ` Carsten Dominik
0 siblings, 1 reply; 4+ messages in thread
From: Eric Schulte @ 2009-10-01 22:48 UTC (permalink / raw)
To: nicholas.dokos; +Cc: Org Mode
Hi Nick,
Thanks for the patch, sadly I rely on labels in my other latex exports.
For now I'm just using the following little elisp function.
--8<---------------cut here---------------start------------->8---
(defun schulte/clean-beamer ()
"remove the \label{sec} headers from latex Beamer documents
that have been exported by org."
(interactive)
(save-excursion
(goto-char (point-min))
(while (re-search-forward "^\\\\label{" nil t)
(move-beginning-of-line nil)
(delete-region (point) (save-excursion (forward-line 1) (point))))))
--8<---------------cut here---------------end--------------->8---
Thanks -- Eric
Nick Dokos <nicholas.dokos@hp.com> writes:
> Eric Schulte <schulte.eric@gmail.com> wrote:
>
>
>> Is it possible to suppress the \label{sec-1} lines following each
>> headline after a LaTeX export? I've found no mention of this in the
>> manual, and the presence of headline labels is breaking my Beamer TOC.
>>
>
> I don't think so: they seem to be inextricably bound with headings. The
> code in org-latex.el says:
>
> (let* (...
> (label (org-get-text-property-any 0 'target heading))
> ...)
>
>
> and then
> ...
> (when label
> (insert (mapconcat (lambda (l) (format "\\label{%s}" l))
> label-list "\n") "\n"))
> ...
>
> I recall having problems with labels (among other things) in combination
> with beamer before (I "solved" the problem by running the tex file
> through a script to just get rid of them), but I don't remember what the
> problem was. Maybe it's time to go back and look at the thing again.
>
> Nick
>
> PS. Here is a quick-n-dirty patch to disable them - ymmv, uayor and several
> other cya disclaimers :-)
>
> diff --git a/lisp/org-latex.el b/lisp/org-latex.el
> index 248d653..f5099f7 100644
> --- a/lisp/org-latex.el
> +++ b/lisp/org-latex.el
> @@ -852,6 +852,8 @@ and its content."
> (let ((num (plist-get org-export-latex-options-plist :section-numbers)))
> (mapc (lambda(x) (org-export-latex-subcontent x num)) subcontent)))
>
> +(defvar org-export-latex-labels-enabled nil)
> +
> (defun org-export-latex-subcontent (subcontent num)
> "Export each cell of SUBCONTENT to LaTeX.
> If NUM, export sections as numerical sections."
> @@ -862,7 +864,7 @@ If NUM, export sections as numerical sections."
> (occur (number-to-string (cdr (assoc 'occur subcontent))))
> (content (cdr (assoc 'content subcontent)))
> (subcontent (cadr (assoc 'subcontent subcontent)))
> - (label (org-get-text-property-any 0 'target heading))
> + (label (and org-export-latex-labels-enabled (org-get-text-property-any 0 'target heading)))
> (label-list (cons label (cdr (assoc label
> org-export-target-aliases)))))
> (cond
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: suppress \label{} in LaTeX export
2009-10-01 22:48 ` Eric Schulte
@ 2009-10-02 6:23 ` Carsten Dominik
0 siblings, 0 replies; 4+ messages in thread
From: Carsten Dominik @ 2009-10-02 6:23 UTC (permalink / raw)
To: Eric Schulte; +Cc: Org Mode
Hi Eric,
if you make the function first search for \documentclass{beamer}, then
you
could add it to `org-export-latex-final-hook'.
- Carsten
On Oct 2, 2009, at 12:48 AM, Eric Schulte wrote:
> Hi Nick,
>
> Thanks for the patch, sadly I rely on labels in my other latex
> exports.
> For now I'm just using the following little elisp function.
>
> --8<---------------cut here---------------start------------->8---
> (defun schulte/clean-beamer ()
> "remove the \label{sec} headers from latex Beamer documents
> that have been exported by org."
> (interactive)
> (save-excursion
> (goto-char (point-min))
> (while (re-search-forward "^\\\\label{" nil t)
> (move-beginning-of-line nil)
> (delete-region (point) (save-excursion (forward-line 1)
> (point))))))
> --8<---------------cut here---------------end--------------->8---
>
> Thanks -- Eric
>
> Nick Dokos <nicholas.dokos@hp.com> writes:
>
>> Eric Schulte <schulte.eric@gmail.com> wrote:
>>
>>
>>> Is it possible to suppress the \label{sec-1} lines following each
>>> headline after a LaTeX export? I've found no mention of this in the
>>> manual, and the presence of headline labels is breaking my Beamer
>>> TOC.
>>>
>>
>> I don't think so: they seem to be inextricably bound with headings.
>> The
>> code in org-latex.el says:
>>
>> (let* (...
>> (label (org-get-text-property-any 0 'target heading))
>> ...)
>>
>>
>> and then
>> ...
>> (when label
>> (insert (mapconcat (lambda (l) (format "\\label{%s}" l))
>> label-list "\n") "\n"))
>> ...
>>
>> I recall having problems with labels (among other things) in
>> combination
>> with beamer before (I "solved" the problem by running the tex file
>> through a script to just get rid of them), but I don't remember
>> what the
>> problem was. Maybe it's time to go back and look at the thing again.
>>
>> Nick
>>
>> PS. Here is a quick-n-dirty patch to disable them - ymmv, uayor and
>> several
>> other cya disclaimers :-)
>>
>> diff --git a/lisp/org-latex.el b/lisp/org-latex.el
>> index 248d653..f5099f7 100644
>> --- a/lisp/org-latex.el
>> +++ b/lisp/org-latex.el
>> @@ -852,6 +852,8 @@ and its content."
>> (let ((num (plist-get org-export-latex-options-plist :section-
>> numbers)))
>> (mapc (lambda(x) (org-export-latex-subcontent x num))
>> subcontent)))
>>
>> +(defvar org-export-latex-labels-enabled nil)
>> +
>> (defun org-export-latex-subcontent (subcontent num)
>> "Export each cell of SUBCONTENT to LaTeX.
>> If NUM, export sections as numerical sections."
>> @@ -862,7 +864,7 @@ If NUM, export sections as numerical sections."
>> (occur (number-to-string (cdr (assoc 'occur subcontent))))
>> (content (cdr (assoc 'content subcontent)))
>> (subcontent (cadr (assoc 'subcontent subcontent)))
>> - (label (org-get-text-property-any 0 'target heading))
>> + (label (and org-export-latex-labels-enabled (org-get-text-
>> property-any 0 'target heading)))
>> (label-list (cons label (cdr (assoc label
>> org-export-target-aliases)))))
>> (cond
>
>
> _______________________________________________
> Emacs-orgmode mailing list
> Remember: use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2009-10-02 7:15 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-10-01 20:12 suppress \label{} in LaTeX export Eric Schulte
2009-10-01 20:32 ` Nick Dokos
2009-10-01 22:48 ` Eric Schulte
2009-10-02 6:23 ` Carsten Dominik
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).