From: Fabrice Popineau <fabrice.popineau@gmail.com>
To: Fabrice Popineau <fabrice.popineau@gmail.com>,
"emacs-orgmode@gnu.org" <emacs-orgmode@gnu.org>
Subject: Re: ox-beamer and CUSTOM_ID
Date: Thu, 15 Oct 2015 22:20:38 +0200 [thread overview]
Message-ID: <CAFgFV9NdECBhGc1163+dnu39RBZ6_eCWTeaP+=Bg2XDvdfcM8w@mail.gmail.com> (raw)
In-Reply-To: <87oafz6hgx.fsf@nicolasgoaziou.fr>
[-- Attachment #1: Type: text/plain, Size: 3751 bytes --]
My small patch worked only for labels with colon.
With more extensive testing, I can propose this one against maint :
diff --git a/vendor/org-mode/lisp/ox-beamer.el
b/vendor/org-mode/lisp/ox-beamer.el
index 73d8a76..ee4f0d7 100644
--- a/vendor/org-mode/lisp/ox-beamer.el
+++ b/vendor/org-mode/lisp/ox-beamer.el
@@ -335,11 +335,11 @@ property, or a fallback value built from headline's
number. This
function assumes HEADLINE will be treated as a frame."
(let ((opt (org-element-property :BEAMER_OPT headline)))
(if (and (stringp opt)
- (string-match "\\(?:^\\|,\\)label=\\(.*?\\)\\(?:$\\|,\\)" opt))
+ (string-match "\\(?:^\\|,\\)label={?\\(.*?\\)}?\\(?:$\\|,\\)"
opt))
(match-string 1 opt)
(or (and (plist-get info :latex-prefer-user-labels)
(org-element-property :CUSTOM_ID headline))
- (format "{sec:%s}"
+ (format "sec:%s"
(org-export-get-reference headline info))))))
(defun org-beamer--frame-level (headline info)
@@ -444,8 +444,9 @@ used as a communication channel."
(or (string-match "\\(^\\|,\\)label="
beamer-opt)
(string-match "allowframebreaks"
beamer-opt)))
(list
- (format "label=%s"
- (org-beamer--get-label headline info)))))))
+ (let* ((label (org-beamer--get-label headline info))
+ (fmt (if (string-match ":" label)
"label={%s}" "label=%s")))
+ (format fmt label)))))))
;; Change options list into a string.
(org-beamer--normalize-argument
(mapconcat
This way, the org-beamer--get-label function always returns a label without
braces.
Check especially the regexp. I hope I haven't introduce bad matches.
When the frame with the label is written, braces are added if needed.
Regards,
Fabrice
2015-10-15 21:48 GMT+02:00 Nicolas Goaziou <mail@nicolasgoaziou.fr>:
> Fabrice Popineau <fabrice.popineau@gmail.com> writes:
>
> > Oh! I got it.
> >
> > The problem is that beamer expects braces around a label with colon when
> > you setup the label
> > but *not when you ref it* :
> >
> > \begin{frame}[label={sec:orgheadline1}]{Frame 1}
> > bla bla bla bla bla bla bla bla bla bla bla bla
> > \end{frame}
> >
> > \againframe{sec:orgheadline1}
> >
> > The braces at setup are required by the keyval package which is used to
> > parse the options.
> > However, the label is called sec:orgheadline1 and not {sec:orgheadline1}.
> > But at the moment, ox-beamer outputs :
> >
> > \againframe{{sec:orgheadline1}}
> >
> > I fixed it unintentionally by using my own label without colon.
> >
> > So basically you need this:
> >
> > diff --git a/vendor/org-mode/lisp/ox-beamer.el
> > b/vendor/org-mode/lisp/ox-beamer.el
> > index 24dcf19..75b51df 100644
> > --- a/vendor/org-mode/lisp/ox-beamer.el
> > +++ b/vendor/org-mode/lisp/ox-beamer.el
> > @@ -621,7 +623,7 @@ as a communication channel."
> > (org-export-resolve-id-link link
> > info))))
> > ;; Now use user-defined label provided in TARGET
> > ;; headline, or fallback to standard one.
> > - (format "{%s}" (org-beamer--get-label target
> > info)))))))
> > + (format "%s" (org-beamer--get-label target
> info)))))))
> > ;; Case 2: Creation of an appendix is requested.
> > ((equal environment "appendix")
> > (concat "\\appendix"
>
> Thanks for the debugging. Do you want to provide a patch against maint
> for this ? Note that your library needs to be updated.
>
> Regards,
>
[-- Attachment #2: Type: text/html, Size: 5283 bytes --]
next prev parent reply other threads:[~2015-10-15 20:21 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-13 11:24 ox-beamer and CUSTOM_ID Fabrice Popineau
2015-10-13 19:26 ` Nicolas Goaziou
2015-10-13 19:38 ` Fabrice Popineau
2015-10-13 19:50 ` Nicolas Goaziou
2015-10-13 19:58 ` Fabrice Popineau
2015-10-13 20:52 ` Nicolas Goaziou
2015-10-13 21:12 ` Fabrice Popineau
2015-10-13 22:18 ` Nicolas Goaziou
2015-10-14 9:47 ` Fabrice Popineau
2015-10-14 11:57 ` Nicolas Goaziou
2015-10-14 12:18 ` Fabrice Popineau
2015-10-15 8:37 ` Nicolas Goaziou
2015-10-15 16:54 ` Fabrice Popineau
2015-10-15 19:25 ` Fabrice Popineau
2015-10-15 19:48 ` Nicolas Goaziou
2015-10-15 20:20 ` Fabrice Popineau [this message]
2015-10-16 20:59 ` 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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAFgFV9NdECBhGc1163+dnu39RBZ6_eCWTeaP+=Bg2XDvdfcM8w@mail.gmail.com' \
--to=fabrice.popineau@gmail.com \
--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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.