I often create graphics in OpenOffice.org Draw, containing vector graphics, text labels, with photos occasionally mixed in. OpenOffice.org supplies a variety of export formats. Is there any way to export the graphics from this software to a format that can be placed in a ConTeXt document, such that the text labels are rendered using the font choices and typography of ConTeXt?

  • 1
    The only way to render the text elements by ConTeXt is to use TikZ or Metapost. I don't know if OO Draw exports to either of these formats (though I highly doubt it). – Aditya Mar 2 '12 at 6:27
  • 2
    Is there any possibility of using psfrag? I'm not sure is ConTeXt handles EPS files. Alternatively saving as EPS, and then converting with eps2pgf will give you something you can use in a pgfpicture so you can typeset the text (probably). – qubyte Mar 2 '12 at 6:34
  • 1
    What OS are you on? If Linux or perhaps Mac I could probably throw together a script. – qubyte Mar 2 '12 at 10:22
  • I am using Linux. – Village Mar 2 '12 at 11:14
  • 1
    I know Inkscape can do it. I also know Inkscape can be instructed to do things programmatically from the prompt. Perhaps saving in some format Inkscape can handle and then script Inkscape to do the exporting could be a way forward. (Or if there aren't too many graphics do it manually on into Inkscape imported graphics...) – jonalv Mar 23 '12 at 9:39

Since OO Draw cannot write TikZ code directly, you will need an intermediate format. Basically there are two options, only one of them works.

ODG -> SVG -> Inkscape SVG -> TikZ: inkscape2tikz

Since OpenOffice Draw is capable of producing SVG output, you can open it in Inkscape (version 0.48 or later, any current version should do) and use the PDF+LaTeX export feature as suggested by this answer. The basic idea is that the drawing without text is exported as PDF, and the text portions are exported as TikZ code. This tutorial (also linked from the above answer) shows in detail how to do it. I'm not sure if it's possible to produce ConTeXt, though.

The inkscape2tikz extension doesn't help here. It seems to be unmaintained and produced various issues when I tried it on a small example:

  • Had to crop the file in Inkscape
  • Had to edit the TeX output to remove a superfluous object
  • The text label had (0, 0) coordinates

ODG -> EPS -> PGF: eps2pgf

I haven't tried the tool, which is also the subject of one of the replies to PS-or-PDF to tikz converter? . However, this approach (and also ODG -> PDF -> PGF) is bound to fail, since the generated EPS/PDF do not contain the label text as entire string but rather as individual characters.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.