Mathematica Stack Exchange is a question and answer site for users of Mathematica. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I like very much to wrap Mathematica images by Panel, which gives many of them a much better view. To be precise, if image is some illustration, plot etc. I would like to put it in Mathematica document as Panel@image Then I typically mark the output as Figure in the JournalArticle StyleSheet.

However, most of my documents should be later transformed into PDF for further use. This is unavoidable, since in my company nobody else uses Mathematica.

In the PDF document version the panel loses most of its attractiveness. The gray color becomes almost white, and the fine rim details (which made the panel looking in Mathematica like a 3D-relief) disappear. In this form Panel makes the view worse, rather than improve it. To be more precise, here is an image wrapped by a panel: please execute the following in Mathematica notebook:


Mathematica graphics

As you see the panel looks a 3D relief. It does not exist any more in the PDF version of the file that you can see below.

Besides, the panel color is much worse now.

Have you any idea of what could be done to improve the Panel view after the document is transformed into PDF?

share|improve this question
up vote 13 down vote accepted

You could mimic the panelled look by doing something like

panelBox[pt0 : {x0_, y0_}, 
  pt1 : {x1_, y1_}] := {{GrayLevel[.7], Rectangle[pt0, pt1]}, {White, 
   Polygon[{Offset[{.3, .3}, pt0], Offset[{2, 2}, pt0],
     Offset[{2, -2}, {x0, y1}], Offset[{-2, -2}, {x1, y1}], 
     Offset[{-.3, -.3}, {x1, y1}], Offset[{.3, -.3}, {x0, y1}]}]},
   Polygon[{Offset[{.3, .3}, pt0], Offset[{2, 2}, pt0],
     Offset[{-2, 2}, {x1, y0}], Offset[{-2, -2}, {x1, y1}], 
     Offset[{-.3, -.3}, {x1, y1}], Offset[{-.3, .3}, {x1, y0}]}]}}

panel[gr_] := Module[{dim},
  dim = Dimensions[Rasterize[gr][[1, 1]]][[{2, 1}]];
  Graphics[{panelBox[{-10, -10}, dim + 10], 
    Inset[gr, Center, Center, dim]}, ImageSize -> dim + 20]]


Mathematica graphics

share|improve this answer
Thank you, this is a nice approach. – Alexei Boulbitch May 2 '12 at 10:31

It's not possible with any existing version of Mathematica. Mathematica uses drawing routines provided by the operating system to draw the Panel you prefer. In many cases it isn't possible to convert these OS-supplied appearances to a vector graphic suitable for inclusion in the PDF file, so Mathematica uses a generic appearance.

{#, Style[#, ControlsRendering -> "Generic"]}& @ Panel[Import["ExampleData/rose.gif"]]

Mathematica could, in theory, include a bitmap representation of the OS appearance, but that wouldn't zoom or print well.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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