Re: Annotating Mathematica EPS files with Illustrator

*To*: mathgroup at smc.vnet.net*Subject*: [mg46534] Re: Annotating Mathematica EPS files with Illustrator*From*: "Steve Luttrell" <steve1 at _removemefirst_luttrell.org.uk>*Date*: Sun, 22 Feb 2004 11:27:32 -0500 (EST)*References*: <c16ln5$5n3$1@smc.vnet.net>*Sender*: owner-wri-mathgroup at wolfram.com

I posted this reply in another thread on 9 January 2004, but it seems to be relevant here as well. To cut a long story short, it is possible to generate all the annotation you want entirely within Mathematica, which saves me having to buy (and learning to use) other software packages. The user manual suggests various simple techniques that I have found to be next to useless if you want to create really nice annotation (i.e. mixed fonts, maths that looks the way it should, etc). After some experimentation I came up with the following general solution to the problem which I posted earlier (you must remember to embed any unusual - e.g. Mathematica - fonts in the PDF you eventually create): I have spent a lot of time trying to find a way of adding decent looking annotation to plots in Mathematica. The key trick that I have found is a way of using the Text graphics primitive to add any nicely formatted text that you can ordinarily create in a text cell. For example set the default textstyle for graphics text (this is important otherwise things don't display nicely) $TextStyle = {FontFamily -> "Times", FontSize -> 16}; and then use the following template to create a text graphic Show[Graphics[Text[DisplayForm[...],{0,0}]]] Now the problem is to construct a suitable expression to insert in place of the ... above. You can generate an appropriate expression to use for ... by using the text editing capabilities of Mathematica to create a Text cell that looks exactly like what you want to display in the text graphic above, and then copy from the Text cell the expression you need to make the text graphic work properly. For instance if you could a bold x with a 0 subscript in an embedded cell in a Text cell. If you then Show Expression on this cell you get Cell[TextData[Cell[BoxData[ FormBox[ SubscriptBox[ StyleBox["x", FontWeight->"Bold"], StyleBox["0", FontWeight->"Plain"]], TraditionalForm]]]], "Text"] Now if you copy the part from the FormBox[... to the ....TraditionalForm] which is FormBox[ SubscriptBox[ StyleBox["x", FontWeight->"Bold"], StyleBox["0", FontWeight->"Plain"]], TraditionalForm] and paste it in place of ... in Show[Graphics[Text[DisplayForm[...],{0,0}]]] at the top of this message. You then have an expression that displays as a text graphic exactly what you created in the Text cell above. It looks like this when it has been spliced together Show[Graphics[Text[DisplayForm[ FormBox[ SubscriptBox[ StyleBox["x", FontWeight->"Bold"], StyleBox["0", FontWeight->"Plain"]], TraditionalForm] ],{0,0}]]] The above input cell creates the required text graphic. This approach generalises to arbitrarily complicated expresions that you can construct in a Text cell. This trick is EXTREMELY USEFUL. I find that I can create very nice looking annotated graphics without ever needing to go outside Mathematica. Even better, I can generate all of my graphics under software control, so it is very quick and easy to make changes. Now why isn't this trick described in the Mathematica book? -- Steve Luttrell West Malvern, UK "Kevin Gross" <kc144 at woh.rr.com> wrote in message news:c16ln5$5n3$1 at smc.vnet.net... > Hi folks, > > I know that some of you annotate Mathematica EPS graphics using Adobe > Illustrator. How are you able to do that while > (1) using the Mathematica fonts and font combinations (e.g. the greek > letter nu with a tilde on top, i.e. from the front end, type <ESC> nu > <ESC> <CTRL 7> ~) > (2) automatically preserving the bounding box info? > > I'm looking for any tips that can be used to have Mathematica output a > high-quality EPS file that can be imported by and annotated in > Illustrator and subsequently conversion to PDF. I obtained > Illustrator and Distiller for this purpose, but the long story below > details my unsuccessful trip down this path. > > Thanks, > > Kevin > > ---The long story--- > Mathematica 5 on Mac OSX (10.3.2) > Adobe Illustrator CS (11.0) > Adobe Distiller (6.0.1) > > I exported a Mathematica graphic as an EPS file with the fonts > embedded, which can be found here: > <http://kc144.dyndns.org/~kevin/plot-FontIncl.eps.gz> > It was converted to PDF using Preview.app (image viewer that ships w/ > OSX) and is found here: > <http://kc144.dyndns.org/~kevin/plot-FontIncl.pdf> > > I can open the EPS file using Illustrator, but parentheses, minus > signs and greek text don't show up properly. This seems odd as > Illustrator can see the Mathematica fonts. (For those who speak Mac > OSX: Mathematica.dfont installed in ~/Library/Fonts and the fonts are > accessible from within Illustrator). Opening the PDF is slightly > better, but nu with a tilde on top shows up as a question mark. > > Then I thought Illustrator would be happy if it opened up a PDF > created by its cousin Distiller. The resulting PDF file has the right > fonts, but now the bounding box is wrong. I'm using the Standard > presets for Distiller which, according to the documentation, uses the > %%BoundingBox comment to determine the page size of the PDF. Opening > this PDF in Illustrator still gives a question mark for the nu with a > tilde on top. > > I also tried the same excercise but with an EPS file that did not > include the Mathematica fonts. Import to Illustrator resulted in > Courier being substituted for many characters. Why when it can see > the Mathematica fonts? Distiller correctly picks up the Mathematica fonts but still > has the bounding box issue and nu-tilde still shows up as a question > mark. ARG! > > And even if I get this font problem resolved, it looks as if I'll need > to manually set the page dimensions from within Illustrator. I assumed > that by opening the EPS file, the canvas size would be automatically > set to what was in the %%BoundingBox comment. > > So is this a problem with the Mathematica-generated postscript file or > did the Adobe, the authors of postscript, supply flakey PS parsers in > their Illustrator and Distiller programs? Or have I completely missed > something? >