From mboxrd@z Thu Jan 1 00:00:00 1970 From: Rasmus Subject: Re: [patch] more Beamer properties Date: Wed, 21 Sep 2016 13:21:43 +0200 Message-ID: <87wpi5sdko.fsf@pank.eu> References: <20160530103806.30cbddd9@asaru> <87fuszuclj.fsf@gmx.us> <20160530133335.45ad8693@asaru> <8737ozu5gv.fsf@gmx.us> <20160601104419.0a52f45e@asaru> <874m9dryrk.fsf@gmx.us> <20160602103705.298b0726@asaru> <87eg8fq5tc.fsf@gmx.us> <87fusg0wlm.fsf@saiph.selenimh> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:37034) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bmfb5-0001Ry-7Q for emacs-orgmode@gnu.org; Wed, 21 Sep 2016 07:21:52 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bmfb1-00035x-4E for emacs-orgmode@gnu.org; Wed, 21 Sep 2016 07:21:51 -0400 Received: from mout.gmx.net ([212.227.15.19]:57205) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bmfb0-00035N-PY for emacs-orgmode@gnu.org; Wed, 21 Sep 2016 07:21:47 -0400 Received: from W530 ([178.203.234.75]) by mail.gmx.com (mrgmx001) with ESMTPSA (Nemesis) id 0Meh8S-1bbbtY2heC-00OF1B for ; Wed, 21 Sep 2016 13:21:44 +0200 In-Reply-To: <87fusg0wlm.fsf@saiph.selenimh> (Nicolas Goaziou's message of "Tue, 14 Jun 2016 14:43:33 +0200") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: emacs-orgmode@gnu.org --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Hi, Thanks for the suggestions. Sorry about the slow reply... I'm lacking time ATM. I simplified the patch to only add the short version of properties and not include the titlegraphics. > I didn't test your patch. However, here are some late comments about > this suggestion. > >> Maybe we can have a titlegraphics like, >> >> #+attr_beamer: :titlegraphics t >> [[file:link.pdf]] > > I think > > #+TITLEGRAPHICS: [[file:link.pdf]] > > would be cleaner. I dropped this. One might need to add attributes to the graphic. The #+titlegraphics approach wouldn=E2=80=99t allow it. I think it=E2=80=99s a= problem that can be pushed down the line. >> ;;;; Plain List >> @@ -855,21 +866,65 @@ holding export options." >> (when (integerp sec-num) >> (format "\\setcounter{secnumdepth}{%d}\n" sec-num))) >> ;; Author. >> - (let ((author (and (plist-get info :with-author) >> - (let ((auth (plist-get info :author))) >> - (and auth (org-export-data auth info))))) >> - (email (and (plist-get info :with-email) >> - (org-export-data (plist-get info :email) info)))) >> + (let* ((author (and (plist-get info :with-author) >> + (let ((auth (plist-get info :author))) >> + (and auth (org-export-data auth info))))) >> + (short-author (and author (plist-get info :short-author))) > > Since "short-author" is `parsed', this should be wrapped within > `org-export-data' somehow. You do it below, but it introduces some code > duplication. > >> + (email (and (plist-get info :with-email) >> + (org-export-data (plist-get info :email) info))) >> + ) > > You left a dangling parenthesis. > >> (cond ((and author email (not (string=3D "" email))) >> - (format "\\author{%s\\thanks{%s}}\n" author email)) >> - ((or author email) (format "\\author{%s}\n" (or author email))))) >> + (format "\\author%s{%s\\thanks{%s}}\n" >> + (if short-author >> + (format "[%s]" (org-export-data short-author info)) "") >> + author email)) >> + ((or author email) (format "\\author%s{%s}\n" >> + (if short-author >> + (format "[%s]" (org-export-data short-author info)) "") >> + (or author email))))) > > See above. Also, I would move the (format ...) below (or author email) > >> ;; Date. >> - (let ((date (and (plist-get info :with-date) (org-export-get-date = info)))) >> - (format "\\date{%s}\n" (org-export-data date info))) >> - ;; Title >> - (format "\\title{%s}\n" title) >> + (let* ((date (and (plist-get info :with-date) (org-export-get-date= info))) >> + ;; TODO: add optional argument of =E2=80=98org-export-get-date=E2= =80=99. >> + (short-date (and date (org-export-data >> + (org-export-get-date >> + (plist-put info :date >> + (plist-get info :beamer-short-date))) >> + info)))) >> + (format "\\date%s{%s}\n" (if (org-string-nw-p short-date) >> + (format "[%s]" short-date) "") > > I would put the "" below (format "[%s]" short-date): it doesn't make > clear there is an else branch otherwise. > >> + (org-export-data date info))) >> + ;; Title. >> + (let ((short-title (and title >> + (plist-get info :beamer-short-title)))) >> + (format "\\title%s{%s}\n" >> + (if short-title (format "[%s]" (org-export-data short-title inf= o)) "") >> + title)) > > See above. > >> + ;; Titlegraphics. >> + (let ((titlegraphic-link >> + (org-element-map (plist-get info :parse-tree) 'link >> + (lambda (link) >> + (when (and (org-export-inline-image-p link) >> + (plist-get (org-export-read-attribute >> + :attr_beamer (org-export-get-parent-element link)) >> + :titlegraphic)) >> + link)) >> + info t))) Should all be fixed. Thanks, Rasmus --=20 Human: An animal that complicates things more than strictly necessary --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0001-ox-beamer-Remove-customizable-subtitle.patch >From 56737ea87fd523d2e88b732af110008b993c7310 Mon Sep 17 00:00:00 2001 From: Rasmus Date: Thu, 2 Jun 2016 11:44:56 +0200 Subject: [PATCH 1/2] ox-beamer: Remove customizable subtitle * lisp/ox-beamer.el (org-beamer-subtitle-format): Remove. (:options-alist): Remove :beamer-subtitle-format. --- doc/org.texi | 4 +--- lisp/ox-beamer.el | 11 ----------- 2 files changed, 1 insertion(+), 14 deletions(-) diff --git a/doc/org.texi b/doc/org.texi index 56779e8..2c9cb64 100644 --- a/doc/org.texi +++ b/doc/org.texi @@ -11077,9 +11077,7 @@ can use several @code{#+KEYWORDS} if the description is is long. @item SUBTITLE @cindex #+SUBTITLE (Beamer) -@vindex org-beamer-subtitle-format -The document subtitle. This is typeset using the format string -@code{org-beamer-subtitle-format}. It can also access via +The document subtitle. It can also access via @code{org-latex-hyperref-template} or typeset as part of the front matter via @code{org-latex-title-command}. @end table diff --git a/lisp/ox-beamer.el b/lisp/ox-beamer.el index 2d1d53f..fc17d3e 100644 --- a/lisp/ox-beamer.el +++ b/lisp/ox-beamer.el @@ -134,16 +134,6 @@ You might want to put e.g. \"allowframebreaks=0.9\" here." :group 'org-export-beamer :type '(string :tag "Outline frame options")) - -(defcustom org-beamer-subtitle-format "\\subtitle{%s}" - "Format string used for transcoded subtitle. -The format string should have at most one \"%s\"-expression, -which is replaced with the subtitle." - :group 'org-export-beamer - :version "25.1" - :package-version '(Org . "8.3") - :type '(string :tag "Format string")) - ;;; Internal Variables @@ -239,7 +229,6 @@ Return overlay specification, as a string, or nil." :options-alist '((:headline-levels nil "H" org-beamer-frame-level) (:latex-class "LATEX_CLASS" nil "beamer" t) - (:beamer-subtitle-format nil nil org-beamer-subtitle-format) (:beamer-column-view-format "COLUMNS" nil org-beamer-column-view-format) (:beamer-theme "BEAMER_THEME" nil org-beamer-theme) (:beamer-color-theme "BEAMER_COLOR_THEME" nil nil t) -- 2.10.0 --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0002-ox-beamer-Add-short-title-metainfo-properties.patch >From 2235d17c0bb4fcb8f5b06c4330a56e2a1732162b Mon Sep 17 00:00:00 2001 From: Rasmus Date: Thu, 2 Jun 2016 11:45:49 +0200 Subject: [PATCH 2/2] ox-beamer: Add short title metainfo properties * lisp/ox-beamer.el: (beamer :option-alist): Add :beamer-short-title, :beamer-short-subtitle, :beamer-short-author, :beamer-short-date, :beamer-institute, :beamer-short-institute (org-beamer-template): Use new properties. --- lisp/ox-beamer.el | 70 ++++++++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 57 insertions(+), 13 deletions(-) diff --git a/lisp/ox-beamer.el b/lisp/ox-beamer.el index fc17d3e..3263d75 100644 --- a/lisp/ox-beamer.el +++ b/lisp/ox-beamer.el @@ -236,6 +236,12 @@ Return overlay specification, as a string, or nil." (:beamer-inner-theme "BEAMER_INNER_THEME" nil nil t) (:beamer-outer-theme "BEAMER_OUTER_THEME" nil nil t) (:beamer-header "BEAMER_HEADER" nil nil newline) + (:beamer-short-title "SHORT_TITLE" nil nil parse) + (:beamer-short-subtitle "SHORT_SUBTITLE" nil nil parse) + (:beamer-short-author "SHORT_AUTHOR" nil nil parse) + (:beamer-short-date "SHORT_DATE" nil nil parse) + (:beamer-institute "INSTITUTE" nil nil parse) + (:beamer-short-institute "SHORT_INSTITUTE" nil nil parse) (:beamer-environments-extra nil nil org-beamer-environments-extra) (:beamer-frame-default-options nil nil org-beamer-frame-default-options) (:beamer-outline-frame-options nil nil org-beamer-outline-frame-options) @@ -852,21 +858,59 @@ holding export options." (when (integerp sec-num) (format "\\setcounter{secnumdepth}{%d}\n" sec-num))) ;; Author. - (let ((author (and (plist-get info :with-author) - (let ((auth (plist-get info :author))) - (and auth (org-export-data auth info))))) - (email (and (plist-get info :with-email) - (org-export-data (plist-get info :email) info)))) - (cond ((and author email (not (string= "" email))) - (format "\\author{%s\\thanks{%s}}\n" author email)) - ((or author email) (format "\\author{%s}\n" (or author email))))) + (let* ((author (and (plist-get info :with-author) + (let ((auth (plist-get info :author))) + (and auth (org-export-data auth info))))) + (short-author (and author + (let ((short-auth (plist-get info :beamer-short-author))) + (if short-auth + (format "[%s]" + (org-export-data short-auth info)) + "")))) + (email (and (plist-get info :with-email) + (org-string-nw-p + (org-export-data (plist-get info :email) info))))) + (cond ((and author email) + (format "\\author%s{%s\\thanks{%s}}\n" + short-author author email)) + ((or author email) + (format "\\author%s{%s}\n" + short-author (or author email))))) ;; Date. - (let ((date (and (plist-get info :with-date) (org-export-get-date info)))) - (format "\\date{%s}\n" (org-export-data date info))) - ;; Title - (format "\\title{%s}\n" title) + (let* ((date (and (plist-get info :with-date) (org-export-get-date info))) + (short-date (and date (org-export-data + (org-export-get-date + (plist-put info :date + (plist-get info :beamer-short-date))) + info)))) + (format "\\date%s{%s}\n" (if (org-string-nw-p short-date) + (format "[%s]" short-date) + "") + (org-export-data date info))) + ;; Title. + (let ((short-title (and title (plist-get info :beamer-short-title)))) + (format "\\title%s{%s}\n" + (if short-title + (format "[%s]" (org-export-data short-title info)) + "") + title)) + ;; Subtitle. (when (org-string-nw-p subtitle) - (concat (format (plist-get info :beamer-subtitle-format) subtitle) "\n")) + (let ((short-subtitle (plist-get info :beamer-short-subtitle))) + (format "\\subtitle%s{%s}\n" + (if short-subtitle + (format "[%s]" (org-export-data short-subtitle info)) + "") + subtitle))) + ;; Institute. + (let ((institute (plist-get info :beamer-institute)) + (short-institute (plist-get info :beamer-short-institute))) + (when institute + (format "\\institute%s{%s}\n" + (if short-institute + (format "[%s]" (org-export-data short-institute info)) + "") + (org-export-data institute info)))) ;; Beamer-header (let ((beamer-header (plist-get info :beamer-header))) (when beamer-header -- 2.10.0 --=-=-=--