emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Nick Dokos <nicholas.dokos@hp.com>
To: Bastien <bzg@altern.org>
Cc: emacs-orgmode@gnu.org
Subject: Re: export-latex beamer
Date: Wed, 23 Apr 2008 16:03:45 -0400	[thread overview]
Message-ID: <10405.1208981025@alphaville.zko.hp.com> (raw)
In-Reply-To: Message from Bastien <bzg@altern.org> of "Wed, 05 Mar 2008 02:41:29 GMT." <87abldc2p2.fsf@bzg.ath.cx>

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)

  parent reply	other threads:[~2008-04-23 20:05 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-03-04 21:36 FR: date marking in calendar Wanrong Lin
2008-03-04 22:42 ` Bastien
2008-03-04 22:48   ` time lag in re-scheduling the item in Agenda buffer Xin Shi
2008-03-04 23:52     ` Bastien
2008-03-05  2:28       ` export-latex beamer Xin Shi
2008-03-05  2:41         ` Bastien
2008-03-05  2:45           ` Xin Shi
2008-04-23 20:03           ` Nick Dokos [this message]
2008-04-27 23:09             ` Pete Phillips
2008-04-28  4:21               ` Nick Dokos
2008-04-28  4:25               ` Russell Adams
2008-03-04 23:51   ` FR: date marking in calendar Bastien
2008-03-05  2:09     ` Wanrong Lin
2008-03-05  2:26       ` Bastien Guerry
2008-03-05 16:04         ` Wanrong Lin
2008-03-05 16:48           ` Bastien
2008-03-05 18:17             ` Cezar Halmagean
2008-03-05 19:06               ` Bastien Guerry
2008-03-05 19:45             ` Wanrong Lin
2008-03-05 20:24         ` FR: more options in (org-diary) Wanrong Lin

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=10405.1208981025@alphaville.zko.hp.com \
    --to=nicholas.dokos@hp.com \
    --cc=bzg@altern.org \
    --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 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).