Exporting equations from Mathematica to Corel with full Latex quality

11

2

I am wondering if there is any possible solution to exporting equations from Mathematica to Corel. I was trying first to export an equation as pdf from Mathematica and then to import .pdf to Corel, but many characters are missed. Maybe someone had success with this kind of problem.

Pipe

Posted 2013-06-03T01:58:47.767

Reputation: 1 069

Does it work if you use the function in this answer? Just say outlinedExport["output.pdf", g, ImageSize -> 600] or something similar.

– Jens – 2013-06-03T03:58:12.637

Answers

10

There is a similar problem with Adobe Illustrator, too. For that purpose, I use the following function (see my web site for more info):

toPDF[x_, opts : OptionsPattern[]] := 
  If[! ImageQ[x], 
   First@ImportString[
     ExportString[
      Pane[Style[TraditionalForm[HoldForm[x]], 
        FilterRules[{opts}, Options[Style]]], 
       FilterRules[{opts}, ImageSize], 
       BaseStyle -> {FontFamily -> "Times New Roman", 
         Background -> (Background /. {opts} /. {Background -> 
              None})}], "PDF"], "PDF", "TextMode" -> "Outlines"]];
SetAttributes[toPDF, HoldFirst]

Example:

toPDF[Integrate[1 + Sin[x]^2, {x, 0, Pi}], FontSize -> 18]

screenshot

Now you can either highlight the result (as I did above) and copy it as PDF (on Mac), or type Export["eq.pdf", %] in the next cell, to save to a file.

The reason I added the attribute HoldAll above is that I wanted to be able to export expressions like integrals without having them be evaluated. So the purpose of this function is really geared toward typesetting equations, and then copying them to Illustrator. Maybe this is also what you want for your drawing application.

I use Pane as a wrapper for the equation in order to be able to control the bounding box of the PDF. The function also accepts a Background option in case you want to add a color behind the equation.

Edit for version 10.1:

Due to added bugs in Import with PDF format, the example above won't work properly anymore. Another solution that still does work is the function gsExport from my answer here. You have to make sure that ghostscript is installed and in the search path. If the linked code doesn't find your gs command, you could add the path directly in the code, as in /path/to/gs. After invoking gsExport["filename.pdf", HoldForm[Integrate[1 + Sin[x]^2, {x, 0, Pi}]]], you can do Import["filename.pdf"].

Jens

Posted 2013-06-03T01:58:47.767

Reputation: 93 191

1

Same problem with BoundaryDiscretizeGraphics in v10.2.

– Szabolcs – 2015-07-24T17:41:27.447

Since v9.16, you can use the following with GhostScript: gs -o out.pdf -dNoOutputFonts -sDEVICE-pdfwrite in.pdf. This won't involve any conversions to EPS. It goes directly from PDF to PDF. – Szabolcs – 2015-07-24T17:43:23.033

@Szabolcs Great, thanks, I'll add that to my linked answer! (I checked that the old syntax also still works in 9.16, though). I'll also have to file another bug report for the Import issue, I guess. Although I believe I reported stuff like that a couple of times already. New issues keep popping up... – Jens – 2015-07-24T17:49:37.513

@Szabolcs Reported the Import bug to Wolfram [CASE:3391590]. – Jens – 2015-07-24T18:16:11.857

Thank you very much Jens. This I was trying to get. Quality of image-equation is very nice in corel. Thank you Jens a lot, hope that your "papers" look perfect. – Pipe – 2013-06-03T11:16:43.350