emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Orgmode] export-latex beamer


From: Nick Dokos
Subject: Re: [Orgmode] export-latex beamer
Date: Wed, 23 Apr 2008 16:03:45 -0400

Hi Bastien,

I have a quick-n-dirty patch to export an org file as a beamer
document. It has been tested on one very simple org file only, so
YMMV. I hope I have not broken anything else in the process but if I
have, please let me know.  It takes level 1 headlines and makes them
into frametitles for a frame, starts an itemize environment and includes
all level 2 subordinates as items. At the end, it closes the itemize
enviroment and the frame. It's just barely enough to cover the simplest
conversion, but I hope it's useful nevertheless.

I *did* change the format of org-export-latex-classes. Instead of pairs,
I use lists: the third element of the list, if present, is the string to
use to close any environment(s) opened by the first or second elements
of the list. So if this variable has been customized, things are going
to break.

HTH,
Nick

PS. I see I also added a second clause to some conditionals, checking
whether the subcontent is null and avoiding the function call in that
case. That's only a small optimization that I introduced to simplify
the tracing that I was doing when trying to understand the code. I
don't think it hurts anything to leave it in, however if it causes
problems, it can be ripped out.

--- a/lisp/org-export-latex.el
+++ b/lisp/org-export-latex.el
@@ -89,31 +89,39 @@
 \\usepackage[utf8]{inputenc}
 \\usepackage[T1]{fontenc}
 \\usepackage{hyperref}"
-     ("\\section{%s}" . "\\section*{%s}")
-     ("\\subsection{%s}" . "\\subsection*{%s}")
-     ("\\subsubsection{%s}" . "\\subsubsection*{%s}")
-     ("\\paragraph{%s}" . "\\paragraph*{%s}")
-     ("\\subparagraph{%s}" . "\\subparagraph*{%s}"))
+     ("\\section{%s}"  "\\section*{%s}")
+     ("\\subsection{%s}"  "\\subsection*{%s}")
+     ("\\subsubsection{%s}"  "\\subsubsection*{%s}")
+     ("\\paragraph{%s}"  "\\paragraph*{%s}")
+     ("\\subparagraph{%s}"  "\\subparagraph*{%s}"))
     ("report"
      "\\documentclass[11pt,a4paper]{report}
 \\usepackage[utf8]{inputenc}
 \\usepackage[T1]{fontenc}
 \\usepackage{hyperref}"
-     ("\\part{%s}" . "\\part*{%s}")
-     ("\\chapter{%s}" . "\\chapter*{%s}")
-     ("\\section{%s}" . "\\section*{%s}")
-     ("\\subsection{%s}" . "\\subsection*{%s}")
-     ("\\subsubsection{%s}" . "\\subsubsection*{%s}"))
+     ("\\part{%s}"  "\\part*{%s}")
+     ("\\chapter{%s}"  "\\chapter*{%s}")
+     ("\\section{%s}"  "\\section*{%s}")
+     ("\\subsection{%s}"  "\\subsection*{%s}")
+     ("\\subsubsection{%s}"  "\\subsubsection*{%s}"))
     ("book"
      "\\documentclass[11pt,a4paper]{book}
 \\usepackage[utf8]{inputenc}
 \\usepackage[T1]{fontenc}
 \\usepackage{hyperref}"
-     ("\\part{%s}" . "\\part*{%s}")
-     ("\\chapter{%s}" . "\\chapter*{%s}")
-     ("\\section{%s}" . "\\section*{%s}")
-     ("\\subsection{%s}" . "\\subsection*{%s}")
-     ("\\subsubsection{%s}" . "\\subsubsection*{%s}")))
+     ("\\part{%s}"  "\\part*{%s}")
+     ("\\chapter{%s}"  "\\chapter*{%s}")
+     ("\\section{%s}"  "\\section*{%s}")
+     ("\\subsection{%s}"  "\\subsection*{%s}")
+     ("\\subsubsection{%s}"  "\\subsubsection*{%s}"))
+    ("beamer"
+     "\\documentclass{beamer}
+\\usepackage[utf8]{inputenc}
+\\usepackage[T1]{fontenc}
+\\usepackage{hyperref}"
+     ("\\frame{\\frametitle{%s}\\begin{itemize}"  
"\\frame{\\frametitle{%s}\\begin{itemize}" "\\end{itemize}}")
+     ("\\item{%s}"  "\\item*{%s}")
+     (""  "")))
   "Alist of LaTeX classes and associated header and structure.
 If #+LaTeX_CLASS is set in the buffer, use its value and the
 associated information.  Here is the structure of each cell:
@@ -567,11 +575,14 @@ and its content."
      ;; Normal conversion
      ((<= level org-export-latex-sectioning-depth)
       (let ((sec (nth (1- level) org-export-latex-sectioning)))
-       (insert (format (if num (car sec) (cdr sec)) heading) "\n"))
-      (insert (org-export-latex-content content))
-      (cond ((stringp subcontent) (insert subcontent))
-            ((null subcontent))
-           ((listp subcontent) (org-export-latex-sub subcontent))))
+       (insert (format (if num (car sec) (cadr sec)) heading) "\n")
+        (insert (org-export-latex-content content))
+        (cond ((stringp subcontent) (insert subcontent))
+              ((null subcontent))
+              ((listp subcontent) (org-export-latex-sub subcontent)))
+        (let ((closing (caddr sec)))
+          (if closing
+              (insert closing "\n")))))
      ;; At a level under the hl option: we can drop this subsection
      ((> level org-export-latex-sectioning-depth)
       (cond ((eq org-export-latex-low-levels 'description)




reply via email to

[Prev in Thread] Current Thread [Next in Thread]