# How to center a graphic in its output cell

Say I have produced a single graphic ouput, perhaps a plot. Instead of displaying left-aligned in the notebook, I would like it to display in the center of the output cell. I would like it to stay centered if I change the magnification. I would like it to be centered when I export to PDF.

Possible?

• It is not very intuitive but you select the output cell and then select Format | Text Alignment | Align at Center. This will align the cells contents to centre as long as you do not delete the output cell. You can re-evaluate the expression and the output will stay centred. Sep 3 '15 at 23:13
• @Edmund. You should post your comment as an answer. Short as it is, it is a complete and useful answer. Sep 4 '15 at 0:21

You can also use Pane/Framed etc. + Full width + Alignment:

Pane[
Graphics @ Disk[],
Full,
Alignment -> Center
]


related: 46028

It is not very intuitive but you select the output cell and then select Format | Text Alignment | Align at Center. This will align the cells contents to centre as long as you do not delete the output cell. You can re-evaluate the expression and the output will stay centred.

To get programmatically the same effect that Edmund points out, one can explicitly construct the output cell:

CellPrint[
ExpressionCell[
Plot[Sin[x], {x, -7, 7}],
"Output",
TextAlignment -> Center
]
]


To center a text cell from an equation, I use

CellPrint[
Cell[BoxData[
PaneBox[HoldForm[1 + 1 = 2] // ToBoxes, Alignment -> Center,
ImageSize -> Full]], "Text"]]