13
$\begingroup$

Update

This looks now like it was a bug in Mathematica version 8, because everything works as expected - at least for this minimal example - in version 9. (As an aside, I couldn't seem to find the Creative stylesheets using the menu interface, although they're still installed at "/Applications/Mathematica.app/SystemFiles/FrontEnd/StyleSheets/Creative/" (on Mac OS X). Perhaps I accidentally did something to hide them...

I finally tracked down a weird problem I was having with Export and other image-related operations to the type of stylesheet I was using. Consider the same expression evaluated in three different notebooks:

ImageDimensions[Rasterize["Mathematica"]]

enter image description here

You can see that, with the fancier stylesheets, the graphics of the notebook have interacted with the graphics produced by the Mathematica expression.

Is there a work round for this?

Here's another example - exporting a video using the Creative/PrimaryColor stylesheet.

grafik = Manipulate[ 
  Graphics3D[{Blue, Cuboid[{0, 0, 0}, {1, 1, 1}]}, Boxed -> False, 
   SphericalRegion -> True, 
   ViewPoint -> {12 Cos[t],  12 Sin[t], 6 Sin[t]}],  {t, 0 , 2 Pi, 
   Pi/24}]
Export["/tmp/grafix.mov", grafik]

stylesheet problems 2

When the resulting movie is viewed in a movie player, you can see the orange outline and the original graphical frame:

stylesheet problems 3

$\endgroup$
3
  • 3
    $\begingroup$ Maybe someone here from WRI staff can comment if this bug is fixed in the development version? $\endgroup$ Commented Sep 3, 2012 at 12:50
  • $\begingroup$ This looks now like it was a bug in Mathematica version 8, because everything works as expected - at least for this minimal example - in version 9. (As an aside, I couldn't seem to find the Creative stylesheets using the menu interface, although they're still installed at "/Applications/Mathematica.app/SystemFiles/FrontEnd/StyleSheets/Creative/" (on Mac OS X). Perhaps I accidentally did something to hide them... $\endgroup$
    – cormullion
    Commented Dec 17, 2012 at 12:10
  • $\begingroup$ This question is useful for those still using v8 (I've had the above happen to me several times, although I've not been able to replicate it on demand). You can just make a short note at the top of your post saying that it has been fixed in version 9 (basically, your comment above). Perhaps also add the bugs tag and use a quote block to highlight it and differentiate it as a notice :) $\endgroup$
    – rm -rf
    Commented Jan 11, 2013 at 19:58

2 Answers 2

5
$\begingroup$

Here's a workaround for your first example. I don't know how robust it is, or if there are any nasty side effects.

Block[{StyleDefinitions},
 StyleDefinitions /: StyleDefinitions -> _ = StyleDefinitions -> "Default.nb";
 Rasterize["Mathematica"]]
$\endgroup$
1
$\begingroup$

(An extended comment rather than an answer)

This question is strongly related to these two:

As I've found during working on the answer to the latter question, there is inconsistency in styles used for Exporting to raster and vector formats:

  • when Exporting to raster formats, StyleDefinitions of the EvaluationNotebook[] are used

  • when Exporting to vector formats, DefaultStyleDefinitions (global $FrontEndSession option) are used

At the first step Export creates a Notebook from the expression supplied, and then sends this Notebook to the FrontEnd for conversion. In the case of raster formats this Notebook expression already contains the following options:

AbsoluteOptions[EvaluationNotebook[], {Evaluator, StyleDefinitions, WindowSize}]

A proof (output is from version 11.2.0):

Trace[ExportString["Mathematica", "MGF"], 
   CurrentValue | AbsoluteOptions | EvaluationNotebook] //. {{x___}} :> {x}
{{AbsoluteOptions[$FrontEndSession,CommonDefaultFormatTypes]},
{{EvaluationNotebook[],MathLink`CallFrontEnd[FrontEnd`EvaluationNotebook[]]},
{AbsoluteOptions[NotebookObject[Untitled-1],{Evaluator,StyleDefinitions,WindowSize}]}}}
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.