emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* having problems exporting to Beamer
@ 2013-04-13 23:12 Eric Schulte
  2013-04-14  7:51 ` Nicolas Goaziou
  0 siblings, 1 reply; 8+ messages in thread
From: Eric Schulte @ 2013-04-13 23:12 UTC (permalink / raw)
  To: Org Mode Mailing List

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?

Thanks,

Footnotes: 
[1]  
Debugger entered--Lisp error: (wrong-type-argument stringp nil)
  string-match("\\S-" nil)
  (not (string-match "\\S-" argument))
  (if (not (string-match "\\S-" argument)) "" (cond ((eql type (quote action)) (if (string-match "\\`<.*>\\'" argument) argument (format "<%s>" argument))) ((eql type (quote defaction)) (cond ((string-match "\\`\\[<.*>\\]\\'" argument) argument) ((string-match "\\`<.*>\\'" argument) (format "[%s]" argument)) ((string-match "\\`\\[\\(.*\\)\\]\\'" argument) (format "[<%s>]" (match-string 1 argument))) (t (format "[<%s>]" argument)))) ((eql type (quote option)) (if (string-match "\\`\\[.*\\]\\'" argument) argument (format "[%s]" argument))) (t argument)))
  org-beamer--normalize-argument(nil option)
  (format "\\begin{frame}%s{%s}\n" (org-beamer--normalize-argument org-beamer-outline-frame-options (quote option)) org-beamer-outline-frame-title)
  (concat (format "\\begin{frame}%s{%s}\n" (org-beamer--normalize-argument org-beamer-outline-frame-options (quote option)) org-beamer-outline-frame-title) (if (wholenump depth) (progn (format "\\setcounter{tocdepth}{%d}\n" depth))) "\\tableofcontents\n" "\\end{frame}\n\n")
  (progn (concat (format "\\begin{frame}%s{%s}\n" (org-beamer--normalize-argument org-beamer-outline-frame-options (quote option)) org-beamer-outline-frame-title) (if (wholenump depth) (progn (format "\\setcounter{tocdepth}{%d}\n" depth))) "\\tableofcontents\n" "\\end{frame}\n\n"))
  (if depth (progn (concat (format "\\begin{frame}%s{%s}\n" (org-beamer--normalize-argument org-beamer-outline-frame-options (quote option)) org-beamer-outline-frame-title) (if (wholenump depth) (progn (format "\\setcounter{tocdepth}{%d}\n" depth))) "\\tableofcontents\n" "\\end{frame}\n\n")))
  (let ((depth (plist-get info :with-toc))) (if depth (progn (concat (format "\\begin{frame}%s{%s}\n" (org-beamer--normalize-argument org-beamer-outline-frame-options (quote option)) org-beamer-outline-frame-title) (if (wholenump depth) (progn (format "\\setcounter{tocdepth}{%d}\n" depth))) "\\tableofcontents\n" "\\end{frame}\n\n"))))
  [...]
  (if async (let ((with-temp-message "Initializing asynchronous export process") (current-message)) (unwind-protect (progn (if with-temp-message (progn (setq current-message (current-message)) (message "%s" with-temp-message))) (let ((--copy-fun (org-export--generate-copy-script ...)) (--temp-file (make-temp-file "org-export-process")) (--coding buffer-file-coding-system)) (let ((temp-file --temp-file) (temp-buffer ...)) (unwind-protect (prog1 ... ...) (and ... ...))) (let* ((process-connection-type nil) (--proc-buffer ...) (--process ...)) (org-export-add-to-stack (get-buffer --proc-buffer) nil --process) (set-process-sentinel --process (let ... ...))))) (and with-temp-message (if current-message (message "%s" current-message) (message nil))))) (org-export-to-file (quote beamer) outfile s
 ubtreep visible-only body-only ext-plist))
  (let ((outfile (org-export-output-file-name ".tex" subtreep))) (if async (let ((with-temp-message "Initializing asynchronous export process") (current-message)) (unwind-protect (progn (if with-temp-message (progn (setq current-message ...) (message "%s" with-temp-message))) (let ((--copy-fun ...) (--temp-file ...) (--coding buffer-file-coding-system)) (let (... ...) (unwind-protect ... ...)) (let* (... ... ...) (org-export-add-to-stack ... nil --process) (set-process-sentinel --process ...)))) (and with-temp-message (if current-message (message "%s" current-message) (message nil))))) (org-export-to-file (quote beamer) outfile subtreep visible-only body-only ext-plist)))
  org-beamer-export-to-latex(nil nil nil nil nil)
  (org-latex-compile (org-beamer-export-to-latex nil subtreep visible-only body-only ext-plist))
  (if async (let ((outfile (org-export-output-file-name ".tex" subtreep))) (let ((with-temp-message "Initializing asynchronous export process") (current-message)) (unwind-protect (progn (if with-temp-message (progn (setq current-message ...) (message "%s" with-temp-message))) (let ((--copy-fun ...) (--temp-file ...) (--coding buffer-file-coding-system)) (let (... ...) (unwind-protect ... ...)) (let* (... ... ...) (org-export-add-to-stack ... nil --process) (set-process-sentinel --process ...)))) (and with-temp-message (if current-message (message "%s" current-message) (message nil)))))) (org-latex-compile (org-beamer-export-to-latex nil subtreep visible-only body-only ext-plist)))
  org-beamer-export-to-pdf(nil nil nil nil)
  org-export-dispatch(nil)
  call-interactively(org-export-dispatch nil nil)

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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: having problems exporting to Beamer
  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
  0 siblings, 1 reply; 8+ messages in thread
From: Nicolas Goaziou @ 2013-04-14  7:51 UTC (permalink / raw)
  To: Eric Schulte; +Cc: Org Mode Mailing List

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).


Regards,

-- 
Nicolas Goaziou

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: having problems exporting to Beamer
  2013-04-14  7:51 ` Nicolas Goaziou
@ 2013-04-14 17:08   ` Eric Schulte
  2013-04-14 17:16     ` Nicolas Goaziou
  2013-04-14 17:27     ` Nicolas Goaziou
  0 siblings, 2 replies; 8+ messages in thread
From: Eric Schulte @ 2013-04-14 17:08 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: Org Mode Mailing List

[-- 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

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: having problems exporting to Beamer
  2013-04-14 17:08   ` Eric Schulte
@ 2013-04-14 17:16     ` Nicolas Goaziou
  2013-04-14 17:47       ` Eric Schulte
  2013-04-14 17:27     ` Nicolas Goaziou
  1 sibling, 1 reply; 8+ messages in thread
From: Nicolas Goaziou @ 2013-04-14 17:16 UTC (permalink / raw)
  To: Eric Schulte; +Cc: Org Mode Mailing List

Eric Schulte <schulte.eric@gmail.com> writes:

> 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.

The default value for this variable is already the empty string.

> After fixing the above I reached a new error.  There was no "beamer"
> class defined in my `org-latex-classes'.  

This is already the case. You should update Org.

> Finally, I ran into a third and even more minor problem.  Illustrated by
> the following example.
>
> #+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
>
> When exported to a beamer presentation, what should be h squared is
> instead exported as h^{2}.

You explicitly tell the exporter to not export sub/superscript with
^:nil. Just set it to t.

Thanks for testing this.


Regards,

-- 
Nicolas Goaziou

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: having problems exporting to Beamer
  2013-04-14 17:08   ` Eric Schulte
  2013-04-14 17:16     ` Nicolas Goaziou
@ 2013-04-14 17:27     ` Nicolas Goaziou
  1 sibling, 0 replies; 8+ messages in thread
From: Nicolas Goaziou @ 2013-04-14 17:27 UTC (permalink / raw)
  To: Eric Schulte; +Cc: Org Mode Mailing List

Eric Schulte <schulte.eric@gmail.com> writes:

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

I had overlooked this one. I applied it. Thank you.


Regards,

-- 
Nicolas Goaziou

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: having problems exporting to Beamer
  2013-04-14 17:16     ` Nicolas Goaziou
@ 2013-04-14 17:47       ` Eric Schulte
  2013-04-14 19:15         ` Nicolas Goaziou
  0 siblings, 1 reply; 8+ messages in thread
From: Eric Schulte @ 2013-04-14 17:47 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: Org Mode Mailing List

>> Finally, I ran into a third and even more minor problem.  Illustrated by
>> the following example.
>>
>> #+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
>>
>> When exported to a beamer presentation, what should be h squared is
>> instead exported as h^{2}.
>
> You explicitly tell the exporter to not export sub/superscript with
> ^:nil. Just set it to t.
>

Oh, this must be a bug in the old exporter which I grew to depend upon.
FWIW I always set ^:nil to t, so that I can use underscores w/o
exporting subscript words.  Previously even with ^:nil, superscripts
using curly braces would be exported as superscripts.  I guess I'll have
to find a new mode of operation with the new exporter.

Thanks,

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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: having problems exporting to Beamer
  2013-04-14 17:47       ` Eric Schulte
@ 2013-04-14 19:15         ` Nicolas Goaziou
  2013-04-15  0:27           ` Eric Schulte
  0 siblings, 1 reply; 8+ messages in thread
From: Nicolas Goaziou @ 2013-04-14 19:15 UTC (permalink / raw)
  To: Eric Schulte; +Cc: Org Mode Mailing List

Eric Schulte <schulte.eric@gmail.com> writes:

> Oh, this must be a bug in the old exporter which I grew to depend upon.
> FWIW I always set ^:nil to t, so that I can use underscores w/o
> exporting subscript words.  Previously even with ^:nil, superscripts
> using curly braces would be exported as superscripts.  I guess I'll have
> to find a new mode of operation with the new exporter.

What about using:

  ^:{} 


Regards,

-- 
Nicolas Goaziou

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: having problems exporting to Beamer
  2013-04-14 19:15         ` Nicolas Goaziou
@ 2013-04-15  0:27           ` Eric Schulte
  0 siblings, 0 replies; 8+ messages in thread
From: Eric Schulte @ 2013-04-15  0:27 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: Org Mode Mailing List

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

> Eric Schulte <schulte.eric@gmail.com> writes:
>
>> Oh, this must be a bug in the old exporter which I grew to depend upon.
>> FWIW I always set ^:nil to t, so that I can use underscores w/o
>> exporting subscript words.  Previously even with ^:nil, superscripts
>> using curly braces would be exported as superscripts.  I guess I'll have
>> to find a new mode of operation with the new exporter.
>
> What about using:
>
>   ^:{} 
>

Beautiful, Thanks.

>
> Regards,

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

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2013-04-15  0:58 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
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

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).