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
Extract the contents of the ZIP file somewhere.
I keep them in a subfolder of the CorelDRAW program folder, e.g. Corel_Latex
.
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.
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.
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.