Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2006
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2006

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Re: are there any methods of figuring out how "large" a piece of typeset textual data will be?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg71960] Re: [mg71295] Re: are there any methods of figuring out how "large" a piece of typeset textual data will be?
  • From: "Chris Chiasson" <chris at chiasson.name>
  • Date: Wed, 6 Dec 2006 06:03:37 -0500 (EST)
  • References: <200610220520.BAA04787@smc.vnet.net> <453C2C63.70702@wolfram.com>

There are some small ends to tie up here.

1)

As part of my project for exporting Mathematica output to different
formats, I wrote an extension to Mathematica's Export function for the
"PDF" filetype. Mathematica can now embed fonts in PDFs and export
typeset expressions instead of just Graphics objects.

I did this through inserting PostScript commands into the output of an
equivalent EPS Export statement and then feeding this EPS
(automatically) into Ghostscript via the Run command.

The end result is that Export["filename.pdf",expr,"PDF"] now has the
capabilities of Export["filename.eps",expr,"EPS"].

The code is part of the XML`DocBook` package contained in MMADE, which
is available here:

http://code.google.com/p/mmade/

If one just wants to use this functionality instead of the full
capabilities of MMADE, one only needs to install Ghostscript (look on
the tools page) and finish step 2 of the install process.

2)

I was unsuccessful at creating a way to diagram an arbitrary
Mathematica DownValue. I kept running into variations of the same
fundamental problem. Any expression can be broken into a tree of sub
expressions for diagramming, with lines between sub expressions.
However, adding more links (or reorganizing links) between sub
expressions to represent program flow tends to confuse the graph (and
the viewer).

Anyway, I broke down and used Visio after trying (hard) with Graphviz
and Graph::Easy... Graphviz and Graph::Easy don't have a very strong
notion of "This graph must fit in this space, or else!".

On 11/12/06, bghiggins at ucdavis.edu <bghiggins at ucdavis.edu> wrote:
>
> As a side issue on using Mathematica typeset output in presentations
> with software such as PowerPoint and  Keynote on a Mac with OS X:
>
> There is a nice piece of software call LateX Equation Editor that
> allows you to paste in a TeX expression and get a PDF of the equation
> that you can then paste into your favorite presentation software .
> Thus:
>
> \!\(ComplexExpand[\((\(-1\))\)\^\(1/5\)] // TeXForm\)
>
> Out[122]//TeXForm=
> \frac{1}{4}+\frac{\sqrt{5}}{4}+\frac{1}{2} i
>    \sqrt{\frac{1}{2} \left(5-\sqrt{5}\right)}
>
>  Then you simply paste this into LateX Equation Editor and bob's your
> uncle you have a PDF of the expression which you can then paste into
> Powerpoint etc . This also works for email
>
>
> Brian
>
> Chris Chiasson wrote:
> > I forgot to mention why this addendum is useful. Export and
> > ExportString can't export typeset expressions as "PDF". However, they
> > can export Graphics. The addendum provides a way to go from a typeset
> > expression to a graphics object. Of course, that still does not
> > provide a way around the fact that Mathematica doesn't embed its own
> > fonts into exported PDFs.
> >
> > On 11/11/06, Chris Chiasson <chris at chiasson.name> wrote:
> > > A short addendum for those who may search for this in the future:
> > >
> > > A Graphics object that just barely contains the box (or Cell) "form"
> > > of an expression may be created. Creating a Cell without a border is
> > > outside the scope of this post, but involves the options
> > > CellFrameMargins & CellMargins.
> > >
> > > anyway, assuming boxes is defined appropriately:
> > >
> > > {{width,yup,ydown}}=FrontEndExecute[GetBoundingBoxSizePacket[boxes]];
> > >
> > > Graphics[Text[DisplayForm@boxes,{0,0}],ImageSize->({width,yup+ydown}/Magnification^2/.AbsoluteOptions[$FrontEnd,Magnification])]//Show
> > >
> > > On 10/22/06, Carl Woll <carlw at wolfram.com> wrote:
> > > > Chris Chiasson wrote:
> > > >
> > > > >... after the front end gets done formatting it?
> > > > >
> > > > >I was thinking about getting the front end to spit out an equivalent
> > > > >EPS for the text and extracting the size from that, but I don't know
> > > > >if I can do it properly. Is there an easy method? Perhaps via some
> > > > >kind of API?
> > > > >
> > > > >The context for this question is that I am trying to generate "labels"
> > > > >(expressions) for nodes in a graph. I am trying to diagram functions.
> > > > >
> > > > >
> > > > There is an undocumented function that you may use to obtain this
> > > > information, with the usual caveat that this functionality is subject to
> > > > change. Here is an example of finding the size of the expression
> > > > Expand[(1+x)^11]:
> > > >
> > > > In[6]:=
> > > > FrontEndExecute[GetBoundingBoxSizePacket[BoxData[ToBoxes[Expand[(1 +
> > > > x)^11]]]]]
> > > > Out[6]=
> > > > {{504., 13., 4.}}
> > > >
> > > > I believe the returned values are {{width, toptobaseline,
> > > > baselinetobottom}} in points.
> > > >
> > > > Carl Woll
> > > > Wolfram Research
> > > >
> > >
> > >
> > > --
> > > http://chris.chiasson.name/
> > >
> >
> >
> > --
> > http://chris.chiasson.name/
>
>


-- 
http://chris.chiasson.name/


  • Prev by Date: Re: Re: Numerical Integration
  • Next by Date: Re: Re: Re: Reduction of Radicals
  • Previous by thread: Re: Numerical Integration
  • Next by thread: Re: Vandermonde Matrix/Optimization question