7
$\begingroup$

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?

$\endgroup$
2
  • 1
    $\begingroup$ 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. $\endgroup$ – Edmund Sep 3 '15 at 23:13
  • $\begingroup$ @Edmund. You should post your comment as an answer. Short as it is, it is a complete and useful answer. $\endgroup$ – m_goldberg Sep 4 '15 at 0:21
6
$\begingroup$

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

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

related: 46028

$\endgroup$
8
$\begingroup$

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.

$\endgroup$
5
$\begingroup$

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
  ]
 ]
$\endgroup$
0
$\begingroup$

To center a text cell from an equation, I use

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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