emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Org-mode to MS-Word/OOo with vector graphics
@ 2010-09-02 14:45 Tom Short
  2010-09-02 19:21 ` David Maus
  0 siblings, 1 reply; 3+ messages in thread
From: Tom Short @ 2010-09-02 14:45 UTC (permalink / raw)
  To: emacs-orgmode

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" . "<?php echo \"<?xml version=\\\"1.0\\\" encoding=\\\"%s\\\" ?>\";
?>")))
#+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]]

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

* Re: Org-mode to MS-Word/OOo with vector graphics
  2010-09-02 14:45 Org-mode to MS-Word/OOo with vector graphics Tom Short
@ 2010-09-02 19:21 ` David Maus
  2010-09-02 19:55   ` Short, Tom
  0 siblings, 1 reply; 3+ messages in thread
From: David Maus @ 2010-09-02 19:21 UTC (permalink / raw)
  To: Tom Short; +Cc: emacs-orgmode


[-- Attachment #1.1: Type: text/plain, Size: 704 bytes --]

Hi Tom,

Tom Short wrote:
>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.

Do you mind if I put it on a list for a possible tutorial about how to
export Org mode files for later use in OOo or MS Word?  There have
been some questions about this lately and I think a tutorial about
different approaches (via DocBook, HTML, tex4ht, ..) would be a nice
addition to Worg.

Best,
  -- David
--
OpenPGP... 0x99ADB83B5A4478E6
Jabber.... dmjena@jabber.org
Email..... dmaus@ictsoc.de

[-- Attachment #1.2: Type: application/pgp-signature, Size: 230 bytes --]

[-- Attachment #2: Type: text/plain, Size: 201 bytes --]

_______________________________________________
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode

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

* RE: Org-mode to MS-Word/OOo with vector graphics
  2010-09-02 19:21 ` David Maus
@ 2010-09-02 19:55   ` Short, Tom
  0 siblings, 0 replies; 3+ messages in thread
From: Short, Tom @ 2010-09-02 19:55 UTC (permalink / raw)
  To: David Maus; +Cc: emacs-orgmode

Fine with me, David. If you want some notes on what I couldn't get to 
work, here they are:

* docbook export - load into OpenOffice.org 3.2 directly
  Fails; I don't know why.

* docbook export - use docbook2odf
  Doesn't work with docbook v5 produced by orgmode

* docbook export - DOCX converter
  http://www.brians-brain.org/projects/org-to-docx.html

  Didn't convert graphics.

* latex export - tex4ht to OpenOffice.org format
  tex4ht converts to a .ODF file okay, but it converts graphics to 
  PNG in the process. Configuration of tex4ht is complex. There is 
  some indication that EPS files could work:

 
http://newsgroups.derkeiler.com/Archive/Comp/comp.text.tex/2010-08/msg00
800.html

- Tom

> -----Original Message-----
> From: David Maus [mailto:dmaus@ictsoc.de] 
> Sent: Thursday, September 02, 2010 15:21
> To: Short, Tom
> Cc: emacs-orgmode@gnu.org
> Subject: Re: [Orgmode] Org-mode to MS-Word/OOo with vector graphics
> 
> Hi Tom,
> 
> Tom Short wrote:
> >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.
> 
> Do you mind if I put it on a list for a possible tutorial 
> about how to export Org mode files for later use in OOo or MS 
> Word?  There have been some questions about this lately and I 
> think a tutorial about different approaches (via DocBook, 
> HTML, tex4ht, ..) would be a nice addition to Worg.
> 
> Best,
>   -- David
> --
> OpenPGP... 0x99ADB83B5A4478E6
> Jabber.... dmjena@jabber.org
> Email..... dmaus@ictsoc.de
> 

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

end of thread, other threads:[~2010-09-02 20:21 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-09-02 14:45 Org-mode to MS-Word/OOo with vector graphics Tom Short
2010-09-02 19:21 ` David Maus
2010-09-02 19:55   ` Short, Tom

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