Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2005
*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 2005

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

Search the Archive

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






  • Prev by Date: Re: Finding Position in an ordered list
  • Next by Date: Reloading packages: Removed[symbol]
  • Previous by thread: Re: Re: Mathematica TeX save in standard LaTeX style
  • Next by thread: Reloading packages: Removed[symbol]