Re: Centering of graphics

*To*: mathgroup at smc.vnet.net*Subject*: [mg57773] Re: [mg57747] Centering of graphics*From*: "David Park" <djmp at earthlink.net>*Date*: Wed, 8 Jun 2005 03:21:22 -0400 (EDT)*Sender*: owner-wri-mathgroup at wolfram.com

Markus, I'm glad you asked that because I learned something. In the Help for DisplayFunction (In Version 5.1.1 at least), under Examples, there is the routine: CenteredGraphicDisplayFunction[ gr : (_Graphics | _Graphics3D | _SurfaceGraphics | _DensityGraphics | \ _ContourGraphics)] := Module[{psstring, cellexpr}, SelectionMove[EvaluationNotebook[], After, EvaluationCell]; psstring = DisplayString[gr]; cellexpr = Cell[TextData[{Cell[GraphicsData["PostScript", psstring]]}], "Graphics", TextAlignment -> Center]; NotebookWrite[EvaluationNotebook[], cellexpr]] which keeps the graphics always centered in the notebook. Plot[Sin[x], {x, 0, 2Pi}, DisplayFunction -> CenteredGraphicDisplayFunction] David Park djmp at earthlink.net http://home.earthlink.net/~djmp/ From: wossmer [mailto:1107-209 at online.de] To: mathgroup at smc.vnet.net Dear colleagues, I am just writing a technical text with a lot of imported and Mathematica generated pictures/graphics. I wonder how to center them automatically. Or is there no solution for this "simple" problem? The contribution in the MathGroup Archive 1999 "centering a figure" from P.J. Hinton did not work: the picture keeps more at the left side than in the center of the page. I use Mathematica 5.1. Any suggestions? Best regards Markus