From mboxrd@z Thu Jan 1 00:00:00 1970 From: Tom Short Subject: Org-mode to MS-Word/OOo with vector graphics Date: Thu, 2 Sep 2010 14:45:22 +0000 (UTC) Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Return-path: Received: from [140.186.70.92] (port=57075 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OrB35-00031U-M5 for emacs-orgmode@gnu.org; Thu, 02 Sep 2010 10:45:59 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OrB2o-0006s6-9o for emacs-orgmode@gnu.org; Thu, 02 Sep 2010 10:45:39 -0400 Received: from lo.gmane.org ([80.91.229.12]:54421) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OrB2o-0006rj-0D for emacs-orgmode@gnu.org; Thu, 02 Sep 2010 10:45:38 -0400 Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1OrB2k-00023c-Fr for emacs-orgmode@gnu.org; Thu, 02 Sep 2010 16:45:37 +0200 Received: from 144-58-241-134.rev.epri.com ([144.58.241.134]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 02 Sep 2010 16:45:34 +0200 Received: from tshort by 144-58-241-134.rev.epri.com with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 02 Sep 2010 16:45:34 +0200 List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org I've tried several approaches to converting org-mode files to MS-Word or OpenOffice.org that retains vector graphics, especially encapsulated postscript files. Some options I've tried include docbook export with docbook2odf (doesn't work with docbook v5) and latex export with tex4ht (converts graphics to png). HTML export with orgmode's html exporter worked the best for me. The key is to have orgmode's exporter inline EPS (or other vector graphics) rather than inserting a link. Both MS-Word and OpenOffice.org can import html in this fashion and pull in the vector graphics. Although this isn't org-babel specific, it's convenient to use with org-babel since there are so many ways to generate graphic files. See below for an example that uses R to create EPS and windows metafiles (windows only). I'm curious to hear if it works for anyone else. - Tom ---------------------------- #+TITLE: Vector graphic tests #+BABEL: :session *R* :results output :exports both This is a test of HTML export with vector graphics that can be read into MS-Word and OpenOffice.org. We need to tell orgmode's export to inline EPS and WMF files. Those image files won't be displayed in a browser, but they will be imported into MS-Word or OpenOffice.org Writer. We also need to strip off the XML header line as discussed here [[http://thread.gmane.org/gmane.emacs.orgmode/26236/focus=26238]] That's taken care of by the "(setq org-export-html-xml-declaration" below. Note that all of this is based on with Windows XP and R 2.11.1. #+begin_src emacs-lisp (setq org-export-html-inline-image-extensions '("png" "jpeg" "jpg" "gif" "ps" "eps" "wmf" "emf")) (setq org-export-html-xml-declaration '(("html" . "") ("php" . "\"; ?>"))) #+end_src * EPS For EPS import into MS-Word 2003, it works fine with the extension ".eps" but not always with the extension ".ps", so we can't use org-babel-R's built-in graphics support which defaults to the ".ps" extension. OpenOffice.org 3.2 seems to work fine with either extension. #+begin_src R :results value file setEPS() # set up the postscript driver for EPS output fname = "cos.eps" postscript(fname) plot(cos) dev.off() fname #+end_src #+results: [[file:cos.eps]] * WMF The WMF works in MS-Office and in OpenOffice.org. WMF files don't look as nice as EPS files for printed output, but they sometimes work okay in powerpoints. #+begin_src R :results value file fname = "sin.wmf" win.metafile(fname, width = 5, height = 5) plot(sin) dev.off() fname #+end_src #+results: [[file:sin.wmf]]