14

What is a good way to get LaTeX formulas into CorelDRAW figures?

I will provide a solution below, based on a rather old macro adapted to work on 64 bit systems as well as 32 bit - it works well, but if anyone knows of a newer and/or better solution, please post it!


Note: I am not sure whether this is the right place for a question like this one, but as I find it very useful to integrate CorelDRAW and LaTeX, and it cost me quite some time around the internet to make it work, I think this information should be up somewhere where it is easily accessible.

3
  • 1
    You can draw over your Corel Draw image : tex.stackexchange.com/questions/9559/…
    – percusse
    Nov 3, 2012 at 13:20
  • Will post my answer later - my reputation (below 10) doesn't allow me to post it right away. Nov 3, 2012 at 13:27
  • @percusse Yes, that's nice, but it doesn't enable you to style you formulas using all the machinery of CorelDRAW, e.g. making matching labels and curves in corresponding colours etc. rather cumbersome. Nov 3, 2012 at 13:30

1 Answer 1

17

Here is one way to integrate LaTeX in CorelDRAW on Windows.

This macro will allow you to insert LaTeX into your figures as vector graphics which can be edited just like any other curve in CorelDRAW, e.g. setting fill colour, outline etc.

Download

Get the CorelDRAW macro by Jan Bender from: impulse-based.de

Requirements

It can be made to work with CorelDRAW X5 32bit and CorelDRAW X6 64bit. Presumably, it works with earlier versions as well. It requires the latex.exe and dvips.exe to be in the path.

Installation

  1. Extract the contents of the ZIP file somewhere. I keep them in a subfolder of the CorelDRAW program folder, e.g. Corel_Latex.

  2. In CorelDRAW X5 or X6 go to Tools → Macros → Macro editor. In the macro editor, highlight the GlobalMacros (GlobalMacros.gms) item in the list on the left, then go to File → Import File and import the .bas and the .frm files. Close the macro editor.

  3. To setup a keyboard shortcut for the LaTeX macro, go to Tools → Customization, select Commands in the list on the left, then select Macros from the drop-down menu on the right.

    Find LatexEdit in the list, click on it, then under the Shortcut Keys tab on the right, click in the New Shortcut Key field, and define your shortcut using the keyboard, e.g. type Alt+A. Click Assign, and then OK.

  4. After setting this up, you can create LaTeX by hitting Alt+A (or whatever shortcut you defined). You get a pop-up window where you can type the LaTeX code (remember the $ signs for math).

    To edit formulas which have been created using the macro, simply select them and hit the keyboard shortcut to bring up the LaTeX editor. Note though, that editing the LaTeX will reset properties such as fill colour and outline (but not size) — at least on my system it does.

Troubleshooting

If the macro does not work after following steps 1. to 4. one of the following fixes may help:

  • If the macro runs, but the resulting graphic does not display the LaTeX font right — i.e. if symbols like Greek letters are replaced with their Arial equivalents and mathematical symbols like integrals disappear, try this:
    Import any .ps file and make sure to set “import text as curves” in the process. Now run the macro again.

  • If you are running X5 32bit, the macro runs, but the LaTeX doesn't format right and the previous fox does not help, try renaming your Ghostscript directory, e.g. rename C:\Program Files (x86)\gs to C:\Program Files (x86)\gs_newname. Open CorelDRAW and run the macro again.

  • If you are running X6 64bit and you get a compiler error when you try to execute the macro, in the macro editor replace the following lines (which will be highlighted in red when the compiler errs)

    Private Declare Function OpenProcess...
    Private Declare Function GetExitCodeProcess...
    

    with

    Private Declare PtrSafe Function OpenProcess...
    Private Declare PtrSafe Function GetExitCodeProcess...
    

    and save the macro again.

    Then is should compile and work fine. In principle handle and pointer variables should be declared as PtrLong rather than Long on a 64bit system, but the macro seems to work without any further modifications.

4
  • Thank you very much! You helped me a lot. I registered solely to upvote you, but apparently I am not reputable enough.
    – user25398
    Feb 2, 2013 at 13:39
  • @Gerard: Welcome to TeX.sx! I converted your post to a comment. You need 15rep in order to up-vote. See tex.stackexchange.com/privileges for more details. Feb 2, 2013 at 15:03
  • Is it possible to modify something so that it will run with latex-beamer fonts to put it on a presentation?
    – HericDenis
    Jun 27, 2014 at 0:59
  • This is very useful. I can now draw and put formulae easily. Amazing feature!
    – Schwale
    Apr 7, 2016 at 14:50

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .