emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Eric Schulte <schulte.eric@gmail.com>
To: Nicolas Goaziou <n.goaziou@gmail.com>
Cc: Org Mode Mailing List <emacs-orgmode@gnu.org>
Subject: Re: having problems exporting to Beamer
Date: Sun, 14 Apr 2013 11:08:12 -0600	[thread overview]
Message-ID: <87vc7pdoox.fsf@gmail.com> (raw)
In-Reply-To: 871uada6t2.fsf@gmail.com

[-- Attachment #1: Type: text/plain, Size: 972 bytes --]

Nicolas Goaziou <n.goaziou@gmail.com> writes:

> Hello,
>
> Eric Schulte <schulte.eric@gmail.com> writes:
>
>> When I attempt to export a .org file to Beamer (with "C-c C-e l b" after
>> requiring ox-beamer) I get the following error [1].  From the info page
>> (info "(org)Beamer export") it looks like I shouldn't have to do any
>> special buffer preparation.
>>
>> What am I doing wrong?
>
> It looks like `org-beamer-outline-frame-options' is nil, but it must be
> a string (possibly empty).
>

Thanks, with this variable set to an empty string I am making it further
in the export process.  I would suggest that either the initial value of
this variable be set to an empty string, or a nil value should be
handled gracefully.

After fixing the above I reached a new error.  There was no "beamer"
class defined in my `org-latex-classes'.  The attached patch ensures
that when ox-beamer is loaded a beamer entry is added to
`org-latex-classes' if none already exists.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-ensure-a-beamer-entry-exists-in-org-latex-classes.patch --]
[-- Type: text/x-patch, Size: 1363 bytes --]

From 540bcddb50b746f4f2de910a199e4d13e8ddad11 Mon Sep 17 00:00:00 2001
From: Eric Schulte <schulte.eric@gmail.com>
Date: Sun, 14 Apr 2013 09:16:24 -0600
Subject: [PATCH 1/2] ensure a "beamer" entry exists in org-latex-classes

This ensures that whenever ox-beamer is required it is possible to
export to beamer.  Otherwise it is required to find the
org-latex-classes variable and add a beamer entry, something which is
not mentioned in the beamer page of the manual and will be confusing to
users just getting going with Beamer export.

* lisp/ox-beamer.el (assoc): Ensure a "beamer" entry exists in
  org-latex-classes.
---
 lisp/ox-beamer.el | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/lisp/ox-beamer.el b/lisp/ox-beamer.el
index 63dad5c..87458f0 100644
--- a/lisp/ox-beamer.el
+++ b/lisp/ox-beamer.el
@@ -126,6 +126,15 @@
   :group 'org-export
   :version "24.2")
 
+(unless (assoc "beamer" org-latex-classes)
+  (add-to-list 'org-latex-classes
+	       '("article" "\\documentclass[bigger]{beamer}"
+		 ("\\section{%s}" . "\\section*{%s}")
+		 ("\\subsection{%s}" . "\\subsection*{%s}")
+		 ("\\subsubsection{%s}" . "\\subsubsection*{%s}")
+		 ("\\paragraph{%s}" . "\\paragraph*{%s}")
+		 ("\\subparagraph{%s}" . "\\subparagraph*{%s}"))))
+
 (defcustom org-beamer-frame-level 1
   "The level at which headlines become frames.
 
-- 
1.8.2.1


[-- Attachment #3: Type: text/plain, Size: 473 bytes --]


I leave it to you to apply or not, but I think it makes things much
clearer for new users.  I think this patch is especially useful because
it is no longer required to place

  #+LaTeX_Class: beamer

at the top of the Org-mode file for beamer export.  At least the
"beamer" class and `org-latex-classes' should be mentioned in the beamer
section of the manual.

Additionally, I ran into another nil vs. empty string problem, which was
fixed by the second patch attached.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #4: 0002-Ensure-nil-is-not-passed-to-regexp-function.patch --]
[-- Type: text/x-patch, Size: 926 bytes --]

From ae7f4de7a04c9fac9fa36836370711cdb7f12fa7 Mon Sep 17 00:00:00 2001
From: Eric Schulte <schulte.eric@gmail.com>
Date: Sun, 14 Apr 2013 10:28:27 -0600
Subject: [PATCH 2/2] Ensure nil is not passed to regexp function

* lisp/ox-beamer.el (org-beamer--format-frame): If contents is nil, then
  replace it with an empty string.
---
 lisp/ox-beamer.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lisp/ox-beamer.el b/lisp/ox-beamer.el
index 87458f0..d1cfbfd 100644
--- a/lisp/ox-beamer.el
+++ b/lisp/ox-beamer.el
@@ -513,7 +513,7 @@ used as a communication channel."
 	    ;; remove the first word from the contents in the PDF
 	    ;; output.
 	    (if (not fragilep) contents
-	      (replace-regexp-in-string "\\`\n*" "\\& " contents))
+	      (replace-regexp-in-string "\\`\n*" "\\& " (or contents "")))
 	    "\\end{frame}")))
 
 (defun org-beamer--format-block (headline contents info)
-- 
1.8.2.1


[-- Attachment #5: Type: text/plain, Size: 98 bytes --]


Finally, I ran into a third and even more minor problem.  Illustrated by
the following example.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #6: beamer-example.org --]
[-- Type: text/x-org, Size: 190 bytes --]

#+TITLE: Example Presentation
#+Options: ^:nil toc:nil

* Breeders Equation
\begin{equation*}
  R = h^{2}S
\end{equation*}

- R :: response
- h^{2} :: heritability
- S :: selective distance

[-- Attachment #7: Type: text/plain, Size: 167 bytes --]


When exported to a beamer presentation, what should be h squared is
instead exported as h^{2}.

Thanks,

>
>
> Regards,

-- 
Eric Schulte
http://cs.unm.edu/~eschulte

  reply	other threads:[~2013-04-14 17:10 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-13 23:12 having problems exporting to Beamer Eric Schulte
2013-04-14  7:51 ` Nicolas Goaziou
2013-04-14 17:08   ` Eric Schulte [this message]
2013-04-14 17:16     ` Nicolas Goaziou
2013-04-14 17:47       ` Eric Schulte
2013-04-14 19:15         ` Nicolas Goaziou
2013-04-15  0:27           ` Eric Schulte
2013-04-14 17:27     ` 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

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87vc7pdoox.fsf@gmail.com \
    --to=schulte.eric@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=n.goaziou@gmail.com \
    /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 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).